about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--TUNING30
-rw-r--r--lib/unicorn/configurator.rb2
2 files changed, 24 insertions, 8 deletions
diff --git a/TUNING b/TUNING
index 0964552..d269b43 100644
--- a/TUNING
+++ b/TUNING
@@ -1,13 +1,32 @@
-= Tuning Unicorn
+= Tuning \Unicorn
 
-Unicorn performance is generally as good as a (mostly) Ruby web server
+\Unicorn performance is generally as good as a (mostly) Ruby web server
 can provide.  Most often the performance bottleneck is in the web
 application running on Unicorn rather than Unicorn itself.
 
-== Unicorn Configuration
+== \Unicorn Configuration
 
 See Unicorn::Configurator for details on the config file format.
 
+=== Unicorn::Configurator#worker_processes
+
+* worker_processes should be scaled to the number of processes your
+  backend system(s) can support.  DO NOT scale it to the number of
+  external network clients your application expects to be serving.
+  \Unicorn is NOT for serving slow clients, that is the job of nginx.
+
+* worker_processes should be *at* *least* the number of CPU cores on
+  a dedicated server.  If your application has occasionally slow
+  responses that are /not/ CPU-intensive, you may increase this to
+  workaround those inefficiencies.
+
+* worker_processes may be increased for Unicorn::OobGC users to provide
+  more consistent response times.
+
+* Never, ever, increase worker_processes to the point where the system
+  runs out of physical memory and hits swap.  Production servers should
+  never see heavy swap activity.
+
 * Setting a very low value for the :backlog parameter in "listen"
   directives can allow failover to happen more quickly if your
   cluster is configured for it.
@@ -42,11 +61,6 @@ See Unicorn::Configurator for details on the config file format.
   have them unbuffered (File#sync = true) or they are
   record(line)-buffered in userspace before any writes.
 
-* worker_processes should be scaled to the number of processes your
-  backend system(s) can support.  DO NOT scale it to the number of
-  external network clients your application expects to be serving.
-  Unicorn is NOT for serving slow clients, that is the job of nginx.
-
 == Kernel Parameters (Linux sysctl)
 
 WARNING: Do not change system parameters unless you know what you're doing!
diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb
index bed3abe..b6ad022 100644
--- a/lib/unicorn/configurator.rb
+++ b/lib/unicorn/configurator.rb
@@ -8,6 +8,8 @@ require 'logger'
 # example configuration files.  An example config file for use with
 # nginx is also available at
 # http://unicorn.bogomips.org/examples/nginx.conf
+#
+# See the link:/TUNING.html document for more information on tuning unicorn.
 class Unicorn::Configurator
   include Unicorn