vin
vin

Reputation: 1019

Python App Servers (Bjoern vs Gunicorn)

I am benchmarking python WSGI app servers.

I am running bjoern as follows:

bjoern.run(wsgi_app, host, port)

And Gunicorn as such:

gunicorn -w 2 --bind 0.0.0.0:5000 gun_server:wsgi_app --log-level=DEBUG --timeout 90

However, I am observing that Bjoern is handling half as many requests as Gunicorn. The node I am benchmarking on has 2 vCPUs.

According to many articles published so far (for e.g) https://dzone.com/articles/a-performance-analysis-of-python-wsgi-servers-part Bjoern is supposed to be way better at handling many requests per second as compared to Gunicorn.

Followed this to enable Bjoren to run on multiple cores https://github.com/jonashaag/bjoern/blob/master/tests/fork.py

However Bjoern still handles just a bit more than half the request handled by Gunicorn

Bjoren seems to be using multiple cores:

vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   0 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   1 python
27922   1 python
vin@TEST:~/api/src$ ps -U $USER -o pid,psr,comm | grep python
27880   1 python
27921   0 python
27922   0 python

Any ideas how to debug this?

[UPDATE] I am on 3.2.0-115-virtual which does not support SO_REUSEPORT. Would this affect the request/sec substantially ?

Upvotes: 1

Views: 3902

Answers (1)

Maurice Meyer
Maurice Meyer

Reputation: 18106

Bjoern is using one core, gunicorn is using two cores. Therefore it makes sense, that gunicorn is handling (~2 times) more requests.

Upvotes: 2

Related Questions