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

Callouts: fix Python server threading issues #207

Open
martijneken opened this issue Mar 18, 2025 · 0 comments
Open

Callouts: fix Python server threading issues #207

martijneken opened this issue Mar 18, 2025 · 0 comments

Comments

@martijneken
Copy link
Collaborator

Load testing the standard Python SDK examples for callouts gives CPU saturation under load of 20-30%. There are a few reasons for this:

  1. The number of gRPC server worker threads defaults to 2.
  2. Python GIL limiting thread scalability. Even adjusting (1) to a larger number like 8 does not linearly improve the situation.

This limited concurrency leads to gRPC timeouts and other issues under load, despite there being plenty of CPU available. If you instead run the gRPC server under Python multiprocessing library (https://docs.python.org/3/library/multiprocessing.html), as per https://github.com/grpc/grpc/blob/master/examples/python/multiprocessing/server.py, full CPU utilization on a many core processor is possible and the pathologies disappear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant