[GH-ISSUE #14673] feat: improve http client performance by reusing connections #32860

Closed
opened 2026-04-25 06:43:30 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @cambriancoder on GitHub (Jun 4, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/14673

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

The backend currently initiates a new session for each HTTP request, leading to inefficiencies and increased latency due to repeated connection creation. To enhance performance, I propose implementing a global session for the requests and aiohttp HTTP clients, enabling a shared, reusable connection across the application.

See:
requests: https://requests.readthedocs.io/en/latest/user/advanced/#session-objects
aiohttp: https://docs.aiohttp.org/en/stable/http_request_lifecycle.html#how-to-use-the-clientsession

Additionally, some users may need to send client certificates as part of their HTTP requests. To support this, I propose introducing a configuration option that allows specifying a client certificate and private key for the HTTP clients.

Desired Solution you'd like

As above. I will raise a PR with the changes.

Alternatives Considered

No response

Additional Context

No response

Originally created by @cambriancoder on GitHub (Jun 4, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/14673 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description The backend currently initiates a new session for each HTTP request, leading to inefficiencies and increased latency due to repeated connection creation. To enhance performance, I propose implementing a global session for the `requests` and `aiohttp` HTTP clients, enabling a shared, reusable connection across the application. See: `requests`: https://requests.readthedocs.io/en/latest/user/advanced/#session-objects `aiohttp`: https://docs.aiohttp.org/en/stable/http_request_lifecycle.html#how-to-use-the-clientsession Additionally, some users may need to send client certificates as part of their HTTP requests. To support this, I propose introducing a configuration option that allows specifying a client certificate and private key for the HTTP clients. ### Desired Solution you'd like As above. I will raise a PR with the changes. ### Alternatives Considered _No response_ ### Additional Context _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#32860