使用tornado基于同一个port开启多进程

基于同一个port开启多个进程的使用方法

    http_server = HTTPServer(WSGIContainer(app))
    http_server.bind(options.port)
    http_server.start(0)
    logging.info("[Portal] Portal is running on: localhost:%d", options.port)
    IOLoop.instance().start()

查看linux cup 核数:

[root@blpftcanezd ~]# cat /proc/cpuinfo | head -n 20
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 85
model name      : Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz
stepping        : 4
microcode       : 0x1

cpu MHz         : 2693.670
cache size      : 16384 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes

查看进程数:

[root@blpftcanezd ~]# lsof -i:8000|grep v4
python  30630 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30638 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30639 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30640 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30641 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30642 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30643 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30644 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
python  30645 root    6u  IPv4 150151354      0t0  TCP *:irdmi (LISTEN)
[root@blpftcanezd ~]# ps -eLf |grep server.py
root      4939  4435  4939  0    1 23:43 pts/23   00:00:00 grep --color=auto server.py
root     30630 23112 30630  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30630 23112 30637  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30638 30630 30638  0    1 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30639 30630 30639  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30639 30630 31878  0    2 23:21 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30640 30630 30640  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30640 30630 31726  0    2 23:20 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30641 30630 30641  0    1 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30642 30630 30642  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30642 30630 31902  0    2 23:21 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30643 30630 30643  0    1 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30644 30630 30644  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30644 30630 31732  0    2 23:20 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30645 30630 30645  0    2 23:15 ?        00:00:00 /bin/python server.py --logging=DEBUG
root     30645 30630 31764  0    2 23:20 ?        00:00:00 /bin/python server.py --logging=DEBUG

你可能感兴趣的:(使用tornado基于同一个port开启多进程)