0

For each request that a client makes through a load balancer, the load balancer maintains two TCP connections. One connection is with the client and the other connection is to a back-end instance. GCE LoadBalancer is creating lots of TCP connections with my backend instance, how can i control this ?

GCP docs says

"Traffic from the load balancer to your instances has an IP address in the range of 130.211.0.0/22. When viewing logs on your load balanced instances, you will not see the source address of the original client. Instead, you will see source addresses from this range."

That means ideally LB can open max 2 pow 10 * 2 pow 16 = 67108864 TCP connections with backend instance. Here 2 pow 10 for IP range 2 pow 16 for port range per IP.

How can I control GCE LB to create max N TCP connections with my backend instance?

1

As linked by Ilya Zakreuski, this question has been asked on Stack Overflow and answer by Ilya as below:

Currently HTTP Load Balancer does not expose connection limit controls. Backend Service connection limit is capped at 64K per backend. In reality you can expect to see up to around 2-3k active connections per backend, depending on the load pattern.

While I wouldn't be concerned about 2-3k connections that much, if you absolutely need to avoid having that many simultaneous connections, consider implementing dynamic health check and return unhealthy status when number of connections goes over defined threshold. Unhealthy status would prevent backend instance to get new connections, but you'll need to figure out how to deal with the overflow load, maybe by Autoscaling your Backend Service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.