Я читал, что Cherpy использует собственный пул потоков. Но я не вижу в этом преимущества.
Допустим, я запускаю запрос, который займет много времени, а затем на другой вкладке я запускаю запрос, который займет короткое время. Если он действительно использует многопоточность, короткий запрос должен завершиться раньше длинного. Но я вижу, что сначала выполняется длинный запрос, а затем короткий, как будто все обрабатывается последовательно.
Я пытался интегрироваться с различными фреймворками uWSGI, такими как Tornado и Twistd, но все равно не вижу разницы. http://cherrypy.readthedocs.org/en/latest/deploy.html#tornado
Это мой стартовый код. Может кто-нибудь помочь мне здесь?
cfg = {
'global' : {
'server.socket_host' : Utils.gflags.FLAGS.bind_addr,
'server.socket_port' : Utils.gflags.FLAGS.bind_port,
'server.thread_pool' : 10,
'engine.timeout_monitor.frequency' : gflags.FLAGS.request_time_out_secs,
},
'/static' : {"tools.sessions.on": False, 'tools.auth.on': False},
'/favicon.ico' : {"tools.sessions.on": False, 'tools.auth.on': False},
}
# To turn off the cherrypy errors on screen.
cfg['global'].update({'log.screen': False})
cfg['/static'].update({'tools.staticdir.on': True})
cfg['/static'].update({'tools.staticdir.dir': Utils.gflags.FLAGS.static_dir})
cfg['/favicon.ico'].update({'tools.staticfile.on': True})
cfg['/favicon.ico'].update({'tools.staticfile.filename':
Utils.gflags.FLAGS.favicon_file})
# Disable the auto reload on code change.
cherrypy.engine.autoreload.unsubscribe()
# Start the cherrypy
#Root() is defined somewhere else. Don't worry about that
cherrypy.quickstart(Root(), config = cfg)