Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 31GB RAM 8 Core Web Server with current load of 3k per min.

Currently worker_processes parameter in nginx config is 4 which as per my understanding means only 4 cores would be used. But when I see CPU performance I see that all 8 cores have equal load. Why?

enter image description here

Moreover, making this value 8 would help in my case?

share|improve this question

3 Answers 3

Some other programs uses cpu, like php maybe? Paste all your top output, not only your cpu, but programs too. Turn on visibility of threads too... (H key, if I remember correctly.)

share|improve this answer
    
Let's say there are other processes which are causing this up of CPU consumption. Thus, in such a case is it advisable to add more worker processes (upto max of total number of cores)? –  Ut xD Jun 30 at 8:29
1  
Probably not. Only case, that you will want that some day nginx could use all of your cpu resources. –  Kazimieras Aliulis Jul 3 at 8:46

The value of worker_processes is not equivalent to the number of CPU cores used. As the name suggests it controls only the number of individual nginx process instances that will be running. Any one of these instances will spawn a number of threads to process the incoming requests and these threads will run on all available cores even if you choose to use only a single worker process.

As for why one worker process per CPU is preferable over e.g. only a single one - I don't know. Someone with knowledge of the inner workings of how nginx uses threads would have to shed light on that.

PS. I'm wondering why your server load is so high - we're running a small 2-core server that handles up to 200 req/s with hardly any load at all.

share|improve this answer

From the documentation:

The optimal value depends on many factors including (but not limited to) the number of CPU cores, the number of hard disk drives that store data, and load pattern. When one is in doubt, setting it to the number of available CPU cores would be a good start (the value “auto” will try to autodetect it).

So, basically, setting it to the number of CPUs is a good idea. But, if you have disk latency problems, decrease the value.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.