Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: connects are created for every request #4115

Open
judahrand opened this issue Aug 11, 2023 · 1 comment
Open

bug: connects are created for every request #4115

judahrand opened this issue Aug 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@judahrand
Copy link
Contributor

Describe the bug

In both the GRPC and HTTP clients channels/sessions are created for every single request. Both GRPC and AIOHTTP recommend reusing channels/sessions for the lifecycle of the application.

In both cases the channel/session encapsulates a connection pool. If a new channel/session is created for every request this connection pool must also be recreated. This leads to performance which is poorer than it could be.

Additionally, to really fix this problem each client needs to have its own implementation of _sync_call which is distinct from _call. Using asyncio.run in the background causes problems. It might be simpler and clearer to separate the clients into AsyncHTTPClient, HTTPClient, AsyncGrpcClient, and GrpcClient. Each of which could handle its simpler case.

To reproduce

No response

Expected behavior

Reuse of channels/sessions

Environment

N/A

@judahrand judahrand added the bug Something isn't working label Aug 11, 2023
@sauyon
Copy link
Contributor

sauyon commented Oct 31, 2023

HTTP resolved in #4116; we should probably consider gRPC at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants