【发布时间】:2017-01-07 12:03:42
【问题描述】:
我正在对 python WSGI 应用服务器进行基准测试。
我运行 bjoern 如下:
bjoern.run(wsgi_app, host, port)
还有 Gunicorn:
gunicorn -w 2 --bind 0.0.0.0:5000 gun_server:wsgi_app --log-level=DEBUG --timeout 90
但是,我发现 Bjoern 处理的请求数量是 Gunicorn 的一半。我进行基准测试的节点有 2 个 vCPU。
根据迄今为止发表的许多文章(例如) https://dzone.com/articles/a-performance-analysis-of-python-wsgi-servers-part 与 Gunicorn 相比,Bjoern 在每秒处理许多请求方面应该要好得多。
按照此操作使 Bjoren 能够在多个内核上运行 https://github.com/jonashaag/bjoern/blob/master/tests/fork.py
但 Bjoern 仍处理比 Gunicorn 处理的请求的一半多一点
Bjoren 似乎在使用多个内核:
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
任何想法如何调试这个?
[更新] 我在不支持 SO_REUSEPORT 的 3.2.0-115-virtual 上。这会显着影响请求/秒吗?
【问题讨论】:
标签: python performance webserver gunicorn bjoern