ioflo / hio

Apache License 2.0
9 stars 10 forks source link

Concurrency limits of hio http server setup. #30

Closed lenkan closed 11 months ago

lenkan commented 11 months ago

Please see reference repo here: https://github.com/lenkan/hio-transfer-encoding-test.

When running the node.js test benchmarks in the repository, the server really struggles to complete even 100 concurrent requests. Is this expected behaviour or is the server misconfigured somehow? Most of the time the server does not process all requests, it stops after ~50-60 requests.

Background

Similar to #29, we are experiencing weird behaviour when running KERIA, so trying to create minimal reproducible examples.

lenkan commented 11 months ago

Update: I have opened an issue in keria https://github.com/WebOfTrust/keria/issues/155. That might be more tangible. Please let me know if I should just close this one.

SmithSamuelM commented 11 months ago

Concurrency limit changed. Fixed with hio 0.6.10 see https://github.com/ioflo/hio/pull/32

Explanation, the legacy default python tcp socket connection listen backlog is 5. Later versions of the python socket library now allow a higher limit that is constrained by the number of tcp socket connections allowed by SOMAXCONN which now defaults to 128 on most systems (macOS and Linux).

Changed the hio tcp server to default to 128 for the listen backlog. This is now a parameter that gets passed in so when can later come back and configure it to be higher if the system SOMAXCONN is set higher. This now allows up to 128 concurrent connection requests. The performance limitation now on the hio http server is well the code path in python for processing the http request which includes all the overhead. This is single threaded single core performance of pure python http server and Falcon ReST framework.