From be6035769cb7b125163c8a04d829f17ca9d05ca7 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 22 Apr 2010 19:20:33 +0200 Subject: [PATCH] update doc --- README.rst | 72 ++++++++++++++++++------------------- doc/site/configuration.rst | 16 ++++----- doc/site/news.rst | 7 ++++ doc/site/usage.rst | 6 ++-- gunicorn/workers/ggevent.py | 2 -- 5 files changed, 54 insertions(+), 49 deletions(-) diff --git a/README.rst b/README.rst index 73d7858b..3059ad4d 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,7 @@ Gunicorn requires **Python 2.5 or newer** (Python 3.x will be supported soon). Install from sources:: - $ python setup.py install + $ python setup.py install Or from Pypi:: @@ -42,49 +42,49 @@ Usage :: - $ gunicorn --help - Usage: gunicorn [OPTIONS] [APP_MODULE] - - Options: - -c CONFIG, --config=CONFIG - Config file. [none] - -b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or - unix:/tmp/gunicorn.sock - -w WORKERS, --workers=WORKERS - Number of workers to spawn. [1] - -a ARBITER, --arbiter=ARBITER - gunicorn arbiter entry point or module + $ gunicorn --help + Usage: gunicorn [OPTIONS] [APP_MODULE] + + Options: + -c CONFIG, --config=CONFIG + Config file. [none] + -b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or + unix:/tmp/gunicorn.sock + -k WORKERCLASS, --worker-class=WORKERCLASS + The type of request processing to use [egg:gunicorn#main] - -p PIDFILE, --pid=PIDFILE - set the background PID FILE - -D, --daemon Run daemonized in the background. - -m UMASK, --umask=UMASK - Define umask of daemon process - -u USER, --user=USER Change worker user - -g GROUP, --group=GROUP - Change worker group - -n APP_NAME, --name=APP_NAME - Application name - --log-level=LOGLEVEL Log level below which to silence messages. [info] - --log-file=LOGFILE Log to a file. - equals stdout. [-] - -d, --debug Debug mode. only 1 worker. - --spew Install a trace hook - --version show program's version number and exit - -h, --help show this help message and exit + -w WORKERS, --workers=WORKERS + Number of workers to spawn. [1] + -p PIDFILE, --pid=PIDFILE + set the background PID FILE + -D, --daemon Run daemonized in the background. + -m UMASK, --umask=UMASK + Define umask of daemon process + -u USER, --user=USER Change worker user + -g GROUP, --group=GROUP + Change worker group + -n APP_NAME, --name=APP_NAME + Application name + --log-level=LOGLEVEL Log level below which to silence messages. [info] + --log-file=LOGFILE Log to a file. - equals stdout. [-] + -d, --debug Debug mode. only 1 worker. + --spew Install a trace hook + --version show program's version number and exit + -h, --help show this help message and exit Example with test app:: - $ cd examples - $ gunicorn --workers=2 test:app + $ cd examples + $ gunicorn --workers=2 test:app Django projects +++++++++++++++ For django projects use the `gunicorn_django` command:: - $ cd yourdjangoproject - $ gunicorn_django --workers=2 + $ cd yourdjangoproject + $ gunicorn_django --workers=2 or use `run_gunicorn` command. @@ -134,7 +134,7 @@ One of the first settings that usually needs to be bumped is the maximum number :: - $ sudo ulimit -n 1024 + $ sudo ulimit -n 1024 Increasing the Listen Queue Size ++++++++++++++++++++++++++++++++ @@ -143,7 +143,7 @@ Listening sockets have an associated queue of incoming connections that are wait :: - $ sudo sysctl -w kern.ipc.somaxconn="1024" + $ sudo sysctl -w kern.ipc.somaxconn="1024" Widening the Ephemeral Port Range +++++++++++++++++++++++++++++++++ @@ -154,7 +154,7 @@ This setting is generally only required on machines that are being used to test :: - $ sudo sysctl -w net.inet.ip.portrange.first="8048" + $ sudo sysctl -w net.inet.ip.portrange.first="8048" Check `this article`_ for more information on ephemeral ports. diff --git a/doc/site/configuration.rst b/doc/site/configuration.rst index 085ccec0..3f5427cb 100644 --- a/doc/site/configuration.rst +++ b/doc/site/configuration.rst @@ -11,7 +11,6 @@ Example gunicorn.conf.py :: - arbiter = "egg:gunicorn" # The arbiter to use for worker management backlog = 2048 # The listen queue size for the server socket bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock" daemon = False # Whether work in the background @@ -28,6 +27,7 @@ Example gunicorn.conf.py spew=False # Display trace timeout=30 # Worker timeout tmp_upload_dir = None # Set path used to store temporary uploads + worker_class = "egg:gunicorn#sync" # The type of request processing to use worker_connections=1000 # Maximum number of simultaneous connections after_fork=lambda server, worker: server.log.info( @@ -43,17 +43,16 @@ Parameter Descriptions after_fork(server, worker): This is called by the worker after initialization. -arbiter: - The arbiter manages the worker processes that actually serve clients. It - handles launching new workers and killing misbehaving workers among - other things. By default the arbiter is `egg:gunicorn#main`. This arbiter +worker_class: + Define the type of worker to use. A worker process all the requests send by + the arbiter.By default the worker_class is `egg:gunicorn#sync`. This worker only supports fast request handling requiring a buffering HTTP proxy. If your application requires the ability to handle prolonged requests to provide long polling, comet, or calling an external web service you'll - need to use an async arbiter. Gunicorn has two async arbiters built in - using `Eventlet`_ or `Gevent`_. You can also use the Evenlet arbiter with - the `Twisted`_ helper. + need to use an async worker. Gunicorn has three async workers built in + using `Tornado`_, `Eventlet`_ or `Gevent`_. You can also use the Evenlet + worker with the `Twisted`_ helper. backlog: The backlog parameter defines the maximum length for the queue of pending @@ -121,5 +120,6 @@ tmp_upload_dir: .. _Eventlet: http://eventlet.net .. _Gevent: http://gevent.org .. _Twisted: http://twistedmatrix.com +.. _Tornado: http://www.tornadoweb.org/ .. _setproctitle: http://pypi.python.org/pypi/setproctitle diff --git a/doc/site/news.rst b/doc/site/news.rst index 0600b7ef..3d5144e4 100644 --- a/doc/site/news.rst +++ b/doc/site/news.rst @@ -4,6 +4,13 @@ title: News News ==== +0.7.3 / 2004-04-22 +------------------ + +- Refactored Worker management for better async support. Now use the -k option to set the type of request processing to use +- Added support for `Tornado `_ . + + 0.7.2 / 2010-04-15 ------------------ diff --git a/doc/site/usage.rst b/doc/site/usage.rst index 77256f3a..b0e0b3aa 100644 --- a/doc/site/usage.rst +++ b/doc/site/usage.rst @@ -43,11 +43,11 @@ Full command line usage Config file. [none] -b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or unix:/tmp/gunicorn.sock + -k WORKERCLASS, --worker-class=WORKERCLASS + The type of request processing to use + [egg:gunicorn#main] -w WORKERS, --workers=WORKERS Number of workers to spawn. [1] - -a ARBITER, --arbiter=ARBITER - gunicorn arbiter entry point or module - [egg:gunicorn#main] -p PIDFILE, --pid=PIDFILE set the background PID FILE -D, --daemon Run daemonized in the background. diff --git a/gunicorn/workers/ggevent.py b/gunicorn/workers/ggevent.py index 793027b4..e3ee1c81 100644 --- a/gunicorn/workers/ggevent.py +++ b/gunicorn/workers/ggevent.py @@ -65,8 +65,6 @@ class GEventWorker(AsyncWorker): except greenlet.GreenletExit: return - - def cleanup(self, gt): try: try: