aio-libs / aio-libs/aiohttp

Add keepalive_requests and keepalive_time parameters for connection

Offen
#10,722 18 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
client enhancement
Vorherrschende Sprache
Python
Sterne
16.5k
Forks
2.4k
Ø Merge
17 Std. 22 Min.
Gemergte PRs (30 T.)
212

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.