0

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

2
  • You might reduce the memory usage by swithcing from Apache to nginx.
    – pkhamre
    Apr 18, 2012 at 17:28
  • One method may be to run two copies of apache/fastcgi. Allowing you to reduce the min servers and spare servers for the staging environment ( plus tweaks to fastcgi ). Apr 18, 2012 at 17:34

1 Answer 1

2

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.

2
  • I am running the staging site on the same VPS as your production store, but eventually I want to run it on a duplicate VPS. That is the only way I can test LAMP stack upgrades without damaging the production store. I will check into /etc/security/limits.conf for now. Thanks!
    – Gaia
    Apr 24, 2012 at 20:04
  • In that case, just wait until you've got another VPS - they are cheap enough :) Apr 25, 2012 at 14:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .