1

As apache creates a new thread on new client request. so I wanted to configure apache to create an only single thread so it will not be able to handle more than one request at a time.

What I have done

Changes in apache httpd-mpm.conf mpm_winnt_module module

<IfModule mpm_winnt_module>
    ThreadsPerChild        1
    MaxConnectionsPerChild   0
</IfModule>

Created a block.php which keep script sleep for 30 sec

<?php
    sleep(30);
    phpinfo();
    echo "Done";
?>

Created a hello.php which print hello

<?php
 echo "hello";
?>

Now what should be happening is when running block.php apache will create a new thread for it will take 30 sec to execute. In this 30sec the threads will busy. At the same time, if I run hello.php it should not run because I have configured apache to create only one thread so hello.php should not be executed at the same time it should wait for 30sec.

But this is not working as I am thinking, is there anything I am missing? I just wanted to understand apache multithreading behavior.

Aabid
  • 953
  • 5
  • 23
  • Not sure if this is accurate but if you're using PHP FPM then there's a good chance the connection is established to the webserver but then delegated to the FPM manager so apache only keeps it for a short while. – apokryfos Jan 21 '18 at 08:28
  • Look at an answer [like this one](https://stackoverflow.com/questions/3389496/how-do-you-increase-the-max-number-of-concurrent-connections-in-apache) and work in reverse. `MaxClients` looks important – Scuzzy Jan 21 '18 at 08:33
  • 1
    @Scuzzy i have set configuration ` ServerLimit 1 StartServers 1 MinSpareThreads 1 MaxSpareThreads 1 ThreadsPerChild 1 MaxRequestWorkers 1 MaxConnectionsPerChild 0 MaxClients 1 ` and now its working as expected thanks. – Aabid Jan 21 '18 at 09:28

0 Answers0