Bird
Raised Fist0
HLDsystem_design~20 mins

Layer 4 vs Layer 7 load balancing in HLD - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Load Balancing Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Difference in Protocol Awareness
Which statement correctly describes the protocol awareness difference between Layer 4 and Layer 7 load balancers?
ALayer 4 load balancers use DNS queries for routing, and Layer 7 load balancers use MAC addresses.
BLayer 4 load balancers inspect HTTP headers to route traffic, whereas Layer 7 load balancers only use IP addresses.
CLayer 4 load balancers operate based on IP address and TCP/UDP ports without inspecting the content, while Layer 7 load balancers inspect the application data to make routing decisions.
DLayer 4 load balancers analyze the full application payload, while Layer 7 load balancers only check the TCP handshake.
Attempts:
2 left
💡 Hint
Think about which OSI layers correspond to IP and TCP versus application data.
❓ Architecture
intermediate
2:00remaining
Choosing Load Balancer Type for a Web Application
You are designing a web application that requires routing users to different backend servers based on URL paths and user sessions. Which load balancer type should you choose?
ALayer 7 load balancer, because it can inspect HTTP headers and URLs to route requests.
BLayer 4 load balancer, because it efficiently routes based on IP and port.
CDNS load balancing, because it resolves domain names to different IPs.
DHardware firewall, because it filters traffic based on security rules.
Attempts:
2 left
💡 Hint
Consider which load balancer can look inside the HTTP request to route based on URL paths.
❓ scaling
advanced
2:30remaining
Scaling Impact of Layer 4 vs Layer 7 Load Balancers
Which statement best describes the scaling impact when using Layer 4 versus Layer 7 load balancers in a high-traffic environment?
ALayer 4 load balancers require more CPU resources because they decrypt SSL traffic, unlike Layer 7 load balancers.
BLayer 7 load balancers scale better because they cache all application data, reducing backend load.
CLayer 7 load balancers scale better because they operate at the network layer, which is faster.
DLayer 4 load balancers generally scale better because they perform less processing per packet compared to Layer 7 load balancers.
Attempts:
2 left
💡 Hint
Think about how much data each load balancer inspects and processes.
❓ tradeoff
advanced
2:30remaining
Tradeoffs Between Layer 4 and Layer 7 Load Balancers
What is a key tradeoff when choosing between Layer 4 and Layer 7 load balancers?
ALayer 4 load balancers provide detailed content inspection but are slower; Layer 7 load balancers are faster but only route by IP.
BLayer 4 load balancers offer faster routing but less intelligent traffic management; Layer 7 load balancers provide detailed routing but with higher latency.
CLayer 4 load balancers can route based on user sessions; Layer 7 load balancers cannot.
DLayer 4 load balancers require SSL termination; Layer 7 load balancers do not.
Attempts:
2 left
💡 Hint
Consider speed versus intelligence in routing decisions.
❓ estimation
expert
3:00remaining
Estimating Backend Server Load with Layer 7 Load Balancer
A Layer 7 load balancer inspects HTTP headers and routes requests to backend servers. If the load balancer handles 10,000 requests per second and each inspection adds 0.1 ms processing time, estimate the total CPU time spent per second on inspection. Choose the closest value.
A1 second of CPU time per second
B0.1 seconds of CPU time per second
C10 seconds of CPU time per second
D100 seconds of CPU time per second
Attempts:
2 left
💡 Hint
Multiply requests per second by processing time per request.

Practice

(1/5)
1. Which layer does Layer 4 load balancing operate on?
easy
A. Network layer using routing tables
B. Application layer using request content
C. Transport layer using IP and port
D. Physical layer using hardware signals

Solution

  1. Step 1: Understand OSI layers relevant to load balancing

    Layer 4 corresponds to the transport layer, which handles IP addresses and ports.
  2. Step 2: Match Layer 4 load balancing function

    Layer 4 load balancing uses IP and port information to distribute traffic without inspecting content.
  3. Final Answer:

    Transport layer using IP and port -> Option C
  4. Quick Check:

    Layer 4 = Transport layer [OK]
