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;








3















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!










share|improve this question














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.





















    3















    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!










    share|improve this question














    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.

















      3












      3








      3








      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!










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      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.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          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.






          share|improve this answer























          • 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


















          0














          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.






          share|improve this answer























            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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.






            share|improve this answer























            • 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















            0














            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.






            share|improve this answer























            • 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













            0












            0








            0







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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













            0














            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.






            share|improve this answer



























              0














              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.






              share|improve this answer

























                0












                0








                0







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered May 23 '14 at 16:46









                Daniel CostaDaniel Costa

                8728




                8728



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    How to make RAID controller rescan devices The 2019 Stack Overflow Developer Survey Results Are InLSI MegaRAID SAS 9261-8i: Disk isn't recognized after replacementHow to monitor the hard disk status behind Dell PERC H710 Raid Controller with CentOS 6?LSI MegaRAID - Recreate missing RAID 1 arrayext. 2-bay USB-Drive with RAID: btrfs RAID vs built-in RAIDInvalid SAS topologyDoes enabling JBOD mode on LSI based controllers affect existing logical disks/arrays?Why is there a shift between the WWN reported from the controller and the Linux system?Optimal RAID 6+0 Setup for 40+ 4TB DisksAccidental SAS cable removal

                    Куамањотепек (Чилапа де Алварез) Садржај Становништво Види још Референце Спољашње везе Мени за навигацију17°19′47″N 99°1′51″W / 17.32972° СГШ; 99.03083° ЗГД / 17.32972; -99.0308317°19′47″N 99°1′51″W / 17.32972° СГШ; 99.03083° ЗГД / 17.32972; -99.030838877656„Instituto Nacional de Estadística y Geografía”„The GeoNames geographical database”Мексичка насељапроширитиуу

                    Can the Right Ascension and Argument of Perigee of a spacecraft's orbit keep varying by themselves with time? The 2019 Stack Overflow Developer Survey Results Are InHow is the altitude of a satellite defined, given that the Earth is not spherical?Why do satellites appear to move faster when overhead and slower closer to the horizon?For the mathematical relationship between J2 (km^5/s^2) and dimensionless J2 - which one is derived from the other?Why is Nodal precession affected by the rotational period of the planet?Why is it so difficult to predict the exact reentry location and time of a very low earth orbit object?Why are low earth orbit satellites not visible from the same place all the time?Perifocal coordinates and the orbit equationHow feasible is the Moonspike mission?What was the typical perigee after a shuttle de-orbit burn?I am having trouble calculating my classic orbital elements and am at a loss on where to lookAm I supposed to modify the gravitational constant with scale and why do fps & time scale changes cause my orbit to break?How Local time of a sun synchronous orbit is related to Right ascension of ascending node?What is wrong with my orbit sim equations? How can I fix them?How to obtain the initial positions and velocities of an inclined orbit?