Help required fine tunning apache
I am using a 2GB Linode and I need some assistance in fine tunning the apache application. The server is installed with an open source CRM Application called CiviCRM and MySQL is installed on a different server.
This web application will be used by about 1000 users to to begin with and may scale depending on performance and usage.
Can anyone help me fine tune the apache application for this kind of requirement so that i can make best use of the hardware and application itself.
Thanks a lot.
Avinash
9 Replies
turn off KeepAlive:
KeepAlive Off
"prefork" is default variant, so find "IfModule mpmpreforkmodule" string and edit block:
<ifmodule mpm_prefork_module="">StartServers 3
MinSpareServers 3
MaxSpareServers 5
MaxClients 85
MaxRequestsPerChild 4000</ifmodule>
"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).
For PHP: install APC.
If you can find good instruction - install nginx in front of apache.
Thanks so much.
Few clarifications. If I am understanding correctly, does MaxClients value indicate the number of concurrent users using the web service?
This is the prefork module in my httpd.conf. I didn't find apache2.conf file.
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
Also, you have mentioned you will have (2048M - 1700M) free memory for cachers, as minimum) how is this possible, cox, I have only 2GB RAM on my server.
What is APC?
Apologies for my very basic questions.
Avinash
@OZ:
in file /etc/apache2/apache2.conf:
turn off KeepAlive:
KeepAlive Off
"prefork" is default variant, so find "IfModule mpmpreforkmodule" string and edit block:
<ifmodule mpm_prefork_module="">StartServers 3 MinSpareServers 3 MaxSpareServers 5 MaxClients 85 MaxRequestsPerChild 4000</ifmodule>
"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).
For PHP: install APC.
If you can find good instruction - install nginx in front of apache.
@Avinash.Rao:
This is the prefork module in my httpd.conf. I didn't find apache2.conf file.
I just don't know your OS. Anyway, params are identical in both files, so you can see which numbers you can change.
@Avinash.Rao:
Also, you have mentioned you will have (2048M - 1700M) free memory for cachers, as minimum) how is this possible, cox, I have only 2GB RAM on my server.
(2048M - 1700M) = 348M of memory. It was expanded just to illustrate.
@Avinash.Rao:
What is APC?
http://php.net/manual/en/book.apc.php
Thanks again.
@OZ:
@Avinash.Rao:This is the prefork module in my httpd.conf. I didn't find apache2.conf file.
I just don't know your OS. Anyway, params are identical in both files, so you can see which numbers you can change.
@Avinash.Rao:Also, you have mentioned you will have (2048M - 1700M) free memory for cachers, as minimum) how is this possible, cox, I have only 2GB RAM on my server.
(2048M - 1700M) = 348M of memory. It was expanded just to illustrate.
@Avinash.Rao:What is APC?
http://php.net/manual/en/book.apc.php
I have studied the Apache Performance Tuning at
I have a rough idea of how this works but am yet to understand it completely.
The application is open for about 10,000 users and I am expecting about 350 concurrent users when the application is released. How do i configure apache for this kind of a requirement. I have also upgraded the server to 4GB RAM.
Thanks.
@OZ:
in file /etc/apache2/apache2.conf:
turn off KeepAlive:
KeepAlive Off
"prefork" is default variant, so find "IfModule mpmpreforkmodule" string and edit block:
<ifmodule mpm_prefork_module="">StartServers 3 MinSpareServers 3 MaxSpareServers 5 MaxClients 85 MaxRequestsPerChild 4000</ifmodule>
"MaxClients 85" - assuming each PHP process takes ~20M of memory, 85 * 20M = 1700M (so you will have (2048M - 1700M) free memory for cachers, as minimum).
For PHP: install APC.
If you can find good instruction - install nginx in front of apache.
@AlexC:
It depends on how you're running PHP. For example, if you're running PHP-FPM then configuring Apache is not really where you want to be looking because Apache isn't going to be handling the PHP processes.
Maybe if you told us your setup then we'd be able to give better advise.
What apache MPM are you running?
(run apache2ctl -M | grep mpm to find out)
How are you running php? FPM/Fastcgi/Apache2/CGI(hopefully not)
I couldn't find apache2ctl -M command, its apachectl (without the 2). First few lines of the output..
Loaded Modules:
core_module (static)
mpmpreforkmodule (static)
http_module (static)
so_module (static)
authbasicmodule (shared)
authdigestmodule (shared)
authnfilemodule (shared)
authnaliasmodule (shared)
authnanonmodule (shared)
authndbmmodule (shared)
authndefaultmodule (shared)
authzhostmodule (shared)
authzusermodule (shared)
@obs:
If apache isn't handling PHP requests then it's memory usage will be considerably lower all it will be doing is handling static files (and in this case I'd switch to mpm-worker over prefork since it's threaded and will use less memory).
Maybe if you told us your setup then we'd be able to give better advise.
What apache MPM are you running?
(run apache2ctl -M | grep mpm to find out)
How are you running php? FPM/Fastcgi/Apache2/CGI(hopefully not)