LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   sync; echo 3 > /proc/sys/vm/drop_caches? (https://www.linuxquestions.org/questions/linux-server-73/sync%3B-echo-3-proc-sys-vm-drop_caches-4175506047/)

wstewart90 05-25-2014 01:01 PM

sync; echo 3 > /proc/sys/vm/drop_caches?
 
I'm pretty sure we all know that this is a bad idea on a production server as it would only cause the cpu load to go up looking for data on disk rather than in the cache and because cached memory frees itself up as applications need it, but at a current job I just started, the senior linux admin(23 years exp) seems to think it's necessary because our application doesn't free up the cache. I was under the impression that this was a kernel function rather than something that a java application has control of so I just need to hear from other experienced individuals if they've ever seen situations outside of benchmarking where dropping caches on a production server was necessary.

And I'm not talking about a situation where somebody decided to set vfs_cache_pressure to 0. I'm just trying to understand whether or not a java application or even a database taking up 80% of memory can cause cache memory to not free itself.

lleb 05-25-2014 08:38 PM

without much more info then you have provided are you hitting swap memory issues or performance issues? if either of those are NO, then id not stress over dropping cache, but it could also be a situation were swappy is not properly set for the server.

ive seen poorly designed applications not release memory even when the kernel is attempting to do so thus causing both performance and swap issues, see above.

in fact my last contract job was to support a very old out of date unsupported database combined with a modern DB that used a Java front end for the newer DB and some old hacked together version of display for the older one. On larger data bases (systems with more then 5000 records) the system could become unstable and a manual release of the cache was required or the customer were would just hard reset the locked system as they were in to much of a hurry to fill their next order *grins* either way it can happen.

syg00 05-25-2014 08:52 PM

When drop_caches was first introduced, there were situations where it did help - say after the nightly updatedb before it was made inotify aware. There have also been situations where there has been a leak in the buddy allocator that caused some of the caches (*not* page-cache that shows up under "cached" in free) to grow and never be released. Any reasonably current kernel should have been fixed.

So maybe it's historical - it helped (once ?) "back in the day", and nobody is going to risk not running it now.

As a general principle, it shouldn't be needed on a regular basis - and yes, it (page-cache usage) is not something user-space can directly affect.

lleb 05-25-2014 10:35 PM

syg00, good updated info. thank you.

wstewart90 05-26-2014 09:09 AM

We've got a few systems running fedora core 8 so maybe those are the situations where it's necessary. I believe fedora 8 is running the 2.6.23 kernel though which should have inotify built in.

lleb 05-26-2014 01:59 PM

um fedora 8 is so old and out of date it needs to be replaced and should never have been used as a server.

https://en.wikipedia.org/wiki/Fedora_(operating_system)

Quote:

8 Werewolf 2007-11-08 2009-01-07 2.6.23
so yes it is running 2.6.23, but its life cycle ended over 5 years ago.

wstewart90 06-01-2014 11:45 AM

I completely agree with you. This is the second place I've worked at running fedora 8. I guess it was new when they had the brilliant idea of designing their software to run on linux. I'm leaving this place for a better opportunity either way. I just wanted to know if there were any scenarios where dropping cached memory would make sense. Thanks for the responses.


All times are GMT -5. The time now is 06:16 AM.