Use the newer cpu_count method in docs.

Updated docs to show the use of the cpu_count function in the
multiprocessing module.

Thanks to Fabian Topfstedt for the update.

Fixes #202
This commit is contained in:
Paul J. Davis 2011-04-25 11:22:44 -04:00
parent 0b094ca08a
commit c71b9a88c2
3 changed files with 19 additions and 8 deletions

1
THANKS
View File

@ -26,3 +26,4 @@ Neil Chintomby <nchintomby@gmail.com>
Alex Robbins <alexander.j.robbins@gmail.com>
Graham Dumpleton <Graham.Dumpleton@gmail.com>
Dan Sully <daniel-github@electricrain.com>
Fabian Topfstedt <topfstedt@schneevonmorgen.com>

View File

@ -81,15 +81,20 @@ you start Gunicorn (including when you signal Gunicorn to reload).</p>
you provide will be used for the configuration values.</p>
<p>For instance:</p>
<pre class="literal-block">
import multiprocessing
bind = &quot;127.0.0.1:8000&quot;
workers = multiprocessing.cpu_count() * 2 + 1
</pre>
<p>On a side note, Python's older than 2.6 can use sysconf to get the
number of processors:</p>
<pre class="literal-block">
import os
def numCPUs():
if not hasattr(os, &quot;sysconf&quot;):
raise RuntimeError(&quot;No sysconf detected.&quot;)
return os.sysconf(&quot;SC_NPROCESSORS_ONLN&quot;)
bind = &quot;127.0.0.1:8000&quot;
workers = numCPUs() * 2 + 1
</pre>
</div>
<div class="section" id="command-line">
@ -288,7 +293,7 @@ background.</p>
<h4><a class="toc-backref" href="#contents">user</a></h4>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">-u</span> USER, <span class="pre">--user</span> USER</tt></li>
<li><tt class="docutils literal">501</tt></li>
<li><tt class="docutils literal">1744020413</tt></li>
</ul>
<p>Switch worker processes to run as this user.</p>
<p>A valid user id (as an integer) or the name of a user that can be
@ -299,7 +304,7 @@ the worker process user.</p>
<h4><a class="toc-backref" href="#contents">group</a></h4>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">-g</span> GROUP, <span class="pre">--group</span> GROUP</tt></li>
<li><tt class="docutils literal">20</tt></li>
<li><tt class="docutils literal">2093627230</tt></li>
</ul>
<p>Switch worker process to run as this group.</p>
<p>A valid group id (as an integer) or the name of a user that can be

View File

@ -69,6 +69,14 @@ you provide will be used for the configuration values.
For instance::
import multiprocessing
bind = "127.0.0.1:8000"
workers = multiprocessing.cpu_count() * 2 + 1
On a side note, Python's older than 2.6 can use sysconf to get the
number of processors::
import os
def numCPUs():
@ -76,9 +84,6 @@ For instance::
raise RuntimeError("No sysconf detected.")
return os.sysconf("SC_NPROCESSORS_ONLN")
bind = "127.0.0.1:8000"
workers = numCPUs() * 2 + 1
Command Line
------------