uWSGI 怎么部署 Flask?默认参数有哪些坑?线程、预加载、超时各是什么行为?这篇用真实的 uwsgi 把每个参数的效果验证出来,包括一个和文档不一致的结果。
--module app --callable app → 200 {"pid":63208,"token":6563}
--module app(不写 --callable) → 500 Internal Server Error上一篇:Gunicorn 启动 Flask;下一篇:Nginx 反向代理。
默认 1 秒后 FLAG = {"thread_ran":true}
--enable-threads 1 秒后 FLAG = {"thread_ran":true}默认(master 加载后 fork) 看到 3 个 worker,TOKEN 有 1 个不同的值 --lazy-apps 看到 3 个 worker,TOKEN 有 3 个不同的值
慢请求 → RemoteDisconnected,用时 1515 ms;之后新请求 → 200(worker 被重新拉起)
uwsgi --http 4 进程 1753 请求/秒(失败 0) gunicorn sync 4 worker 3668 请求/秒(失败 0)
uwsgi 是装在自己虚拟环境里的版本;压测工具是 ApacheBench,与服务同机运行,每个数字只测一次。