We have an amazon ec2 small instance running and over the past few days we noticed that the memory is going down and down.

On the small instance, we are running apache and tomcat6 Tomcat is started with the following JVM parameters -Xms32m -Xmx128m -XX:PermSize=128m -XX:MaxPermSize=256m

We use nagios to monitor stuff like updates to apply, free disk space and memory. Everything else is behaving as expected but our memory is going down all the time. Our app receives approx half a million hits a day

When I shutdown apache and tomcat, and ran free -m, we had only 594mb of memory free out out of the 1.7gb of memory. Not much else is running on the small instance and when running the top command I cannot see where the memory is going.

The app we run on tomcat is a grails webapp. Could there be a possibility that there is a memory leak within our application?

I read online and folks say that a small amazon instance is perfect for running apach and tomcat. I found a few posts online that showed how to setup apache and tomcat to limit the memory usage and I have already performed those steps. The memory is not being used up as quick but the memory is still decreasing over time.

We have other amazone ec2 small instances running grails apps and the memory is fairly standard on those nodes. But they would not be receiving as much traffic

Just to add, when I run the top command on the problem server, I cannot see where all the memory is being used

Any help with this is greatly appreciated

The output of free -m when run on my server is as follows

         total       used       free     shared    buffers     cached
Mem:          1657       1380        277          0        158        773
-/+ buffers/cache:        447       1209
Swap:          895          0        895

In your opinion, does this look ok? At what stage would the OS give back memory, would it wait to the memory reaches 0% or is this OS dependent?

  • 3
    linuxatemyram.com ? – cjc Sep 30 '12 at 11:49
  • 3
    Show proof of work. Paste the output from free -m. – Michael Hampton Sep 30 '12 at 12:31
  • thanks guys, wasnt aware of that site linuxatemyam and also I just posted the results of free -m – Damo Sep 30 '12 at 13:46

Do mind that the operating system might be caching, this is not a problem if it is (look at the last column) memory used for caching is not really memory in use as in a process has it filled up with data. It is actually the OS that caches data that's used often. If the OS sees that memory is going low, it will automatically release the memory used for caching, if it sees there is free memory, it will use it to cache (so the response of your machine in general is quicker).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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