Nginx worker processes

Hi,

Sorry more of a Nginx question than linode specifically but this forum is great for answers.

When configuring nginx on a basic linode I understand I shouldn't really go for more than 1 worker process but from what I understand of nginx that means all the responses to concurrent clients will be serialized. If one response is waiting on a php script that's doing MySql queries or something that takes 5 seconds to come back does that mean in that moment any other normal requests for lets say static pages will have to wait for that 5 second page request to finish?

Thanks

1 Reply

No, the behavior you described is what Apache+prefork does. Nginx can serve ten thousand other clients (or even the same client on a different connection) while it waits for the slow PHP request to finish.

I think the best practice is to have as many worker processes as you have CPU cores. But even with just one worker process, nginx can get a lot of work done.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct