我像这样启动一个龙卷风 http 服务器:
app = tornado.web.Application([
(r'.*', MyRequestHandler),
])
http_server = tornado.httpserver.HTTPServer(app, no_keep_alive=True)
http_server.listen(port)
ioloop = tornado.ioloop.IOLoop.instance()
ioloop.start()
我想用标头输入请求,Connection: keep-alive
然后设置no_keep_alive
为True
.
当我跑步时
ab -n 1000 -c 10 -k http://127.0.0.1:28000/
输出
Benchmarking 127.0.0.1 (be patient)
apr_socket_recv: Connection reset by peer (104)
Total of 11 requests completed
当我删除时-k
,一切正常。