Adding FAQ entries for fast clients.

This commit is contained in:
Paul J. Davis 2010-03-08 20:09:20 -05:00
parent a10ca702e9
commit 26df9d5bfa
7 changed files with 79 additions and 19 deletions

View File

@ -66,16 +66,12 @@ group = None # Change process group to group
proc_name = None # Change the process name
tmp_upload_dir = None # Set path used to store temporary uploads
def after_fork(server, worker):
fmt = "worker=%s spawned pid=%s"
server.log.info(fmt % (worker.id, worker.pid))
after_fork=lambda server, worker: server.log.info(
"Worker spawned (pid: %s)" % worker.pid),
def before_fork(server, worker):
fmt = "worker=%s spawning"
server.log.info(fmt % worker.id)
before_fork=lambda server, worker: True,
def before_exec(server):
serer.log.info("Forked child, reexecuting.")
before_exec=lambda server: server.log.info("Forked child, reexecuting"
</pre>
</div>
<div class="section" id="parameter-descriptions">

View File

@ -127,7 +127,7 @@ exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP
<a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/examples/supervisor.conf">simple configuration</a> is:</p>
<pre class="literal-block">
[program:gunicorn]
command=/usr/local/bin/gunicorn main:application -C /path/to/project/gunicorn.conf.py
command=/usr/local/bin/gunicorn main:application -c /path/to/project/gunicorn.conf.py
directory=/path/to/project
user=nobody
autostart=true

View File

@ -50,6 +50,25 @@
<div class="document" id="faq">
<h1 class="title">FAQ</h1>
<dl class="docutils">
<dt>What is a slow client?</dt>
<dd>A slow client is defined as a request that can take an arbitrary amount of
time to send or read a request. Sometimes due to network performance or
because it is a malicious client attempting to cause problems. Check out
the <a class="reference external" href="http://ha.ckers.org/slowloris/">slowloris</a> script to generate slow client traffic.</dd>
<dt>What is a fast client?</dt>
<dd>Generally speaking a fast client is something that is being served over the
local network or from the same machine. This generally would refer to requests
forwarded from an upstream proxy. Also see the above FAQ for what a fast
client is not.</dd>
<dt>Why only fast clients?</dt>
<dd>By designing a web server to only handle fast clients we can greatly simplify
the implementation. Think of it as a separation of concerns where your proxy
handles talking to the big bad world of the internet and filters the requests
to your application code.</dd>
<dt>How might I test a proxy configuration?</dt>
<dd>Check out <a class="reference external" href="http://ha.ckers.org/slowloris/">slowloris</a> for a script that will generate significant slow
traffic. If your application remains responsive through out that test you
should be comfortable that all is well with your configuration.</dd>
<dt>How do I reload my application in Gunicorn?</dt>
<dd><p class="first">You can gracefully reload by sending HUP signal to gunicorn:</p>
<pre class="last literal-block">
@ -67,10 +86,12 @@ $ kill -TTOU $masterpid
</pre>
</dd>
<dt>How do I set SCRIPT_NAME?</dt>
<dd>By default <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> is an empy string. The value could be set by
setting <tt class="docutils literal"><span class="pre">SCRIPT_NAME</span></tt> in the environment or as an HTTP header.</dd>
<dd>By default <tt class="docutils literal">SCRIPT_NAME</tt> is an empy string. The value could be set by
setting <tt class="docutils literal">SCRIPT_NAME</tt> in the environment or as an HTTP header.</dd>
<dt>How to name processes?</dt>
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name your process with <cite>-n</cite> or just let the default. If you use a configuration file you can set the process name with the proc_name option.</dd>
<dd>You need to install the Python package <a class="reference external" href="http://pypi.python.org/pypi/setproctitle">setproctitle</a>. Then you can name
your process with <cite>-n</cite> or just let the default. If you use a configuration
file you can set the process name with the proc_name option.</dd>
</dl>
</div>

View File

@ -47,7 +47,7 @@
<div class="document" id="green-unicorn">
<h1 class="title">Green Unicorn</h1>
<p>Green Unicorn (gunicorn) is an HTTP/WSGI Server for UNIX designed to serve fast clients and nothing else.</p>
<p>Green Unicorn (gunicorn) is an HTTP/WSGI Server for UNIX designed to serve <a class="reference external" href="faq.html">fast clients</a> and nothing else.</p>
<p>This is a port of <a class="reference external" href="http://unicorn.bogomips.org/">Unicorn</a> in Python. Meet us on the <a class="reference external" href="http://webchat.freenode.net/?channels=gunicorn">#gunicorn IRC channel</a> on <a class="reference external" href="http://freenode.net">Freenode</a>.</p>
<p>Gunicorn is released under the MIT License. See the <a class="reference external" href="http://github.com/benoitc/gunicorn/blob/master/LICENSE">LICENSE</a> for more details.</p>
<div class="section" id="features">

View File

@ -50,6 +50,20 @@
<div class="document" id="news">
<h1 class="title">News</h1>
<div class="section" id="id1">
<h1>0.6.4 / 2010-03-08</h1>
<ul class="simple">
<li>Use cStringIO when it's possible (use less CPU and faster)</li>
<li>Fix worker freeze when a remote connexion close unexpectedly.</li>
</ul>
</div>
<div class="section" id="id2">
<h1>0.6.3 / 2010-03-07</h1>
<ul class="simple">
<li>Make HTTP parsing faster.</li>
<li>Some fixes (see <a class="reference external" href="http://github.com/benoitc/gunicorn/commits/master">logs</a>)</li>
</ul>
</div>
<div class="section" id="id3">
<h1>0.6.2 / 2010-03-01</h1>
<ul class="simple">
<li>Added support for chunked response.</li>
@ -59,7 +73,7 @@
<li>Workers are now murdered by age (the older is killed the first).</li>
</ul>
</div>
<div class="section" id="id2">
<div class="section" id="id4">
<h1>0.6.1 / 2010-02-24</h1>
<ul class="simple">
<li>Added gunicorn config file support for django admin command</li>
@ -67,21 +81,21 @@
<li>Removed TTIN/TTOU from workers which blocked other signals.</li>
</ul>
</div>
<div class="section" id="id3">
<div class="section" id="id5">
<h1>0.6 / 2010-02-22</h1>
<ul class="simple">
<li>Added setproctitle</li>
<li>Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.</li>
</ul>
</div>
<div class="section" id="id4">
<div class="section" id="id6">
<h1>0.5.1 / 2010-02-22</h1>
<ul class="simple">
<li>Fix umask</li>
<li>Added debian packaging</li>
</ul>
</div>
<div class="section" id="id5">
<div class="section" id="id7">
<h1>0.5 / 2010-02-20</h1>
<ul class="simple">
<li>Added <a class="reference external" href="configuration.html">configuration file</a> handler.</li>

View File

@ -4,6 +4,29 @@ title: FAQ
FAQ
===
What is a slow client?
A slow client is defined as a request that can take an arbitrary amount of
time to send or read a request. Sometimes due to network performance or
because it is a malicious client attempting to cause problems. Check out
the slowloris_ script to generate slow client traffic.
What is a fast client?
Generally speaking a fast client is something that is being served over the
local network or from the same machine. This generally would refer to requests
forwarded from an upstream proxy. Also see the above FAQ for what a fast
client is not.
Why only fast clients?
By designing a web server to only handle fast clients we can greatly simplify
the implementation. Think of it as a separation of concerns where your proxy
handles talking to the big bad world of the internet and filters the requests
to your application code.
How might I test a proxy configuration?
Check out slowloris_ for a script that will generate significant slow
traffic. If your application remains responsive through out that test you
should be comfortable that all is well with your configuration.
How do I reload my application in Gunicorn?
You can gracefully reload by sending HUP signal to gunicorn::
@ -25,4 +48,9 @@ How do I set SCRIPT_NAME?
setting ``SCRIPT_NAME`` in the environment or as an HTTP header.
How to name processes?
You need to install the Python package `setproctitle <http://pypi.python.org/pypi/setproctitle>`_. Then you can name your process with `-n` or just let the default. If you use a configuration file you can set the process name with the proc_name option.
You need to install the Python package setproctitle_. Then you can name
your process with `-n` or just let the default. If you use a configuration
file you can set the process name with the proc_name option.
.. _slowloris: http://ha.ckers.org/slowloris/
.. _setproctitle: http://pypi.python.org/pypi/setproctitle

View File

@ -3,7 +3,7 @@ template: index.html
Green Unicorn
=============
Green Unicorn (gunicorn) is an HTTP/WSGI Server for UNIX designed to serve fast clients and nothing else.
Green Unicorn (gunicorn) is an HTTP/WSGI Server for UNIX designed to serve `fast clients`_ and nothing else.
This is a port of Unicorn_ in Python. Meet us on the `#gunicorn IRC channel`_ on Freenode_.
@ -24,6 +24,7 @@ Features
stream-based protocols over HTTP
- Post- and pre-fork hooks
.. _`fast clients`: faq.html
.. _Unicorn: http://unicorn.bogomips.org/
.. _`#gunicorn IRC channel`: http://webchat.freenode.net/?channels=gunicorn
.. _Freenode: http://freenode.net