Relation between PHP-FPM settings and mpm_worker (Apache) The 2019 Stack Overflow Developer Survey Results Are InApache restart on every requestWhat is the meaning of “AH00485: scoreboard is full, not at MaxRequestWorkers”?nginx+apache2.4+php-fpm - SERVER[“REMOTE_ADDR”] and php_admin_valueTraffic increase causes VPS to crash due to RAM utilisationApache with Worker MPM AND php-fpmApache Causing High LoadHow to configure Apache “workers” for maximum concurrencyHow to figure out the optimum settings for Apache 2.4 PHP-FPM mpm_worker?Nginx With PHP FPM - Resource Temporarily Unavailable - 502 ErrorApache-PHP slow page in one virtual host causes performance degradation or timeout on other
Is it possible for absolutely everyone to attain enlightenment?
Slides for 30 min~1 hr Skype tenure track application interview
What is this business jet?
Why doesn't UInt have a toDouble()?
Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?
Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?
Are spiders unable to hurt humans, especially very small spiders?
writing variables above the numbers in tikz picture
Is it okay to consider publishing in my first year of PhD?
Keeping a retro style to sci-fi spaceships?
What is the motivation for a law requiring 2 parties to consent for recording a conversation
How come people say “Would of”?
Is it correct to say the Neural Networks are an alternative way of performing Maximum Likelihood Estimation? if not, why?
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
Are there any other methods to apply to solving simultaneous equations?
What does Linus Torvalds mean when he says that Git "never ever" tracks a file?
How to charge AirPods to keep battery healthy?
Are turbopumps lubricated?
What is this sharp, curved notch on my knife for?
Loose spokes after only a few rides
Can we generate random numbers using irrational numbers like π and e?
How to display lines in a file like ls displays files in a directory?
How to obtain a position of last non-zero element
How did passengers keep warm on sail ships?
Relation between PHP-FPM settings and mpm_worker (Apache)
The 2019 Stack Overflow Developer Survey Results Are InApache restart on every requestWhat is the meaning of “AH00485: scoreboard is full, not at MaxRequestWorkers”?nginx+apache2.4+php-fpm - SERVER[“REMOTE_ADDR”] and php_admin_valueTraffic increase causes VPS to crash due to RAM utilisationApache with Worker MPM AND php-fpmApache Causing High LoadHow to configure Apache “workers” for maximum concurrencyHow to figure out the optimum settings for Apache 2.4 PHP-FPM mpm_worker?Nginx With PHP FPM - Resource Temporarily Unavailable - 502 ErrorApache-PHP slow page in one virtual host causes performance degradation or timeout on other
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I've a site running Magento on the following setup:
- Apache 2.4 with mpm_worker
- PHP-FPM
- Total RAM in server: 14GB (10GB avilable to Apache/PHP)
Each PHP-FPM process consumes approximately 80MB of RAM.
I want to fine tune the settings for PHP-FPM and mpm_worker.
Reading in the documentation I'm a bit confused about the relation between options in PHP-FPM and mpm_worker.
E.g., PHP-FPM has configurations: pm.min_spare_servers
, pm.max_spare_servers
, pm.start_servers
and max_children
. I understand what these options mean with respect to PHP-FPM.
However, mpm_worker has the following configurations: MinSpareThreads
, MaxSpareThreads
, StartServers
and ThreadLimit
. Again, isolated to mpm_worker I understand what they do.
My question is: How does these configurations relate to each other? Let's say I set StartServers=2
and ThreadsPerChild=25
. This would give me 50 threads to begin with with respect to Apache/mpm_worker. If I then set pm.start_servers = 50
, PHP-FPM will spawn 50 processes initially.
So what is the relationship between these 50 "Apache" threads and 50 "PHP-FPM" processes? Does each Apache thread utilize one PHP-FPM process?
I hope someone can give some insight into this.
Thanks!
apache-2.2 php php-fpm apache-2.4 mpm-worker
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've a site running Magento on the following setup:
- Apache 2.4 with mpm_worker
- PHP-FPM
- Total RAM in server: 14GB (10GB avilable to Apache/PHP)
Each PHP-FPM process consumes approximately 80MB of RAM.
I want to fine tune the settings for PHP-FPM and mpm_worker.
Reading in the documentation I'm a bit confused about the relation between options in PHP-FPM and mpm_worker.
E.g., PHP-FPM has configurations: pm.min_spare_servers
, pm.max_spare_servers
, pm.start_servers
and max_children
. I understand what these options mean with respect to PHP-FPM.
However, mpm_worker has the following configurations: MinSpareThreads
, MaxSpareThreads
, StartServers
and ThreadLimit
. Again, isolated to mpm_worker I understand what they do.
My question is: How does these configurations relate to each other? Let's say I set StartServers=2
and ThreadsPerChild=25
. This would give me 50 threads to begin with with respect to Apache/mpm_worker. If I then set pm.start_servers = 50
, PHP-FPM will spawn 50 processes initially.
So what is the relationship between these 50 "Apache" threads and 50 "PHP-FPM" processes? Does each Apache thread utilize one PHP-FPM process?
I hope someone can give some insight into this.
Thanks!
apache-2.2 php php-fpm apache-2.4 mpm-worker
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I've a site running Magento on the following setup:
- Apache 2.4 with mpm_worker
- PHP-FPM
- Total RAM in server: 14GB (10GB avilable to Apache/PHP)
Each PHP-FPM process consumes approximately 80MB of RAM.
I want to fine tune the settings for PHP-FPM and mpm_worker.
Reading in the documentation I'm a bit confused about the relation between options in PHP-FPM and mpm_worker.
E.g., PHP-FPM has configurations: pm.min_spare_servers
, pm.max_spare_servers
, pm.start_servers
and max_children
. I understand what these options mean with respect to PHP-FPM.
However, mpm_worker has the following configurations: MinSpareThreads
, MaxSpareThreads
, StartServers
and ThreadLimit
. Again, isolated to mpm_worker I understand what they do.
My question is: How does these configurations relate to each other? Let's say I set StartServers=2
and ThreadsPerChild=25
. This would give me 50 threads to begin with with respect to Apache/mpm_worker. If I then set pm.start_servers = 50
, PHP-FPM will spawn 50 processes initially.
So what is the relationship between these 50 "Apache" threads and 50 "PHP-FPM" processes? Does each Apache thread utilize one PHP-FPM process?
I hope someone can give some insight into this.
Thanks!
apache-2.2 php php-fpm apache-2.4 mpm-worker
I've a site running Magento on the following setup:
- Apache 2.4 with mpm_worker
- PHP-FPM
- Total RAM in server: 14GB (10GB avilable to Apache/PHP)
Each PHP-FPM process consumes approximately 80MB of RAM.
I want to fine tune the settings for PHP-FPM and mpm_worker.
Reading in the documentation I'm a bit confused about the relation between options in PHP-FPM and mpm_worker.
E.g., PHP-FPM has configurations: pm.min_spare_servers
, pm.max_spare_servers
, pm.start_servers
and max_children
. I understand what these options mean with respect to PHP-FPM.
However, mpm_worker has the following configurations: MinSpareThreads
, MaxSpareThreads
, StartServers
and ThreadLimit
. Again, isolated to mpm_worker I understand what they do.
My question is: How does these configurations relate to each other? Let's say I set StartServers=2
and ThreadsPerChild=25
. This would give me 50 threads to begin with with respect to Apache/mpm_worker. If I then set pm.start_servers = 50
, PHP-FPM will spawn 50 processes initially.
So what is the relationship between these 50 "Apache" threads and 50 "PHP-FPM" processes? Does each Apache thread utilize one PHP-FPM process?
I hope someone can give some insight into this.
Thanks!
apache-2.2 php php-fpm apache-2.4 mpm-worker
apache-2.2 php php-fpm apache-2.4 mpm-worker
asked May 13 '14 at 19:05
JanCJanC
1234
1234
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 4 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The relationship is dynamically mapped. They are separate processes which can also be run under separate servers, thus you have plenty of configuration options.
Apache processes/threads handle initial connections which then use php-fpm processes to parse PHP files for returning requests.
There are a lot of variables in place here to advise you on how to configure which, but generally configure apache so it has enough threads to handle requests real-time and configure php-fpm so your PHP scripts/wensites have enough memory to run. With various possible caching options, this can only be decided by benchmarking a running system.
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
add a comment |
Apache serves the requests from the clients using the threads' childs, but it'll only call PHP-FPM for php files - images, css and js should be served directly from Apache, and thus not consume a PHP-FPM thread.
PHP-FPM has multiple threads with no childs - each thread serves a request from Apache.
AFAIK, multiple requests from the same client (loading the page, plus images, css and js) should consume multiple threads if you don't have KeepAlive set in Apache. See this link for more info on KeepAlive.
I've been tuning an Apache server myself recently and found out that if you have multiple cores it's better to increase the number of childs per thread.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f594869%2frelation-between-php-fpm-settings-and-mpm-worker-apache%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The relationship is dynamically mapped. They are separate processes which can also be run under separate servers, thus you have plenty of configuration options.
Apache processes/threads handle initial connections which then use php-fpm processes to parse PHP files for returning requests.
There are a lot of variables in place here to advise you on how to configure which, but generally configure apache so it has enough threads to handle requests real-time and configure php-fpm so your PHP scripts/wensites have enough memory to run. With various possible caching options, this can only be decided by benchmarking a running system.
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
add a comment |
The relationship is dynamically mapped. They are separate processes which can also be run under separate servers, thus you have plenty of configuration options.
Apache processes/threads handle initial connections which then use php-fpm processes to parse PHP files for returning requests.
There are a lot of variables in place here to advise you on how to configure which, but generally configure apache so it has enough threads to handle requests real-time and configure php-fpm so your PHP scripts/wensites have enough memory to run. With various possible caching options, this can only be decided by benchmarking a running system.
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
add a comment |
The relationship is dynamically mapped. They are separate processes which can also be run under separate servers, thus you have plenty of configuration options.
Apache processes/threads handle initial connections which then use php-fpm processes to parse PHP files for returning requests.
There are a lot of variables in place here to advise you on how to configure which, but generally configure apache so it has enough threads to handle requests real-time and configure php-fpm so your PHP scripts/wensites have enough memory to run. With various possible caching options, this can only be decided by benchmarking a running system.
The relationship is dynamically mapped. They are separate processes which can also be run under separate servers, thus you have plenty of configuration options.
Apache processes/threads handle initial connections which then use php-fpm processes to parse PHP files for returning requests.
There are a lot of variables in place here to advise you on how to configure which, but generally configure apache so it has enough threads to handle requests real-time and configure php-fpm so your PHP scripts/wensites have enough memory to run. With various possible caching options, this can only be decided by benchmarking a running system.
answered May 13 '14 at 19:53
phoopsphoops
1,77341423
1,77341423
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
add a comment |
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
So in my example, if I have 50 active concurrent connections to the webserver, Apache will be serving these connections with 50 threads, right? And each of these connections will require one PHP-FPM process? Thus, if I want to to be able to serve 50 concurrent users I need in total 50 Apache threads and 50 PHP-FPM processes ?
– JanC
May 14 '14 at 6:16
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
No you do not need a separate thread per user, nor apache threads map 1:1 to PHP-FPM threads.
– phoops
May 14 '14 at 7:00
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
As far as I can tell from the documentation, Apache uses a thread to serve each connection? So if I have 50 concurrent connections to Apache, and I want all of them to be served instantly (without waiting for a thread to become available), I would need 50 threads. Or am I missing something entirely?
– JanC
May 14 '14 at 9:29
add a comment |
Apache serves the requests from the clients using the threads' childs, but it'll only call PHP-FPM for php files - images, css and js should be served directly from Apache, and thus not consume a PHP-FPM thread.
PHP-FPM has multiple threads with no childs - each thread serves a request from Apache.
AFAIK, multiple requests from the same client (loading the page, plus images, css and js) should consume multiple threads if you don't have KeepAlive set in Apache. See this link for more info on KeepAlive.
I've been tuning an Apache server myself recently and found out that if you have multiple cores it's better to increase the number of childs per thread.
add a comment |
Apache serves the requests from the clients using the threads' childs, but it'll only call PHP-FPM for php files - images, css and js should be served directly from Apache, and thus not consume a PHP-FPM thread.
PHP-FPM has multiple threads with no childs - each thread serves a request from Apache.
AFAIK, multiple requests from the same client (loading the page, plus images, css and js) should consume multiple threads if you don't have KeepAlive set in Apache. See this link for more info on KeepAlive.
I've been tuning an Apache server myself recently and found out that if you have multiple cores it's better to increase the number of childs per thread.
add a comment |
Apache serves the requests from the clients using the threads' childs, but it'll only call PHP-FPM for php files - images, css and js should be served directly from Apache, and thus not consume a PHP-FPM thread.
PHP-FPM has multiple threads with no childs - each thread serves a request from Apache.
AFAIK, multiple requests from the same client (loading the page, plus images, css and js) should consume multiple threads if you don't have KeepAlive set in Apache. See this link for more info on KeepAlive.
I've been tuning an Apache server myself recently and found out that if you have multiple cores it's better to increase the number of childs per thread.
Apache serves the requests from the clients using the threads' childs, but it'll only call PHP-FPM for php files - images, css and js should be served directly from Apache, and thus not consume a PHP-FPM thread.
PHP-FPM has multiple threads with no childs - each thread serves a request from Apache.
AFAIK, multiple requests from the same client (loading the page, plus images, css and js) should consume multiple threads if you don't have KeepAlive set in Apache. See this link for more info on KeepAlive.
I've been tuning an Apache server myself recently and found out that if you have multiple cores it's better to increase the number of childs per thread.
answered May 23 '14 at 16:46
Daniel CostaDaniel Costa
8728
8728
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f594869%2frelation-between-php-fpm-settings-and-mpm-worker-apache%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown