Skip to content

Commit 4c643dc

Browse files
committed
Misc updates
1 parent c1b832a commit 4c643dc

File tree

2 files changed

+24
-69
lines changed

2 files changed

+24
-69
lines changed

website/sphinx/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Tornado API Reference
22
=====================
33

44
.. toctree::
5-
:maxdepth: 2
5+
:titlesonly:
66

77
overview
88
webframework

website/sphinx/overview.rst

Lines changed: 23 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,15 @@ version of this web server and some of the tools we use most often at
1414
FriendFeed. The framework is distinct from most mainstream web server
1515
frameworks (and certainly most Python frameworks) because it is
1616
non-blocking and reasonably fast. Because it is non-blocking and uses
17-
`epoll <http://www.kernel.org/doc/man-pages/online/pages/man4/epoll.4.html>`_,
18-
it can handle 1000s of simultaneous standing connections, which means
19-
the framework is ideal for real-time web services. We built the web
20-
server specifically to handle FriendFeed's real-time features — every
21-
active user of FriendFeed maintains an open connection to the FriendFeed
22-
servers. (For more information on scaling servers to support thousands
23-
of clients, see `The C10K problem <http://www.kegel.com/c10k.html>`_.)
17+
`epoll
18+
<http://www.kernel.org/doc/man-pages/online/pages/man4/epoll.4.html>`_
19+
or kqueue, it can handle thousands of simultaneous standing
20+
connections, which means the framework is ideal for real-time web
21+
services. We built the web server specifically to handle FriendFeed's
22+
real-time features — every active user of FriendFeed maintains an open
23+
connection to the FriendFeed servers. (For more information on scaling
24+
servers to support thousands of clients, see `The C10K problem
25+
<http://www.kegel.com/c10k.html>`_.)
2426

2527
Here is the canonical "Hello, world" example app:
2628

@@ -41,9 +43,6 @@ Here is the canonical "Hello, world" example app:
4143
application.listen(8888)
4244
tornado.ioloop.IOLoop.instance().start()
4345

44-
See `Tornado walkthrough <#tornado-walkthrough>`_ below for a detailed
45-
walkthrough of the ``tornado.web`` package.
46-
4746
We attempted to clean up the code base to reduce interdependencies
4847
between modules, so you should (theoretically) be able to use any of the
4948
modules independently in your project without using the whole package.
@@ -52,7 +51,7 @@ Request handlers and request arguments
5251
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5352

5453
A Tornado web application maps URLs or URL patterns to subclasses of
55-
``tornado.web.RequestHandler``. Those classes define ``get()`` or
54+
`tornado.web.RequestHandler`. Those classes define ``get()`` or
5655
``post()`` methods to handle HTTP ``GET`` or ``POST`` requests to that
5756
URL.
5857

@@ -114,7 +113,7 @@ number of useful attributes, including:
114113
- ``path`` - the request path (everything before the ``?``)
115114
- ``headers`` - the request headers
116115

117-
See the class definition for ``HTTPRequest`` in ``httpserver`` for a
116+
See the class definition for `tornado.httpserver.HTTPRequest` for a
118117
complete list of attributes.
119118

120119
Overriding RequestHandler methods
@@ -436,7 +435,7 @@ and the user is not logged in, the server will send a ``403`` response.
436435

437436
Tornado comes with built-in support for third-party authentication
438437
schemes like Google OAuth. See the `tornado.auth`
439-
for more details. Check out the Tornado Blog example application for a
438+
for more details. Check out the `Tornado Blog example application <https://github.com/facebook/tornado/tree/master/demos/blog>`_ for a
440439
complete example that uses authentication (and stores user data in a
441440
MySQL database).
442441

@@ -848,10 +847,12 @@ client eventually calls ``on_response()``, the request is still open,
848847
and the response is finally flushed to the client with the call to
849848
``self.finish()``.
850849

