Tornado Web服务器多进程启动的2个方法
作者:junjie 时间:2022-01-21 04:41:05
一、Tornado简介
Tornado 是 FriendFeed 的 Web 服务器及其常用工具的开源版本。Tornado 和现在的主流 Web 服务器框架(包括大多数 Python 的框架)有着明显的区别:它是非阻塞式服务器,而且速度相当快。得利于其 非阻塞的方式和对epoll的运用,Tornado 每秒可以处理数以千计的连接,因此 Tornado 是实时 Web 服务的一个理想框架。
二、多进程启动方法
正常启动方法:
server = HTTPServer(app)
server.listen(8888)
IOLoop.instance().start()
多进程、方案1:
server = HTTPServer(app)
server.bind(8888)
server.start(0) # Forks multiple sub-processes
IOLoop.instance().start()
多进程、方案2:
sockets = tornado.netutil.bind_sockets(8888)
tornado.process.fork_processes(0)
server = HTTPServer(app)
server.add_sockets(sockets)
IOLoop.instance().start()
标签:Tornado,多进程启动
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
pandas抽取行列数据的几种方法
2022-06-19 09:32:16
python使用beautifulsoup从爱奇艺网抓取视频播放
2021-07-29 01:10:42
![](https://img.aspxhome.com/file/2023/4/103644_0s.jpg)
Windows下Python使用Pandas模块操作Excel文件的教程
2021-01-05 23:07:40
![](https://img.aspxhome.com/file/2023/1/69021_0s.jpg)
基于tensorflow权重文件的解读
2023-11-04 02:05:35
![](https://img.aspxhome.com/file/2023/8/85308_0s.jpg)
在Python中使用PIL模块处理图像的教程
2023-09-03 17:34:39
![](https://img.aspxhome.com/file/2023/0/110270_0s.jpg)
Django中Forms的使用代码解析
2022-03-20 08:06:56
![](https://img.aspxhome.com/file/2023/9/84079_0s.png)
分享3个非常实用的 Python 模块
2023-08-07 18:21:33
Select下拉列表控件美化
2008-11-12 12:55:00
python快速排序的实现及运行时间比较
2022-11-30 20:41:27
![](https://img.aspxhome.com/file/2023/3/90523_0s.png)
如何使用Python自动控制windows桌面
2022-05-07 08:51:14
![](https://img.aspxhome.com/file/2023/8/97498_0s.jpg)
vscode 远程调试python的方法
2021-09-07 23:00:59
![](https://img.aspxhome.com/file/2023/7/83717_0s.png)
python 控制Asterisk AMI接口外呼电话的例子
2021-07-01 16:59:39
Python应用实现处理excel数据过程解析
2022-10-24 11:52:17
如何使用postman(新手入门)
2023-06-12 14:00:31
![](https://img.aspxhome.com/file/2023/6/58166_0s.jpg)
基于Three.js插件制作360度全景图
2023-08-06 14:43:10
golang中包无法引入问题解决
2023-09-03 12:34:58
python调用Delphi写的Dll代码示例
2023-07-25 09:33:53
python制作一个桌面便签软件
2021-02-23 05:20:40
Python 查找list中的某个元素的所有的下标方法
2022-10-15 21:48:16
在python中利用pycharm自定义代码块教程(三步搞定)
2022-11-20 01:00:50
![](https://img.aspxhome.com/file/2023/7/88937_0s.jpg)