New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Apache is using too much memory.
I recently got a 1024MB RAM VPS and I installed httpd,php,mysql and got a small webserver running. Now I find out that the current memory usage is 334.87/1024 MB... Why is Apache using so much memory? How can I optimize it to use as less memory as possible? Thanks
Here's a screenshot of top.
Comments
http://www.linuxatemyram.com/
Apache is known to hog memory though. Switch to something else.
Switch to nginx + PHP-FPM
Add varnish in front of apache and u will see masive improvement.
If you want to use .htaccess rules: add nginx in front of Apache so that only dynamic content requests reach apache. Nginx has cache capabilities too, if you want to go that way and it's much easier to config. You could also use an Apache MPM version (Event or Worker) with PHP-FPM. Be sure to tune your FPM config.
IF you don't need .htaccess rules, go along with nginx & PHP-FPM and never look back.
You can try to limit the server limit and max clients in httpd.conf (prefork), the default:
Get the average httpd process using this:
and the MySQL memory usage:
Let say the average httpd process is 50MB and MySQL 100MB, and system resource eg. 100MB, so
So set the server limits and max clients to 16. This will prevent the use of swaps that will slow down the site loading.