如何运行多个Tornado进程/线程/前端?
在龙卷风文档中,他们展示了如何从 4 个前端 获得非常大的吞吐量。我想以相同的方式运行应用程序,并希望前端作为守护进程运行,并使用 init.d 脚本* 进行管理。
我对 Python 相当陌生,所以不知道从哪里开始。目前,我正在终端中手动启动 Tornado 服务器,每次都会传递一个新的端口号。
我尝试将 python-daemon 包 与 lockfile package 但创建的锁文件中没有进程 ID,我不知道如何处理稍后优雅地终止进程。
我真的不知道接下来该去哪里,而且 Tornado 文档在部署方面留下了很大一部分内容。
* 如果有更好的方法来管理流程,以便可以将它们作为一个组进行监视和管理,请告诉我。
In the tornado documentation they show how they can have a very large through-put from 4 frontends. I'd like to run an app in the same way, and would like to have the frontends running as daemon processes managed with an init.d script*.
I'm fairly new to Python so don't really know where to start. Currently I'm starting the Tornado server manually in the terminal, passing in a new port number each time.
I've tried using the python-daemon package in conjunction with the lockfile package but the lockfiles that are created don't have the process ids in them and I can't see how to then kill the processes gracefully later on.
I don't really know where to go from here, and the Tornado docs leave a large chunk out regarding deployment.
* If there's a better way to manage the processes so that they can be monitored and managed as a group then please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试Supervisor。它非常适合管理多个守护进程。您可以在supervisord.conf 文件中配置应用程序,并且supervisord 本身是从init.d 脚本启动的。
Try Supervisor. It's great for managing multiple daemon processes. You configure your applications in the supervisord.conf file and supervisord itself is launched from an init.d script.
我也可以为主管担保。我们一直在生产中使用龙卷风,有 4 个使用主管的实例,并且运行非常流畅
I can vouch for Supervisor too. We have been using tornado in production with 4 instances using supervisor and it is working uber smooth