From 26df9d5bfa2e923ca1ee02f87989a0730b7c7441 Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 8 Mar 2010 20:09:20 -0500 Subject: [PATCH 1/2] Adding FAQ entries for fast clients. --- doc/htdocs/configuration.html | 12 ++++-------- doc/htdocs/deployment.html | 2 +- doc/htdocs/faq.html | 27 ++++++++++++++++++++++++--- doc/htdocs/index.html | 2 +- doc/htdocs/news.html | 22 ++++++++++++++++++---- doc/site/faq.rst | 30 +++++++++++++++++++++++++++++- doc/site/index.rst | 3 ++- 7 files changed, 79 insertions(+), 19 deletions(-) diff --git a/doc/htdocs/configuration.html b/doc/htdocs/configuration.html index fda259fd..b0b8787c 100644 --- a/doc/htdocs/configuration.html +++ b/doc/htdocs/configuration.html @@ -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"
diff --git a/doc/htdocs/deployment.html b/doc/htdocs/deployment.html index c7c15ab0..0a20eeff 100644 --- a/doc/htdocs/deployment.html +++ b/doc/htdocs/deployment.html @@ -127,7 +127,7 @@ exec $GUNICORN -C $ROOT/gunicorn.conf.py --pidfile=$PID $APP simple configuration is:

 [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
diff --git a/doc/htdocs/faq.html b/doc/htdocs/faq.html
index f31ef387..568ce8b6 100644
--- a/doc/htdocs/faq.html
+++ b/doc/htdocs/faq.html
@@ -50,6 +50,25 @@
   

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:

@@ -67,10 +86,12 @@ $ kill -TTOU $masterpid
 
How do I set SCRIPT_NAME?
-
By default SCRIPT_NAME is an empy string. The value could be set by -setting SCRIPT_NAME in the environment or as an HTTP header.
+
By default SCRIPT_NAME is an empy string. The value could be set by +setting SCRIPT_NAME in the environment or as an HTTP header.
How to name processes?
-
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.
+
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.
diff --git a/doc/htdocs/index.html b/doc/htdocs/index.html index cf83ca45..1b2b0c06 100644 --- a/doc/htdocs/index.html +++ b/doc/htdocs/index.html @@ -47,7 +47,7 @@

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.

Gunicorn is released under the MIT License. See the LICENSE for more details.

diff --git a/doc/htdocs/news.html b/doc/htdocs/news.html index 96c29e96..ff8449ca 100644 --- a/doc/htdocs/news.html +++ b/doc/htdocs/news.html @@ -50,6 +50,20 @@

News

+

0.6.4 / 2010-03-08

+
    +
  • Use cStringIO when it's possible (use less CPU and faster)
  • +
  • Fix worker freeze when a remote connexion close unexpectedly.
  • +
+
+
+

0.6.3 / 2010-03-07

+
    +
  • Make HTTP parsing faster.
  • +
  • Some fixes (see logs)
  • +
+
+

0.6.2 / 2010-03-01

  • Added support for chunked response.
  • @@ -59,7 +73,7 @@
  • Workers are now murdered by age (the older is killed the first).
-
+

0.6.1 / 2010-02-24

  • Added gunicorn config file support for django admin command
  • @@ -67,21 +81,21 @@
  • Removed TTIN/TTOU from workers which blocked other signals.
-
+

0.6 / 2010-02-22

  • Added setproctitle
  • Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.
-
+

0.5.1 / 2010-02-22

  • Fix umask
  • Added debian packaging
-
+

0.5 / 2010-02-20

  • Added configuration file handler.
  • diff --git a/doc/site/faq.rst b/doc/site/faq.rst index 0e7f8702..01825c88 100644 --- a/doc/site/faq.rst +++ b/doc/site/faq.rst @@ -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 `_. 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. \ No newline at end of file + 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 \ No newline at end of file diff --git a/doc/site/index.rst b/doc/site/index.rst index d4985634..7e306f11 100644 --- a/doc/site/index.rst +++ b/doc/site/index.rst @@ -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 From fdd02f8f6c5b19315457d0660cf0dc79cec72bbe Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 8 Mar 2010 20:38:39 -0500 Subject: [PATCH 2/2] Minor grammar fixes. --- doc/htdocs/news.html | 14 +++++++------- doc/site/news.rst | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/htdocs/news.html b/doc/htdocs/news.html index ff8449ca..9c164974 100644 --- a/doc/htdocs/news.html +++ b/doc/htdocs/news.html @@ -52,8 +52,8 @@

    0.6.4 / 2010-03-08

      -
    • Use cStringIO when it's possible (use less CPU and faster)
    • -
    • Fix worker freeze when a remote connexion close unexpectedly.
    • +
    • Use cStringIO for performance when possible.
    • +
    • Fix worker freeze when a remote connection closes unexpectedly.
    @@ -67,10 +67,10 @@

    0.6.2 / 2010-03-01

    • Added support for chunked response.
    • -
    • Added possibility to configure proc_name in config file.
    • -
    • Improved HTTP parser. We now use buffers instead of strings to store temporary data.
    • -
    • Improved performance in send.
    • -
    • Workers are now murdered by age (the older is killed the first).
    • +
    • Added proc_name option to the config file.
    • +
    • Improved the HTTP parser. It now uses buffers instead of strings to store temporary data.
    • +
    • Improved performance when sending responses.
    • +
    • Workers are now murdered by age (the oldest is killed first).
    @@ -85,7 +85,7 @@

    0.6 / 2010-02-22

    • Added setproctitle
    • -
    • Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers.
    • +
    • Change privilege switch behaviour. We now work like NGINX, master keeps the permissions, new uid/gid permissions are only set for workers.
    diff --git a/doc/site/news.rst b/doc/site/news.rst index 474662c9..a5530f18 100644 --- a/doc/site/news.rst +++ b/doc/site/news.rst @@ -7,8 +7,8 @@ News 0.6.4 / 2010-03-08 ------------------ -- Use cStringIO when it's possible (use less CPU and faster) -- Fix worker freeze when a remote connexion close unexpectedly. +- Use cStringIO for performance when possible. +- Fix worker freeze when a remote connection closes unexpectedly. 0.6.3 / 2010-03-07 ------------------ @@ -20,10 +20,10 @@ News ------------------ * Added support for chunked response. -* Added possibility to configure proc_name in config file. -* Improved HTTP parser. We now use buffers instead of strings to store temporary data. -* Improved performance in send. -* Workers are now murdered by age (the older is killed the first). +* Added proc_name option to the config file. +* Improved the HTTP parser. It now uses buffers instead of strings to store temporary data. +* Improved performance when sending responses. +* Workers are now murdered by age (the oldest is killed first). 0.6.1 / 2010-02-24 @@ -37,7 +37,7 @@ News ------------------ * Added setproctitle -* Change privilege switch behaviour. We now works like NGINX, master keep the permission, new uid/gid permissions are only set to the workers. +* Change privilege switch behaviour. We now work like NGINX, master keeps the permissions, new uid/gid permissions are only set for workers. 0.5.1 / 2010-02-22 ------------------