851-
For a more advanced asynchronous example, take a look at the ``chat``
852-
example application, which implements an AJAX chat room using `long
853-
polling <http://en.wikipedia.org/wiki/Push_technology#Long_polling>`_.
854-
Users of long polling may want to override ``on_connection_close()`` to
850+
For a more advanced asynchronous example, take a look at the `chat
851+
example application
852+
<https://github.com/facebook/tornado/tree/master/demos/chat>`_, which
853+
implements an AJAX chat room using `long polling
854+
<http://en.wikipedia.org/wiki/Push_technology#Long_polling>`_. Users
855+
of long polling may want to override ``on_connection_close()`` to
855856
clean up after the client closes the connection (but see that method's
856857
docstring for caveats).
857858

@@ -882,7 +883,7 @@ Third party authentication
882883

883884
Tornado's ``auth`` module implements the authentication and
884885
authorization protocols for a number of the most popular sites on the
885-
web, including Google/Gmail, Facebook, Twitter, Yahoo, and FriendFeed.
886+
web, including Google/Gmail, Facebook, Twitter, and FriendFeed.
886887
The module includes methods to log users in via these sites and, where
887888
applicable, methods to authorize access to the service so you can, e.g.,
888889
download a user's address book or publish a Twitter message on their
@@ -907,7 +908,7 @@ the Google credentials in a cookie for later access:
907908
return
908909
# Save the user with, e.g., set_secure_cookie()
909910

910-
See the ``auth`` module documentation for more details.
911+
See the `tornado.auth` module documentation for more details.
911912

912913
Debug mode and automatic reloading
913914
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -928,53 +929,6 @@ The automatic reloading feature of debug mode is available as a
928929
standalone module in ``tornado.autoreload``, and is optionally used by
929930
the test runner in ``tornado.testing.main``.
930931

931-
Performance
932-
~~~~~~~~~~~
933-
934-
Web application performance is generally bound by architecture, not
935-
frontend performance. That said, Tornado is pretty fast relative to most
936-
popular Python web frameworks.
937-
938-
We ran a few remedial load tests on a simple "Hello, world" application
939-
in each of the most popular Python web frameworks
940-
(`Django <http://www.djangoproject.com/>`_,
941-
`web.py <http://webpy.org/>`_, and
942-
`CherryPy <http://www.cherrypy.org/>`_) to get the baseline performance
943-
of each relative to Tornado. We used Apache/mod\_wsgi for Django and
944-
web.py and ran CherryPy as a standalone server, which was our impression
945-
of how each framework is typically run in production environments. We
946-
ran 4 single-threaded Tornado frontends behind an
947-
`nginx <http://nginx.net/>`_ reverse proxy, which is how we recommend
948-
running Tornado in production (our load test machine had four cores, and
949-
we recommend 1 frontend per core).
950-
951-
We load tested each with Apache Benchmark (``ab``) on the a separate
952-
machine with the command
953-
954-
::
955-
956-
ab -n 100000 -c 25 http://10.0.1.x/
957-
958-
The results (requests per second) on a 2.4GHz AMD Opteron processor with
959-
4 cores:
960-
961-
.. raw:: html
962-
963-
<div style="text-align:center;margin-top:2em;margin-bottom:2em">
964-
965-
.. raw:: html
966-
967-
</div>
968-
969-
In our tests, Tornado consistently had 4X the throughput of the next
970-
fastest framework, and even a single standalone Tornado frontend got 33%
971-
more throughput even though it only used one of the four cores.
972-
973-
Not very scientific, but at a high level, it should give you a sense
974-
that we have cared about performance as we built Tornado, and it
975-
shouldn't add too much latency to your apps relative to most Python web
976-
development frameworks.
977-
978932
Running Tornado in production
979933
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
980934

@@ -1101,8 +1055,9 @@ AppEngine <http://code.google.com/appengine/>`_ application:
11011055
])
11021056
wsgiref.handlers.CGIHandler().run(application)
11031057

1104-
See the ``appengine`` example application for a full-featured AppEngine
1105-
app built on Tornado.
1058+
See the `appengine example application
1059+
<https://github.com/facebook/tornado/tree/master/demos/appengine>`_ for a
1060+
full-featured AppEngine app built on Tornado.
11061061

11071062
Caveats and support
11081063
~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)