0
我开始龙卷风HTTP服务器是这样的:当我添加`-k`时,为什么ApacheBench测试龙卷风会中止?
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
,一切运作良好。
我用'self.set_header('Connection','close')'explicit.thx!来解决这个问题! – iMom0 2012-07-28 04:17:19