1

As far as I known, L4 load balancer maintains 2 TCP connections:

  • One is from front side to Load balancer
  • LB terminate above connection, create new TCP connection , change IP/Port of TCP packet to forward to backend.

In HTTP2/gGPRC, client-server will maintains a single long live connection. If we use L4, this connection will be the first one which is mentioned above.

In some articles, I read that although there are multiple deployed backend servers, once one client makes first request to one backend, this pair client-backend will be kept for all successive requests. That means other backends are unused.

Here is one of articles: https://blog.bugsnag.com/envoy/

gRPC uses the performance boosted HTTP/2 protocol. One of the many ways HTTP/2 achieves lower latency than its predecessor is by leveraging a single long-lived TCP connection and to multiplex request/responses across it. This causes a problem for layer 4 (L4) load balancers as they operate at too low a level to be able to make routing decisions based on the type of traffic received. As such, an L4 load balancer, attempting to load balance HTTP/2 traffic, will open a single TCP connection and route all successive traffic to that same long-lived connection, in effect cancelling out the load balancing.

I am really unclearly this point. Anybody could please explains more details? Many appreciate! Thanks

2 Answers 2

0

If you have more clients than backend servers, this might not be a problem. Try a least connection algorithm, like "leastconn" from haproxy. Making up an example, maybe your 10 switches stream metrics data via gRPC into 3 backend nodes of your monitoring platform. Every backend gets some work.

Even if you only have one connection, this still might not be a problem, assuming a single node can handle it. Effectively this becomes an active/passive configuration. Whether that host kept idle is worth the expense is your decision.

That said, sometimes load balancers inspect the application at layer 7. A common HTTP example is cookie affinity. Layer 7 is not required for long lived connections, however.

0

I think you have a slight confusion about Layer 4 (Think LVS and routing), and layer 7 (HAProxy). HAProxy in TCP mode is similar to a layer 4 load balancer BUT it does create two connections. Proper Layer 4 load balancers just route the packets (no new connections).

You can use either mode for HTTP2 passthrough and it will work very well. BUT HAProxy will obviously loose the source IP transparency because it is a proxy not a router.

HAProxy also has support for HTTP2 on the front end now, but here at Loadbalancer.org we tend to recommend sticking with L4 pass-through most of the time because it is fast and reliable.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .