Me: New to nginx and FastCGI in general, apologies if this is old hat and obvious, but Googling shows me a lot of people recommending random configuration values, but no one that explains the reasoning behind their decisions.
What's the relationship between an nginx worker_process and a PHP-FPM worker? Do more nginx workers means more PHP-FPM workers, or are they unrelated?
My understanding of how this works on a high level is
- User requests a web page
- nginx handles the request, sees it's a PHP page
- nginx hands request off to PHP-FPM
- PHP-FPM either handles the request with an existing process, or spawns new ones
What's unclear to me if there's any relationship between PHP-FPM spawning a new child processes, and which nginx worker processes are talking to it. i.e. if you had two identical web server, one with
worker_process = 4 and another with
worker_process = 8, and they both saw identical web traffic, would one server create more php-fpm child processes than another? Or have I said something so stupid here that it shows I'm missing a fundamental concept? (if so, what?)
Not trying to solve a specific problem -- just trying to learn how to reason about the behavior of nginx and php-fpm so I can contribute to scaling and performance brainstorms/troubleshooting.