mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
update doc
This commit is contained in:
parent
090bb8fe29
commit
be6035769c
72
README.rst
72
README.rst
@ -15,7 +15,7 @@ Gunicorn requires **Python 2.5 or newer** (Python 3.x will be supported soon).
|
|||||||
|
|
||||||
Install from sources::
|
Install from sources::
|
||||||
|
|
||||||
$ python setup.py install
|
$ python setup.py install
|
||||||
|
|
||||||
Or from Pypi::
|
Or from Pypi::
|
||||||
|
|
||||||
@ -42,49 +42,49 @@ Usage
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
$ gunicorn --help
|
$ gunicorn --help
|
||||||
Usage: gunicorn [OPTIONS] [APP_MODULE]
|
Usage: gunicorn [OPTIONS] [APP_MODULE]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-c CONFIG, --config=CONFIG
|
-c CONFIG, --config=CONFIG
|
||||||
Config file. [none]
|
Config file. [none]
|
||||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||||
unix:/tmp/gunicorn.sock
|
unix:/tmp/gunicorn.sock
|
||||||
-w WORKERS, --workers=WORKERS
|
-k WORKERCLASS, --worker-class=WORKERCLASS
|
||||||
Number of workers to spawn. [1]
|
The type of request processing to use
|
||||||
-a ARBITER, --arbiter=ARBITER
|
|
||||||
gunicorn arbiter entry point or module
|
|
||||||
[egg:gunicorn#main]
|
[egg:gunicorn#main]
|
||||||
-p PIDFILE, --pid=PIDFILE
|
-w WORKERS, --workers=WORKERS
|
||||||
set the background PID FILE
|
Number of workers to spawn. [1]
|
||||||
-D, --daemon Run daemonized in the background.
|
-p PIDFILE, --pid=PIDFILE
|
||||||
-m UMASK, --umask=UMASK
|
set the background PID FILE
|
||||||
Define umask of daemon process
|
-D, --daemon Run daemonized in the background.
|
||||||
-u USER, --user=USER Change worker user
|
-m UMASK, --umask=UMASK
|
||||||
-g GROUP, --group=GROUP
|
Define umask of daemon process
|
||||||
Change worker group
|
-u USER, --user=USER Change worker user
|
||||||
-n APP_NAME, --name=APP_NAME
|
-g GROUP, --group=GROUP
|
||||||
Application name
|
Change worker group
|
||||||
--log-level=LOGLEVEL Log level below which to silence messages. [info]
|
-n APP_NAME, --name=APP_NAME
|
||||||
--log-file=LOGFILE Log to a file. - equals stdout. [-]
|
Application name
|
||||||
-d, --debug Debug mode. only 1 worker.
|
--log-level=LOGLEVEL Log level below which to silence messages. [info]
|
||||||
--spew Install a trace hook
|
--log-file=LOGFILE Log to a file. - equals stdout. [-]
|
||||||
--version show program's version number and exit
|
-d, --debug Debug mode. only 1 worker.
|
||||||
-h, --help show this help message and exit
|
--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::
|
Example with test app::
|
||||||
|
|
||||||
$ cd examples
|
$ cd examples
|
||||||
$ gunicorn --workers=2 test:app
|
$ gunicorn --workers=2 test:app
|
||||||
|
|
||||||
Django projects
|
Django projects
|
||||||
+++++++++++++++
|
+++++++++++++++
|
||||||
|
|
||||||
For django projects use the `gunicorn_django` command::
|
For django projects use the `gunicorn_django` command::
|
||||||
|
|
||||||
$ cd yourdjangoproject
|
$ cd yourdjangoproject
|
||||||
$ gunicorn_django --workers=2
|
$ gunicorn_django --workers=2
|
||||||
|
|
||||||
or use `run_gunicorn` command.
|
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
|
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
|
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.
|
Check `this article`_ for more information on ephemeral ports.
|
||||||
|
|
||||||
|
|||||||
@ -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
|
backlog = 2048 # The listen queue size for the server socket
|
||||||
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
|
bind = "127.0.0.1:8000" # Or "unix:/tmp/gunicorn.sock"
|
||||||
daemon = False # Whether work in the background
|
daemon = False # Whether work in the background
|
||||||
@ -28,6 +27,7 @@ Example gunicorn.conf.py
|
|||||||
spew=False # Display trace
|
spew=False # Display trace
|
||||||
timeout=30 # Worker timeout
|
timeout=30 # Worker timeout
|
||||||
tmp_upload_dir = None # Set path used to store temporary uploads
|
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
|
worker_connections=1000 # Maximum number of simultaneous connections
|
||||||
|
|
||||||
after_fork=lambda server, worker: server.log.info(
|
after_fork=lambda server, worker: server.log.info(
|
||||||
@ -43,17 +43,16 @@ Parameter Descriptions
|
|||||||
after_fork(server, worker):
|
after_fork(server, worker):
|
||||||
This is called by the worker after initialization.
|
This is called by the worker after initialization.
|
||||||
|
|
||||||
arbiter:
|
worker_class:
|
||||||
The arbiter manages the worker processes that actually serve clients. It
|
Define the type of worker to use. A worker process all the requests send by
|
||||||
handles launching new workers and killing misbehaving workers among
|
the arbiter.By default the worker_class is `egg:gunicorn#sync`. This worker
|
||||||
other things. By default the arbiter is `egg:gunicorn#main`. This arbiter
|
|
||||||
only supports fast request handling requiring a buffering HTTP proxy.
|
only supports fast request handling requiring a buffering HTTP proxy.
|
||||||
|
|
||||||
If your application requires the ability to handle prolonged requests to
|
If your application requires the ability to handle prolonged requests to
|
||||||
provide long polling, comet, or calling an external web service you'll
|
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
|
need to use an async worker. Gunicorn has three async workers built in
|
||||||
using `Eventlet`_ or `Gevent`_. You can also use the Evenlet arbiter with
|
using `Tornado`_, `Eventlet`_ or `Gevent`_. You can also use the Evenlet
|
||||||
the `Twisted`_ helper.
|
worker with the `Twisted`_ helper.
|
||||||
|
|
||||||
backlog:
|
backlog:
|
||||||
The backlog parameter defines the maximum length for the queue of pending
|
The backlog parameter defines the maximum length for the queue of pending
|
||||||
@ -121,5 +120,6 @@ tmp_upload_dir:
|
|||||||
.. _Eventlet: http://eventlet.net
|
.. _Eventlet: http://eventlet.net
|
||||||
.. _Gevent: http://gevent.org
|
.. _Gevent: http://gevent.org
|
||||||
.. _Twisted: http://twistedmatrix.com
|
.. _Twisted: http://twistedmatrix.com
|
||||||
|
.. _Tornado: http://www.tornadoweb.org/
|
||||||
.. _setproctitle: http://pypi.python.org/pypi/setproctitle
|
.. _setproctitle: http://pypi.python.org/pypi/setproctitle
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,13 @@ title: News
|
|||||||
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 <http://www.tornadoweb.org/>`_ .
|
||||||
|
|
||||||
|
|
||||||
0.7.2 / 2010-04-15
|
0.7.2 / 2010-04-15
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|||||||
@ -43,11 +43,11 @@ Full command line usage
|
|||||||
Config file. [none]
|
Config file. [none]
|
||||||
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
-b BIND, --bind=BIND Adress to listen on. Ex. 127.0.0.1:8000 or
|
||||||
unix:/tmp/gunicorn.sock
|
unix:/tmp/gunicorn.sock
|
||||||
|
-k WORKERCLASS, --worker-class=WORKERCLASS
|
||||||
|
The type of request processing to use
|
||||||
|
[egg:gunicorn#main]
|
||||||
-w WORKERS, --workers=WORKERS
|
-w WORKERS, --workers=WORKERS
|
||||||
Number of workers to spawn. [1]
|
Number of workers to spawn. [1]
|
||||||
-a ARBITER, --arbiter=ARBITER
|
|
||||||
gunicorn arbiter entry point or module
|
|
||||||
[egg:gunicorn#main]
|
|
||||||
-p PIDFILE, --pid=PIDFILE
|
-p PIDFILE, --pid=PIDFILE
|
||||||
set the background PID FILE
|
set the background PID FILE
|
||||||
-D, --daemon Run daemonized in the background.
|
-D, --daemon Run daemonized in the background.
|
||||||
|
|||||||
@ -65,8 +65,6 @@ class GEventWorker(AsyncWorker):
|
|||||||
except greenlet.GreenletExit:
|
except greenlet.GreenletExit:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cleanup(self, gt):
|
def cleanup(self, gt):
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user