L7 load balancing supports TCP-based keepalive and connection reusing, both of which reduce the overhead of frequently establishing connections.
TCP keepalive keeps a TCP connection open for a period, allowing multiple requests to reuse the same connection. You can currently configure the keepalive timeout between L7 load balancing and clients. The keepalive timeout between L7 load balancing and backend servers uses the default configuration.
The mechanism is shown in the following figure:
A client accesses the VIP and establishes a TCP connection with L7 load balancing.
The client sends multiple L7 requests over this connection without re-establishing a connection for each request.
L7 load balancing receives the requests and forwards them to backend servers according to the load balancing algorithm.
After a backend server returns a response, the connection between the client and L7 load balancing remains open.
When the connection times out, is actively closed, or encounters an exception, it is released, and subsequent requests must re-establish the connection.

TCP connection reusing means that L7 load balancing reuses established TCP connections when forwarding requests instead of re-establishing a connection for each request. You can currently configure the maximum number of reused connections between L7 load balancing and clients. The maximum number of reused connections between L7 load balancing and backend servers uses the default configuration.
The mechanism is shown in the following figure:
A client establishes a connection with L7 load balancing and can reuse the connection for up to N requests during the keepalive period.
L7 load balancing selects a backend server based on the request and preferentially reuses an existing backend connection in the upstream connection pool.
After the backend server returns a response, the frontend connection remains open, and the backend connection returns to the connection pool for reuse by subsequent requests.
After the frontend or backend connection reaches the reuse limit of N requests, the connection is no longer reused, and subsequent requests must establish new connections.
