15
How do I set SCRIPT_NAME?
16
-------------------------
18
By default ``SCRIPT_NAME`` is an empy string. The value could be set by
19
setting ``SCRIPT_NAME`` in the environment or as an HTTP header.
25
How do I reload my application in Gunicorn?
26
-------------------------------------------
28
You can gracefully reload by sending HUP signal to gunicorn::
32
How might I test a proxy configuration?
33
---------------------------------------
35
The Slowloris_ script is a great way to test that your proxy is correctly
36
buffering responses for the synchronous workers.
38
How can I name processes?
39
-------------------------
41
If you install the Python package setproctitle_ Gunicorn will set the process
42
names to something a bit more meaningful. This will affect the output you see
43
in tools like ``ps`` and ``top``. This helps for distinguishing the master
44
process as well as between masters when running more than one app on a single
45
machine. See the proc_name_ setting for more information.
47
.. _slowloris: http://ha.ckers.org/slowloris/
48
.. _setproctitle: http://pypi.python.org/pypi/setproctitle
49
.. _proc_name: /configure.html#proc-name
7
55
How do I know which type of worker to use?
8
Test. Read the "Synchronous vs Asynchronous workers" section on the
9
deployment_ page. Test some more.
56
------------------------------------------
58
Read the design_ page for help on the various worker types.
11
60
What types of workers are there?
12
These can all be used with the ``-k`` option and specifying them
13
as ``egg:gunicorn#$(NAME)`` where ``$(NAME)`` is chosen from this list.
15
* ``sync`` - The default synchronous worker
16
* ``eventlet`` - Asynchronous workers based on Greenlets
17
* ``gevent`` - Asynchronous workers based on Greenlets
18
* ``tornado`` - Asynchronous workers based on FriendFeed's Tornado server.
20
How might I test a proxy configuration?
21
Check out slowloris_ for a script that will generate significant slow
22
traffic. If your application remains responsive through out that test you
23
should be comfortable that all is well with your configuration.
25
How do I reload my application in Gunicorn?
26
You can gracefully reload by sending HUP signal to gunicorn::
30
How do I increase or decrease the number of running workers dynamically?
61
--------------------------------
63
Check out the configuration docs for worker_class_
65
How can I figure out the best number of worker processes?
66
---------------------------------------------------------
68
Here is our recommendation for tuning the `number of workers`_.
70
How can I change the number of workers dynamically?
71
---------------------------------------------------
31
73
To increase the worker count by one::
33
75
$ kill -TTIN $masterpid
37
79
$ kill -TTOU $masterpid
39
How can I figure out the best number of worker processes?
40
Start gunicorn with an approximate number of worker processes. Then use the
41
TTIN and/or TTOU signals to adjust the number of workers under load.
43
How do I set SCRIPT_NAME?
44
By default ``SCRIPT_NAME`` is an empy string. The value could be set by
45
setting ``SCRIPT_NAME`` in the environment or as an HTTP header.
47
How can I name processes?
48
You need to install the Python package setproctitle_. Then you can specify
49
a base process name on the command line (``-n``) or in the configuration
52
.. _deployment: http://gunicorn.org/deployment.html
53
.. _slowloris: http://ha.ckers.org/slowloris/
54
.. _setproctitle: http://pypi.python.org/pypi/setproctitle
55
.. _Eventlet: http://eventlet.net
56
.. _Gevent: http://gevent.org
b'\\ No newline at end of file'
81
.. _design: /design.html
82
.. _worker_class: /configure.html#worker-class
83
.. _`number of workers`: /design.html#how-many-workers
88
When dealing with large numbers of concurrent connections there are a handful of
89
kernel parameters that you might need to adjust. Generally these should only
90
affect sites with a very large concurrent load. These parameters are not
91
specific to Gunicorn, they would apply to any sort of network server you may be
94
These commands are for Linux. Your particular OS may have slightly different
97
How can I increase the maximum number of file descriptors?
98
----------------------------------------------------------
100
One of the first settings that usually needs to be bumped is the maximum number
101
of open file descriptors for a given process. For the confused out there,
102
remember that Unices treat sockets as files.
106
$ sudo ulimit -n 2048
108
How can I increase the maximum socket backlog?
109
----------------------------------------------
111
Listening sockets have an associated queue of incoming connections that are
112
waiting to be accepted. If you happen to have a stampede of clients that fill up
113
this queue new connections will eventually start getting dropped.
117
$ sudo sysctl -w net.core.somaxconn="2048"