How to reduce memory usage per virtual server?

How to reduce memory usage per virtual server

  • On CentOS 5.8/Apache 2.2.3/FastCGI/PHP 5.3.10 virtual machine I have the original and a cloned Magento install (to be used as a staging server). I would like to minimize memory usage by apache and php on this staging server ONLY and I'm looking for recommendations on how to do this. For example, I want to know if its possible to set limits like prefork MPM/worker MPM on a single virtual server. PHP memory_limit is already set to 128M, as that is the minimum Magento needs to run. Thanks

  • Answer:

    Your memory limits need to be the same on your development/staging environment as on your live site - otherwise a script which works on one, will not work on another. So reducing any memory allocations would not be wise. If you are using the same server for both development and production stores - separation via VPS seems a little peculiar (if you are trying to keep memory overheads to a minimum) as you will encourage additional RAM usage simply to run a duplicate of every service? It would make more sense to run your staging site on the same VPS as your production store, running the PHP instance as another user that has specific limits set in /etc/security/limits.conf - then you can prevent runaway memory usage, number of processes and anything else. If you truly need resource and platform separation (ie. for PCI DSS compliance or even just best practice), then in your staging/dev VPS, simply set a maximum of 1 Apache thread. If you are the sole developer, there will only need to be one process/spawn running. But ultimately RAM is exceptionally cheap - just buy more. Don't constrain your application or try to run twice as much with half what you should have.

Gaia at Server Fault Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.