I am seeing an issue during performance testing of our application. The issue is LoadBalancer is unable to map tcp connection between client and LB with tcp connection between LB and backed instance.
我在应用程序的性能测试期间发现了一个问题。问题是LoadBalancer无法使用LB和支持的实例之间的tcp连接映射客户端和LB之间的tcp连接。
When a client sends a http request first time, LB opens a new TCP connection with backed instance but when same client sends another http request then also LB creates a new TCP connection with backend instance. When we execute the same scenario directly sending requests from client to backend instance, same tcp connection is reused.
当客户端第一次发送http请求时,LB会打开与支持的实例的新TCP连接,但是当同一客户端发送另一个http请求时,LB也会创建与后端实例的新TCP连接。当我们执行直接从客户端向后端实例发送请求的相同场景时,将重用相同的tcp连接。
We have a limit on open TCP connections per process at backed instance so we want to know following.
我们对支持的实例上每个进程的开放TCP连接有限制,因此我们想知道以下内容。
Why LB uses an ip range when sending requests to backed servers and where it is configured ?
为什么LB在向备用服务器发送请求及其配置位置时使用ip范围?
How LB maps clients TCP connections with backend TCP connections ? If there is no mapping then what is the limit of open tcp connections imposed by LB.
LB如何使用后端TCP连接映射客户端TCP连接?如果没有映射,那么LB施加的开放tcp连接的限制是什么。
What is the response code returned by LB in case of connection reset by backed instance ?
在由支持的实例重置连接的情况下,LB返回的响应代码是什么?
What is the response code returned by LB in case of backed server’s SYN backlog queue is full.
在备用服务器的SYN积压队列已满的情况下,LB返回的响应代码是什么。
1 个解决方案
#1
1
Client requests are processed by a collection of load balancers, which is why you will see changes to the direct connected host when processing a stream of requests from a client.
客户端请求由一组负载均衡器处理,这就是在处理来自客户端的请求流时您将看到直接连接主机的更改的原因。
Traffic from a client IP will be processed by a subset of the global load balancer pool, but from the sound of your question even this subset ends up being effectively too large to result in high backend TCP connection reuse. There are some hidden parameters of the load balancer that affect the number of connections created to the backends and circumstances where the load balancer can use existing connections to handle new requests. These internal parameters may change in the future in order to reduce the number of TCP connections required between the load balancer and backends. Until then, allowing more connections at the backend and more generous timeouts on those connections should increase backend connection reuse.
来自客户端IP的流量将由全局负载平衡器池的子集处理,但是根据您的问题的声音,即使该子集最终实际上太大而不能导致高后端TCP连接重用。负载均衡器有一些隐藏参数会影响为后端创建的连接数以及负载均衡器可以使用现有连接来处理新请求的情况。这些内部参数将来可能会发生变化,以减少负载均衡器和后端之间所需的TCP连接数。在此之前,允许后端的更多连接以及这些连接上更大的超时应该会增加后端连接的重用。
Turning on session affinity by client ip or generated cookie will result in the LB using a specific backend when handling traffic from a client, but you will still see traffic arriving from multiple LB IPs. In the absence of session affinity there is effectively no mapping between client ips and backend VMs used. For instructions on how to enable session affinity see: https://cloud.google.com/compute/docs/load-balancing/http/#session_affinity
通过客户端IP或生成的cookie启用会话关联性将导致LB在处理来自客户端的流量时使用特定后端,但您仍将看到来自多个LB IP的流量。在没有会话亲和性的情况下,客户端ips和使用的后端VM之间实际上没有映射。有关如何启用会话关联的说明,请参阅:https://cloud.google.com/compute/docs/load-balancing/http/#session_affinity
The LB will reply with a 502 response code if it is not able to get a response from a backend.
如果无法从后端获得响应,LB将回复502响应代码。
The load balancer will consider the backend as unhealthy and direct traffic to other available healthy backends. If there are no healthy backends, the load balancer will reply with 502 after a timeout.
负载均衡器会将后端视为对其他可用健康后端的不健康和直接流量。如果没有健康的后端,负载均衡器将在超时后回复502。