Answer the question
In order to leave comments, you need to log in
Is there any point in restarting Apache & Nginx by cron?
Now restarting the Apache2, Nginx and Mysql services helps to reduce the use of RAM by the server by about one and a half to two times.
So, is there any point in reloading the above demons by cron? Everywhere opinions differ on this issue, I would like to hear specific arguments for and against.
Thank you.
Answer the question
In order to leave comments, you need to log in
What is the memory doing?
And why are you trying to "reduce its consumption"? Do you feel sorry for her? Or is something else missing? If not enough - limit the number of processes for web servers and memory tweaks for the muscle. If there is enough and nothing falls from a lack of memory - do not touch anything, feed the dog. Linux will take up all the memory if you don't have openvz.
You can't do that.
Apache itself can restart child processes, the MaxRequestsPerChild parameter (see Google).
MySQL starts consuming more memory because when querying, some of the data gets into memory in order to respond faster next time. And memory consumption helps improve performance.
Nginx is a link between the internal processes of the server and users, it must work around the clock and therefore working with memory is very well developed there, look at the modules and config, maybe the problem is in some caches.
If memory consumption is growing day by day, then it is leaking somewhere. You have to look for leaks.
If the amount of memory increases to some limit and stabilizes, this is the normal operation of services and their cache. Restarting in this case will degrade performance.
Restart web server? I hope you do not have it in combat operation?
If you are in combat, then you are a desperate "admin" :))
Linux itself tries to use all available memory as efficiently as possible and do not be afraid that it shows that 98% is occupied, for example. You need to look at what exactly it is busy with, maybe it's a disk cache.
If it is busy with Apache, muscle and nginx processes, then you need to look at the configs and optimize them for a specific server and specific tasks / loads.
Giving more memory to mysql is also correct, the more tables are placed in RAM, the faster the database works. But, of course, at the same time, one must not forget to leave memory for other services.
There is such concept - server hiload. in order to be able to do this, you need to learn a lot and for a long time to configure and understand why and how this core, service, service, script works, and this is a lot of great experience. Good luck
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question