Post code (python 3.7 | tornado==6.0.3) :
The import tornado. Httpserver
The import tornado. Ioloop
The import tornado. Options
The import tornado. Web
The import tornado. Gen
The from datetime import datetime
The from concurrent. Futures import ThreadPoolExecutor
The class IndexHandler (tornado. Web. RequestHandler) :
Def get (self) :
Print (' index, STR (datetime. Now ()))
Self. Write (' Index! % s' % STR (datetime. Now ()))
The class TestHandler (tornado. Web. RequestHandler) :
Async def get (self) :
Await tornado. Gen. Sleep (3)
Print (STR (datetime. Now ()))
The self. The write (STR (datetime. Now ()))
Def server_main () :
Print (' Tornado, Tornado. Version, 'server start! ')
Application=tornado. Web application (
(r/index, IndexHandler),
(r/test ", "TestHandler),
],
The debug=True,
)
Application. The executor=ThreadPoolExecutor (10)
Http_server=tornado. Httpserver. Httpserver (application, max_header_size=104857600)
Http_server. Listen (9999)
Http_server. Start (1)
Tornado. Ioloop. Ioloop. Current (). The start ()
If __name__=="__main__ ':
Server_main ()
(note: under Linux, more CPU processes (http_server. Start (2)), is still blocked)
Congestion: