Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an EC2 small instance that has 2 gigs of memory, running Fedora Linux.

Typically, I get about 275 page views per day on average, and I have a monitoring agent on the box. Some of the stats are little worrying in terms of free memory.

Last week, at it's lowest point we had only 30 mb free of memory, this morning it appears to have increased to about 150 mb. Hyperic is our monitoring agent which runs Java. A top shows that its memory usages is only about 3.4%.

When I add up all of the httpd processes I get about 15-20% memory usage with mysql using about 1%.

Top doesn't reveal where the rest of the memory is going. What could I do to find out whats causing the high memory consumption? Could it be the 275 hits a day? About 95% of our code is PHP and HTML. MySQL is being used lightly from an application called OpenVBX which is only used internally.

If it's apache, an upgrade in memory should solve our issue right?

Any advice would be a huge help, thanks!

UPDATE: free shows this:

             total       used       free     shared    buffers     cached
Mem:       1718724    1575024     143700          0     234328     969284
-/+ buffers/cache:     371412    1347312
Swap:       917500       1140     916360
share|improve this question
1  
What does free actually say? The important line is the one that says "-/+ Buffers/Cache:" that shows how much is free when you don't count the filesystem cache as used. –  DerfK Mar 28 '11 at 16:23

2 Answers 2

up vote 4 down vote accepted

Basically you want to look at the free column of the buffers/cache row, so you have about 1.3G free -- you are probably in good shape.

The famous page for this "Help! Linux ate my Ram!" at http://www.linuxatemyram.com/ .

To put it very simply, Linux is going to use ram to cache files and the sort so it can deliver them faster. If a program really needs ram then it will take it from the cache -- but why not use the ram while it can?

share|improve this answer
    
Excellent thank you for clearing that up :) –  Doug Molineux Mar 28 '11 at 16:37

ps aux|less gives percentage of the memory used per process and might help a little.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.