From f55f9d0745a65167b4218a9d3fc9222122b11c80 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Sat, 22 Feb 2014 23:25:51 -0500 Subject: [PATCH] Add a warning label to WSGIContainer. --- tornado/wsgi.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tornado/wsgi.py b/tornado/wsgi.py index 615f2e1f..f21f240c 100644 --- a/tornado/wsgi.py +++ b/tornado/wsgi.py @@ -215,6 +215,16 @@ class HTTPRequest(object): class WSGIContainer(object): r"""Makes a WSGI-compatible function runnable on Tornado's HTTP server. + .. warning:: + + WSGI is a *synchronous* interface, while Tornado's concurrency model + is based on single-threaded asynchronous execution. This means that + running a WSGI app with Tornado's `WSGIContainer` is *less scalable* + than running the same app in a multi-threaded WSGI server like + ``gunicorn`` or ``uwsgi``. Use `WSGIContainer` only when there are + benefits to combining Tornado and WSGI in the same process that + outweigh the reduced scalability. + Wrap a WSGI function in a `WSGIContainer` and pass it to `.HTTPServer` to run it. For example::