Your best bet would be to use a proxy front end server like nginx, haproxy or apache. Configuring tornado with ssl is extremely slow, it slows tornado down to a crawl until it becomes totally unresponsive with just minimal visits. I have looked everywhere to get a decent speed in ssl traffic using tornado directly, but did not find any. Besides it is not bad to use a front end server.
But by using apache f.ex. as a front end proxy, I got close to native non-ssl speeds.
But to configure tornado with ssl, is simple :
def main():
handlers = [
(r"/", HomeHandler),
]
settings = dict(
blog_title=u"Tornado Blog",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
debug=True,
certfile = os.path.join("certs/server.crt"),
keyfile = os.path.join("certs/server.key"),
ssl_options = {
"certfile" : os.path.join("certs/server.crt"),
"keyfile" : os.path.join("certs/server.key"),
},
)
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
main()