I start a tornado http server like this:
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()
I want to ingore request with header Connection: keep-alive then set no_keep_alive to True.
when I run
ab -n 1000 -c 10 -k http://127.0.0.1:28000/
output
Benchmarking 127.0.0.1 (be patient)
apr_socket_recv: Connection reset by peer (104)
Total of 11 requests completed
when I remove -k, everything is working well.
If short – because apache benchmark opens connection once on tests. In your case, you have 10 connections – and all of them killed after first 10 requests.
Here is code of finish request for HTTPConnection from tornado.
Your error:
As we can guess, you must force apache benchmark to open new connection, if old connection closed. I am not sure if you will able to get representative results in this case.