aio-libs / aio-libs/aiohttp

Add keepalive_requests and keepalive_time parameters for connection

Aperta
#10,722 18 commenti 0 reazioni 0 assegnatari Vedi su GitHub
client enhancement
Lingua principale
Python
Stelle
16.5k
Fork
2.4k
Merge medio
17h 22m
PR unite (30g)
212

Descrizione

### Is your feature request related to a problem?

In the k8s environment, when the pod (behind ClusterIP Service) is scaled up, the new pod has almost no requests.

### Describe the solution you'd like

When the k8s pod is scaled up, the connection number between the new and old pods remains relatively balanced

### Describe alternatives you've considered

For example, nginx sets an upper limit on the number of requests and a time limit for each connection. If the limit is exceeded, the connection is disconnected, so that new pods of the service will also have the opportunity to receive new requests.
[keepalive_requests](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_requests)
[keepalive_time](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_time)

### Related component

Client

### Additional context

When I was stress testing the backend service, after the k8s pod was scaled up, the CPU usage of the new and old pods differed greatly because the new pods had much fewer connections than the old pods.

![Image](https://github.com/user-attachments/assets/0960721a-fe8d-47bb-88a7-a26cddc173d6)

### Code of Conduct

- [x] I agree to follow the aio-libs Code of Conduct

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.