From c71b9a88c24a6bce8da953f4c1de80f123732ebc Mon Sep 17 00:00:00 2001 From: "Paul J. Davis" Date: Mon, 25 Apr 2011 11:22:44 -0400 Subject: [PATCH] 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 --- THANKS | 1 + doc/htdocs/configure.html | 15 ++++++++++----- doc/site/configure.rst | 11 ++++++++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/THANKS b/THANKS index ddac4093..579ab2d8 100644 --- a/THANKS +++ b/THANKS @@ -26,3 +26,4 @@ Neil Chintomby Alex Robbins Graham Dumpleton Dan Sully +Fabian Topfstedt diff --git a/doc/htdocs/configure.html b/doc/htdocs/configure.html index 2e7295fe..56c75f5e 100644 --- a/doc/htdocs/configure.html +++ b/doc/htdocs/configure.html @@ -81,15 +81,20 @@ you start Gunicorn (including when you signal Gunicorn to reload).

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():
     if not hasattr(os, "sysconf"):
         raise RuntimeError("No sysconf detected.")
     return os.sysconf("SC_NPROCESSORS_ONLN")
-
-bind = "127.0.0.1:8000"
-workers = numCPUs() * 2 + 1
 
@@ -288,7 +293,7 @@ background.

user

  • -u USER, --user USER
  • -
  • 501
  • +
  • 1744020413

Switch worker processes to run as this user.

A valid user id (as an integer) or the name of a user that can be @@ -299,7 +304,7 @@ the worker process user.

group

  • -g GROUP, --group GROUP
  • -
  • 20
  • +
  • 2093627230

Switch worker process to run as this group.

A valid group id (as an integer) or the name of a user that can be diff --git a/doc/site/configure.rst b/doc/site/configure.rst index adb13bb9..6de02218 100644 --- a/doc/site/configure.rst +++ b/doc/site/configure.rst @@ -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 ------------