How to optimize uWSGI for Heroku routers' proxy/buffering situation?

孤者浪人 提交于 2019-12-24 02:57:16

问题


I've been using uWSGI in production on heroku for over a year, and it seems to handle everything a lot better than Gunicorn. As our traffic scales up, I am trying to better understand the interface between heroku's router and uWSGI in order to optimize and prevent problems, but its all still pretty opaque to me and I have a few questions.

Right now, I'm using a fairly vanilla uwsgi configuration:

#heroku setup: see https://github.com/unbit/uwsgi-docs/blob/master/tutorials/heroku_python.rst
http-socket = :$(PORT)
master = true
die-on-term = true
harakiri = 20
harakiri-verbose
reload-mercy = 8
max-requests = 2000
# processes = 5 # set from env var WEB_CONCURRENCY ( see Procfile)
# the below is required by new relic. be sure to monitor your system
# memory since we're enabling threads
# https://newrelic.com/docs/python/python-agent-and-uwsgi
# http://uwsgi-docs.readthedocs.org/en/latest/Options.html
enable-threads = true
single-interpreter = true

# the module
module = publisher.wsgi

Reading Heroku's documentation, it sounds like the heroku proxy does several somewhat unique things, and I'm wondering if I need to do anything special to uWSGI to optimize for this environment. For example

1) Heroku will send 50 requests to the dyno (i.e. to uwsgi) simultaneously before it starts queuing them

2) Heroku has its own flavor of request buffering that may or may not affect uwsgi.

I specifically wonder whether I should turn on post-buffering, adjust the buffer-size, or tweak any other of the many uWSGI settings for better performance or to prevent problems when running behind the Heroku router.

来源:https://stackoverflow.com/questions/27571641/how-to-optimize-uwsgi-for-heroku-routers-proxy-buffering-situation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!