>> import tornado.httpserver
> import tornado.ioloop
> import tornado.web
> from tornado import gen
> from tornado.web import asynchronous
> from tornado.httpclient import AsyncHTTPClient
> class MainHandler(tornado.web.RequestHandler):
> @asynchronous
> @gen.engine
> def get(self):
> http_client = AsyncHTTPClient()
> self.write("finish")
> response = yield gen.Task(http_client.fetch,
>> "http://examplay.com",request_timeout=4)
> if response.error:
> self.write('except')
> else :
> self.write(response.body)
> self.flush()
> self.finish()
> settings = {
> #"debug": True,
> }
> application = tornado.web.Application([
> (r"/", MainHandler),
> ], **settings)
> if __name__ == "__main__":
> http_server = tornado.httpserver.HTTPServer(application)
> http_server.listen(8083)
> tornado.ioloop.IOLoop.instance().start()
slower and slower.
time tornado was block all request.