Hint: Layer 4 uses IP and port, Layer 7 uses content [OK]
Common Mistakes:
  • Confusing Layer 4 with Layer 7
  • Thinking Layer 4 inspects request content
  • Mixing network and transport layers
2. Which of the following is a correct characteristic of Layer 7 load balancing?
easy
A. Routes traffic based on IP address only
B. Does not inspect HTTP headers
C. Is faster than Layer 4 load balancing
D. Operates at the application layer inspecting request content

Solution

  1. Step 1: Identify Layer 7 load balancing features

    Layer 7 load balancing works at the application layer and inspects request content like HTTP headers.
  2. Step 2: Evaluate options

    Operates at the application layer inspecting request content correctly states Layer 7 inspects request content; others are incorrect or misleading.
  3. Final Answer:

    Operates at the application layer inspecting request content -> Option D
  4. Quick Check:

    Layer 7 = Application layer content inspection [OK]
Hint: Layer 7 inspects content, Layer 4 does not [OK]
Common Mistakes:
  • Assuming Layer 7 ignores HTTP headers
  • Believing Layer 7 is faster than Layer 4
  • Confusing IP-based routing with content-based routing
3. Given a load balancer that routes requests based on URL paths, which layer is it operating at?
medium
A. Layer 2
B. Layer 7
C. Layer 4
D. Layer 3

Solution

  1. Step 1: Understand URL path inspection

    URL paths are part of the application data in HTTP requests, which Layer 7 can inspect.
  2. Step 2: Match to OSI layer

    Layer 7 is the application layer that can route based on URL paths, unlike lower layers.
  3. Final Answer:

    Layer 7 -> Option B
  4. Quick Check:

    URL path routing = Layer 7 [OK]
Hint: URL path routing means Layer 7 [OK]
Common Mistakes:
  • Choosing Layer 4 for URL-based routing
  • Confusing network layers with application layer
  • Ignoring request content in routing decisions
4. A system uses a load balancer that inspects HTTP headers but is running slower than expected. What is a likely cause?
medium
A. Layer 7 load balancing adds processing overhead due to content inspection
B. Using Layer 4 load balancing instead of Layer 7
C. Layer 4 load balancing inspects too many headers
D. Layer 7 load balancing does not support IP-based routing

Solution

  1. Step 1: Identify load balancer type and performance impact

    Layer 7 load balancing inspects request content like HTTP headers, which adds processing overhead.
  2. Step 2: Analyze options for cause of slowness

    Layer 7 load balancing adds processing overhead due to content inspection correctly explains that Layer 7's content inspection slows processing; others are incorrect.
  3. Final Answer:

    Layer 7 load balancing adds processing overhead due to content inspection -> Option A
  4. Quick Check:

    Content inspection causes slower Layer 7 [OK]
Hint: Content inspection slows Layer 7 load balancers [OK]
Common Mistakes:
  • Blaming Layer 4 for inspecting headers
  • Ignoring processing overhead of Layer 7
  • Assuming Layer 7 cannot route by IP
5. You need to design a scalable web service that routes requests based on user authentication tokens in HTTP headers and also requires high throughput. Which load balancing approach is best?
hard
A. Layer 7 load balancing to inspect tokens despite some overhead
B. Layer 4 load balancing for speed, ignoring tokens
C. Use DNS round-robin instead of load balancers
D. Combine Layer 2 switching with Layer 3 routing

Solution

  1. Step 1: Identify requirement to inspect authentication tokens

    Authentication tokens are in HTTP headers, requiring application-level inspection.
  2. Step 2: Choose load balancing approach balancing inspection and throughput

    Layer 7 load balancing inspects headers and supports smart routing, suitable despite overhead.
  3. Step 3: Evaluate other options

    Layer 4 cannot inspect tokens; DNS round-robin lacks smart routing; Layer 2/3 unrelated to content inspection.
  4. Final Answer:

    Layer 7 load balancing to inspect tokens despite some overhead -> Option A
  5. Quick Check:

    Token inspection needs Layer 7 [OK]
Hint: Inspect tokens? Use Layer 7 despite overhead [OK]
Common Mistakes:
  • Choosing Layer 4 ignoring token inspection need
  • Using DNS round-robin for smart routing
  • Confusing network layers with application logic
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard