I understand that there is a comparison topic between the two modules but this is different.

I was contacting cPanel support in order to help me freeing up some memory usage on the VPS. They found Apache 2.4 'httpd' child processes are using approximately 80MB RSS, while on their test server, a similar Apache 2.4 build only uses approximately 3MB RSS per Apache child process.

After discussing the issue for a while, they suggested switching to the Worker MPM in Apache 2.4 rather than using Prefork.

I searched for what they said, and found that Worker MPM use a less memory but it is not thread safe. Some other topics on websites tell that Worker will not work with php applications or mod_php. I'm not sure if this is correct or not.

I'm too confused what should I do? I have php scripts running on my accounts and don't want to interrupt any of them or get data corrupted.

What are your suggestions guys? Does switching to Worker MPM will solve the problem of running out of memory without interrupting php applications?

Is there any solution regarding the Apache usage? As 80MB RSS is too high comparing to the 3MB RSS.

  • It's actually PHP, or certain PHP modules, which are not thread safe, creating problems when it is run on a multi-threaded apache. I believe there are some work arounds for that though -- using FastCGI instead of mod_php. Not sure what difference that will make to mem usage or performance, but you could try it. – goldilocks Dec 29 '13 at 14:20
  • 1
    Please stop casting close-votes on this one. This is pretty on topic here. – Nils Dec 29 '13 at 21:59

I'm giving you a link to quite a good explanation regarding Apache multi processing models and PHP

It is difficult to say what is best in your situation since it depends on many factors (are you a shared server, should apache runs as separate users depending on vhost, ). The link is to google's cached version of this page since their server is not working today. (www.binarytides.com/apache-mpm-php-server-api).

It is possible to set limits to the number of child processes being spawned and server limits, which will obviously limit the memory usage however could affect performance depending on your load. FastCGI might be the way to go, but you should also ask yourself, what is the 80MB RSS made up from, maybe the bulk of it is the PHP bit (libraries). It could possibly be useful to enable /server-status in the short term, to help you understand how apache is functioning with regard to server child/thread usage so that you can set lower limits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.