Number of worker processes on hyperthreaded processor
normalperson at yhbt.net
Mon Nov 19 11:23:50 UTC 2012
Andrew Stewart <boss at airbladesoftware.com> wrote:
> Good morning,
> The tuning page says worker_processes should be at least the number of
> CPU cores on a dedicated server. In the case of hyper-threading,
> should this be the number of cores or the number of threads?
> For example the Intel Core i7-2600 Quadcore has 4 cores and 8
> threads. Would I start my worker_processes at 4 or 8?
I'd start with the number of threads, since (AFAIK) your CPU implements
HT well (unlike the P4 family). Modern OSes multitask well, so more
worker processes will always work until it bumps into another limit
(e.g. memory usage, DB connections, disk contention, ...)
You may also want more workers to amortize GC/malloc/free costs anyways.
As always, testing for your particular app is required.
> Finally, would the same apply to Nginx worker processes?
I usually run fewer nginx workers since I don't configure much
CPU/memory-intensive logic in nginx.
However, if you're dealing with large uploads or large responses/static
files which cannot fit into memory, then I suggest having having enough
nginx workers to match (or exceed) your storage device count.
>  http://ark.intel.com/products/52213/Intel-Core-i7-2600-Processor-8M-Cache-up-to-3_80-GHz
More information about the mongrel-unicorn