From c71b9a88c24a6bce8da953f4c1de80f123732ebc Mon Sep 17 00:00:00 2001
From: "Paul J. Davis"
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
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.
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 ------------