top memory output used by cache and buffers is very high
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This is when the server is not being used to run any jobs. So if I look at the top output every row says %MEM is 0.0.
Right now the problem we are having is that when we run 5 jobs on the server the memory seems to be overloaded. I don't really understand why, because when I run a single process it shows memory usage to be something like maximum 3%. I also understand that so much memory is shown as used even though nothing is being run because of cache and buffers, but it seems like that memory isn't being relinquished to processes when they need it because we keep having memory overloads. Also having that much memory being marked as used because of cache and buffers seems excessive.
I would have hoped someone who would might have more detailed info. than I might, would have answered your question by now. But since they haven't, a few quick observations:
1) top says 291 processes total, but you have listed only a fraction of them; perhaps the memory usage on the hundreds of processes which are not shown, is more substantial.
2) I'm tempted to say that by default top sorts by CPU usage, not memory usage. If you haven't already, I'd suggest you tell top to sort by memory usage.
3) even though from what you've said you may have some awareness of this, it seems fair to say that Linux more or less uses a JIT ( Just In Time ) memory-reclamation algorithm; that almost can't be emphasized enough.
4) I can more or less understand the seeming contradiction from what you've said about running one process and seeing 3% maximum memory usage. But the top output could potentially be more intuitive if you make sure that you are having it sort by memory usage, and double check exactly what's included in the %MEM column on the specific distro. and version that you are using; for example, how does top contrast resident set size, virtual memory, etc., with %MEM?
5) If it's possible for you to reboot the machine, and run only one instance of the process that may be using a substantial amount of memory, with top sorting my memory usage, what is shown then?
(..) if I look at the top output every row says %MEM is 0.0.
Not so: PID 4163 of user "labfw" is consuming 11.5 GB RAM virtual memory, plus you don't tell us what the specs are of the other processes specs you try to run...
As the referenced (excellent!) web site makes clear, it is normal for Linux to use "the rest of" memory for cache and/or buffers.
It will do this, literally, "so that the RAM is always good for something." For instance, if you finish running a particular program, there's an excellent chance that you'll run the same program again very soon. So, Linux tries to keep it around. When you read a file sequentially, Linux anticipates this and reads more data than you requested this time, so that it won't have to perform another I/O operation next time.
But, when memory starts to become pressured, cache and buffers are "the low man on the totem-pole." As a discretionary use of memory, they get kicked-out to make memory available for mandatory use ("because some program is actually requesting it").
What's actually happening in your case is that you don't have enough RAM to run five instances of that big program at the same time. "Chips are Cheap" these days, so the first thing that you should do is to invest in "as much RAM as that mother(board) will hold."
Your observation that "cache and buffer usage is 'very high'," while true, is actually a red herring.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.