0

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
Doug Molineux
  • 413
  • 3
  • 7
  • 17
  • 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 Answers2

4

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?

Kyle Brandt
  • 82,107
  • 71
  • 302
  • 444
1

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

Jonathan Ross
  • 2,173
  • 11
  • 14