1

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 ?

vin
  • 960
  • 2
  • 14
  • 28

1 Answers1

2

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

Maurice Meyer
  • 17,279
  • 4
  • 30
  • 47
  • Yes, thanks, noticed that. I have updated the code using os.fork(). Benchmark is running at the moment. – vin Jan 07 '17 at 13:44
  • Followed this: https://github.com/jonashaag/bjoern/blob/master/tests/fork.py However, Bjoern is still handling half as much requests as Gunicorn. How should I debug this ? There are two processes python(27880) ─┬─python(27921) └─python(27922) – vin Jan 07 '17 at 14:41
  • another thing I noticed was I am on Linux 3.2 where SO_REUSEPORT is not supported. Would this affect the requests/sec substantially ? – vin Jan 08 '17 at 03:41