Skip to content

Commit a2dcf71

Browse files
committed
Note about wsgi servers fixes sdiehl#14
1 parent 50e0fd1 commit a2dcf71

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

index.html

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ <h3 class="author">
168168
<li><a href="#gevent-zeromq">Gevent ZeroMQ</a></li>
169169
<li><a href="#simple-telnet-servers">Simple Telnet Servers</a></li>
170170
<li><a href="#wsgi-servers">WSGI Servers</a></li>
171+
<li><a href="#streaming-servers">Streaming Servers</a></li>
171172
<li><a href="#long-polling">Long Polling</a></li>
172173
<li><a href="#websockets">Websockets</a></li>
173174
<li><a href="#chat-server">Chat Server</a></li>
@@ -244,9 +245,8 @@ <h2 id="synchronous-asynchronous-execution">Synchronous &amp; Asynchronous Execu
244245
Explicit context switch to foo again
245246
Implicit context switch back to bar
246247
</pre></code></p>
247-
<p>It is illuminating to visualize the control of the program or
248-
walk through it with a debugger to see the context switches as
249-
they occur.</p>
248+
<p>It is illuminating to visualize the control flow of the program or walk
249+
through it with a debugger to see the context switches as they occur.</p>
250250
<p><img alt="Greenlet Control Flow" src="flow.gif" /></p>
251251
<p>The real power of gevent comes when we use it for network and IO
252252
bound functions which can be cooperatively scheduled. Gevent has
@@ -338,16 +338,16 @@ <h2 id="synchronous-asynchronous-execution">Synchronous &amp; Asynchronous Execu
338338
Task 8 done
339339
Task 9 done
340340
Asynchronous:
341-
Task 2 done
341+
Task 1 done
342342
Task 6 done
343+
Task 5 done
344+
Task 0 done
345+
Task 9 done
343346
Task 8 done
344-
Task 3 done
345-
Task 4 done
346347
Task 7 done
347-
Task 1 done
348-
Task 9 done
349-
Task 0 done
350-
Task 5 done
348+
Task 4 done
349+
Task 3 done
350+
Task 2 done
351351
</pre></code></p>
352352
<p>In the synchronous case all the tasks are run sequentially,
353353
which results in the main programming <em>blocking</em> (
@@ -1071,11 +1071,14 @@ <h2 id="wsgi-servers">WSGI Servers</h2>
10711071
<li>gevent.wsgi.WSGIServer</li>
10721072
<li>gevent.pywsgi.WSGIServer</li>
10731073
</ul>
1074-
<p>wsgi is a Python bridge to libev's <em>very</em> fast HTTP
1075-
server. It does one job very well. Namely shoving content down a
1076-
network pipe as fast as possible. It is however limited in
1077-
certain HTTP features, the key one being lack chunked transfer
1078-
encoding.</p>
1074+
<p>In earlier versions of gevent before 1.0.x, gevent used libevent
1075+
instead of libev. Libevent included a fast HTTP server which was
1076+
used by gevent's <code>wsgi</code> server. </p>
1077+
<p>In gevent 1.0.x there is no http server included. Instead
1078+
<code>gevent.wsgi</code> it is now an alias for the pure Python server in
1079+
<code>gevent.pywsgi</code>.</p>
1080+
<h2 id="streaming-servers">Streaming Servers</h2>
1081+
<p><strong>If you are using gevent 1.0.x, this section does not apply</strong></p>
10791082
<p>For those familiar with streaming HTTP services, the core idea is
10801083
that in the headers we do not specify a length of the content. We
10811084
instead hold the connection open and flush chunks down the pipe,
@@ -1139,6 +1142,9 @@ <h2 id="wsgi-servers">WSGI Servers</h2>
11391142
<p>But regardless, performance on Gevent servers is phenomenal
11401143
compared to other Python servers. libev is a very vetted technology
11411144
and its derivative servers are known to perform well at scale.</p>
1145+
<p>To benchmark, try Apache Benchmark <code>ab</code> or see this
1146+
<a href="http://nichol.as/benchmark-of-python-web-servers">Benchmark of Python WSGI Servers</a>
1147+
for comparison with other servers.</p>
11421148
<pre>
11431149
<code class="shell">$ ab -n 10000 -c 100 http://127.0.0.1:8000/
11441150
</code>

tutorial.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ gevent.joinall([
7474
]]]
7575
[[[end]]]
7676

77-
It is illuminating to visualize the control of the program or
78-
walk through it with a debugger to see the context switches as
79-
they occur.
77+
It is illuminating to visualize the control flow of the program or walk
78+
through it with a debugger to see the context switches as they occur.
8079

8180
![Greenlet Control Flow](flow.gif)
8281

@@ -822,11 +821,18 @@ Henceforth called ``wsgi`` and ``pywsgi``:
822821
* gevent.wsgi.WSGIServer
823822
* gevent.pywsgi.WSGIServer
824823

825-
wsgi is a Python bridge to libev's *very* fast HTTP
826-
server. It does one job very well. Namely shoving content down a
827-
network pipe as fast as possible. It is however limited in
828-
certain HTTP features, the key one being lack chunked transfer
829-
encoding.
824+
In earlier versions of gevent before 1.0.x, gevent used libevent
825+
instead of libev. Libevent included a fast HTTP server which was
826+
used by gevent's ``wsgi`` server.
827+
828+
In gevent 1.0.x there is no http server included. Instead
829+
``gevent.wsgi`` it is now an alias for the pure Python server in
830+
``gevent.pywsgi``.
831+
832+
833+
## Streaming Servers
834+
835+
**If you are using gevent 1.0.x, this section does not apply**
830836

831837
For those familiar with streaming HTTP services, the core idea is
832838
that in the headers we do not specify a length of the content. We
@@ -895,6 +901,10 @@ But regardless, performance on Gevent servers is phenomenal
895901
compared to other Python servers. libev is a very vetted technology
896902
and its derivative servers are known to perform well at scale.
897903

904+
To benchmark, try Apache Benchmark ``ab`` or see this
905+
[Benchmark of Python WSGI Servers](http://nichol.as/benchmark-of-python-web-servers)
906+
for comparison with other servers.
907+
898908
<pre>
899909
<code class="shell">$ ab -n 10000 -c 100 http://127.0.0.1:8000/
900910
</code>

0 commit comments

Comments
 (0)