?
Solved

Explain memory - cached, shared, buffers and free

Posted on 2011-03-20
5
Medium Priority
?
646 Views
Last Modified: 2012-05-11
Hi experts,

I have recently installed some server monitoring software on my web server which has the ability to send me various alerts. I can set the alert based on Cached, Shared, Buffers or Free but I have no idea which is most relevant. I'm guessing a combination of shared and buffers.

The server has 1.5GB ram and is hosting a website that is getting around 1000 visits a day but that is expected to increase steadily (or rapidly). In the last hour it has averaged

Cached: 1067MB
Shared: 226MB
Buffers: 76MB
Free: 107.22MB

What should I be looking out for?

Regards,
Michael
0
Comment
Question by:mstrelan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 12

Expert Comment

by:upanwar
ID: 35178476
0
 
LVL 10

Author Comment

by:mstrelan
ID: 35178535
Does not really help ... what I want to know is what sort of figures would be alarming. For example perhaps Shared should not exceed 1GB.
0
 
LVL 9

Expert Comment

by:Vampireofdarkness
ID: 35178538
My $0.02 would be to monitor free memory. In theory the cache will fill up until the memory it uses is required, then it'll start to clear the oldest information first.

Are you able to set a maximum cache size? What is the size of the content you are serving? How is your visitor load distributed (all between 6AM and 8AM, throughout the whole day, 6AM - 10PM, etc...)?
0
 
LVL 10

Author Comment

by:mstrelan
ID: 35195850
@Vampireofdarkness - if I understand correctly I should only be alarmed when free memory hits 0? In which case linux will start freeing up memory from cache anyway? I would have thought it would be good to monitor the amount of Shared memory, so I could be alarmed when it is using say 50% of the memory. And perhaps monitor swap space?
0
 
LVL 9

Accepted Solution

by:
Anton74 earned 2000 total points
ID: 35196034
The OS tries to make the most efficient use of RAM. It will use lots of RAM for cache if it can (meaning, if it's not otherwise needed), and with growing RAM demand it will be less, but normally never zero. Put somewhat differently, because unused (free) RAM is not useful until it is actually used, the OS will happily use it for cache rather than keep it free. Because of this, free memory is typically low; cache memory is easily and quickly freed as otherwise needed.

Between the numbers of cached/shared/buffers/free, shared and buffers tend to be a pretty low number and won't tell you much, so you'd want to focus on cached and free. Individually those won't tell you very much because free memory is almost always low as it'll be used for cache as explained above, but you can look at how much free memory you would have not considering cache - this is actually displayed on the second line. To really put this in useful perspective you have to compare to the amount of physical RAM you have. In your example, you have 1.5GB of RAM, and after subtracting cache and free memory only a few hundred MB is really used by programs (and the kernel), so you currently have plenty of RAM to spare.

The very best indicator of running low on RAM in my opinion is swap space usage. Very low swap usage is fine, but when it starts to become a significant amount (relative to the amount of physical RAM) it will affect performance. Nothing will kill performance like lack of RAM because it results in high swap file usage, and this tends to result in continuous disk activity (thrashing), grinding things to a halt.

To provide some rough percentages based on my opinion and experience (and the actual impact depends on the type of workload), swap file usage of about 5-10% of physical RAM means you are fairly moderately short on RAM, 20-30% it starts to get pretty noticeable and much above that it'll start to really hurt. Most OSs by default provide for something like 1 to 2 times the amount of RAM in swap space, but if you have anywhere close to that in actual swap usage, you probably won't have any performance left.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question