I am wondering why fastcgi isn’t using more memory… My machine has 12gb of ram and two 3mhz dual core processors, with CentOS5.2 & Virtualmin Pro.
To tune I used the Apache Benchmark (AB) and the top command to watch what could be tuned. The AB tests were done on on a page that has several hundred mysql queries, another words no static files. The parameters I used for all tests were:
ab -c20 -n1000 url
The first test results, with no tuning averaged out a measly 4.4 requests per second.
Then I modified httpd.conf and installed APC. That alone gave a 200% boost.
Running the test over. AB showed mysql was using a ton of the CPU and memory, so I added some parameters to my.cng, like query_cache_size and others that are commonly suggested. That gave an extra 30% boost. I was expecting more though.
Re-running the test, in the Top command there are several php-cgi threads. I then modified the PHP memory_limit in php.ini and /home/account/etc/php.ini. The memory_limit was set to 16M and I set it to 384M, just to see. That gave a small boost, still the Requests per second are slow compared to reports from other sysadmins who shared their tuning experience.
At this point I am not sure where to look further. It seems that php-cgi or fcgid somehow have a memory cap that php.ini files don’t control. I would like to throw more memory at PHP if possible. Any ideas on what might be causing this? See the attached screenshot of Top during an AB run.
With that much RAM, I might also consider bumping up the StartServers and MaxClients directives in your Apache config (but again, make sure you test all that, what will work best on your server depends on your setup and what sort of apps you have there).
-Eric
Also, if you go into Server Configuration -> Website Options, what is "PHP FCGId sub-processes" set to?
-Eric
Thanks Eric, I did test some of your suggestions but they didn’t really help. I found that my current setup seems to be running fine, I just wanted more memory to be used.
the 384 MB you gave PHP will only be used if needed. So I guess your application just don’t need more. I don’t know about any memory limit by fcgid though.
APC: Did you tune it to use a higher cache size? Don’t know though if APC works across many PHP instances run by fcgid. Visiting apc.php after running your tests may give you a number about how to tune it.