Skip to content

Callouts: fix Python server threading issues #207

@martijneken

Description

@martijneken

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions