We have set-up apache to restart every day at 6am just to help out with memory loads on the server, this is configured in cron with systemctl restart httpd and it works well.

However we have noticed recently that when httpd restarts it is also performing a load of requests in our application, I wander if it is caching requests (perhaps requests that fail) and on restart it is running through those requests and causing things to happen in our application. But then that doesn't sound right so not really sure what could be going on.

Apache is sitting behind a Nginx proxy so not sure what affects anything, we are using Cent OS 7 and Apache 2.4 that was installed with yum I believe.

Any assistance appreciated. Thanks


Our application is a bit of an ancient behemoth in places so a mem leak could be possible, Something we wanted to know should apache free up memory once its finished and also free up the number of processes it has? At the moment at say 4am when no one is using the system the httpd process is consuming about 8GB of memory and 254 processes. It seems a bit excessive when no one is using it?

We did recently upgrade our server (which is a VM) to give it more RAM as it was continuously crashing and we want to try and prevent that in the future.

Thanks for the responses

  • 1
    Periodic restarts are not the way to deal with memory issues. Either add additional RAM or fix your application. – EEAA Sep 7 '16 at 12:47
  • @EEAA Just wanted to write the same. If memory usage piles up (memory leak) you are not properly releasing memory and should really fix your application. Other than that, some log data (e.g. /var/log/apache2/access.log and /var/log/apache2/error.log) and background information would be nice, e.g. what kind of application is it, what does it, which kind data is being sent? – Broco Sep 7 '16 at 12:52

I agree with the comments, fixing your application is the best solution, or adding memory if you are simply running out of resources and do not have a memory leak.

But it sounds like you may have a memory leak, and if so, you could try setting MaxConnectionsPerChild, https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxconnectionsperchild (MaxRequestsPerChild in Apache v2.2). Setting it low enough will cause Apache to recycle it's child processes more frequently thus preventing a memory leak build up and removing the need for a daily restart.

  • Our application is pretty old in various places so a memory leak could be possible. I will try that setting and see if it helps – Richard Bale Sep 8 '16 at 8:31

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.