Introduction of Tornado
Tornado is an open source version of the FriendFeed Web server and its common tools. Tornado is clearly different from the current mainstream WEB server framework (including most Python frameworks): It is a non-blocking server and is very fast. In its non-blocking manner and its use of epoll, Tornado can handle thousands of connections per second, so Tornado is an ideal framework for real-time WEB services.
Two, multi-process startup method
Normal Startup method:
Copy Code code as follows:
Server = Httpserver (APP)
Server.listen (8888)
Ioloop.instance (). Start ()
Multi-process, Scenario 1:
Copy Code code as follows:
Server = Httpserver (APP)
Server.bind (8888)
Server.start (0) # forks multiple sub-processes
Ioloop.instance (). Start ()
Multi-process, Scenario 2:
Copy Code code as follows:
sockets = Tornado.netutil.bind_sockets (8888)
Tornado.process.fork_processes (0)
Server = Httpserver (APP)
Server.add_sockets (Sockets)
Ioloop.instance (). Start ()