1.看官网文档
http://uwsgi-docs.readthedocs.org/en/latest/Management.html#reloading-the-server ,使用-HUP可以优雅重启,不过我在测试的时候,却是直接杀死了,并没有等待请求处理结束(难道是因为我使用time.sleep(5)来模拟长作业的缘故?),日志如下,虽然显示200,不过浏览器那边却“连接已中断”
...gracefully killing workers...
Gracefully killing worker 2 (pid: 9610)...
Gracefully killing worker 1 (pid: 9609)...
Gracefully killing worker 3 (pid: 9611)...
Gracefully killing worker 4 (pid: 9639)...
worker 1 buried after 1 seconds
worker 2 buried after 1 seconds
worker 3 buried after 1 seconds
[pid: 9639|app: 0|req: 11/14] 111.206.83.99 () {42 vars in 1782 bytes} [Tue Jul 8 17:59:16 2014] GET /config/long => generated 2 bytes in 5005 msecs (HTTP/1.1 200) 1 headers in 51 bytes (1 switches on core 14)
worker 4 buried after 4 seconds
2.如何安全停止服务器?文档中似乎只有-INT是停止,不过似乎是直接干掉了uwsgi,并不等所有请求处理完成
3.Python Webservice在数据一致性,服务可靠性要求高的情况下,如何选择服务器?要求可以优雅停止、重启。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
https://www.v2ex.com/t/121594
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.