3

I recently just bought a dedicated server as an upgrade for a small community site from the shared hosting we have had for the last 3 years. I had installed httpd, php and mysql (the usuals for a webserver). I configured httpd for a few virtual hosts and installed webmin and cacti. Everything seemed to run pretty smooth until i noticed something off in the graph for the memory usage in cacti.

My server has 2gig RAM and for some reason 1.7gig of it was in use. I logged in as root through SSH and rebooted the server and then ran 'top'. Straight away it shot up to using 600meg RAM and kept slowly increasing but it didn't look anything was using the RAM. I ran 'ps aux'. But for some strange reason, it looks as if no running app is using over 2% ram. If i add up all the mem usage from 'ps aux' it comes out to about 20.6% which i would assume is close to 400meg RAM, this being when over 800meg RAM was in use.

So, it somewhat seems to me as if around 400meg of ram was being used where no application was claiming it. Over time, the memory slowly creeps up until it uses all available RAM. Though, i haven't let it get to that point yet.

I'm not really sure how to figure out what to do next to try and rectify the issue. Any help at all would be appreciated.

Memory usage graph from cacti: http://i56.tinypic.com/2wmhyzp.png

Output of 'ps aux' & 'free -o'

Let me know if any more information is needed.

2
  • ...this really should be a FAQ. Sep 27, 2010 at 3:03
  • I can't say i didn't look around. I looked for hours on end, but i never thought of kernel disk caching, it's... completely new to me. I tried wording my issue in many ways to see what google would come up with, but i never though of linux being the one to 'use' the memory. I really just thought it was httpd/php, despite top/ps not showing it as using much.
    – mNova
    Sep 27, 2010 at 8:59

2 Answers 2

6

First, check this page: Linux ate my RAM.

You haven't described any behavior that indicates a memory leak, at least none that I can percieve. As explained in the above page, the kernel will use free RAM as a disk read cache. Bytes allocated as cache will be freed up by the kernel immediately to any application that needs it.

Try running free instead of -o. When you do this, you will be provided a value of RAM available, taking into consideration of what is currently being used for cache. Here's some sample output from one of my servers:

user@host:~$ free
             total       used       free     shared    buffers     cached
Mem:        510652     430976      79676          0     134520     156876
-/+ buffers/cache:     139580     371072
Swap:       262136      40796     221340

See the -/+ buffers/cache line? The value in the free column reflects the actual amount of RAM that is available to your apps.

2
  • Oh wow, i had no idea the linux does that. That makes a lot of sense now that. When i did 'free' (without the -o), it shows that i have 380meg used in the buffers/cache section with 1.6gig actually free. So yeah, turns out i actually didn't have any memory issues at all. Thankyou very much ErikA, really appreciate it.
    – mNova
    Sep 27, 2010 at 0:39
  • You're welcome. Good luck!
    – EEAA
    Sep 27, 2010 at 0:39
0

Here is my Configuration:

IBM M3, Dual Quad Core, 8GB RAM, CentOS 5 x86_64.

We were running an application that was required to hold data in a vector and then drop it in a database. After running the application was a few days, we ran top and found that the memory utilisation was 99%+. This looked weird and I thought maybe CentOS 5 was using some kind of memory caching, but we could see a visible degradation in the performance of the server.

So I decided to run deep. We ran 2 terminal windows side by side to witness any evidence of bottlenecks. In one window we were printing data the speed/second our application was receiving the data and in the other window we ran a tcpdump trace for that particular port.

We found that the network card was running at an extremely high speed and was able to handle that data pretty well. but the Kernel was not able to take that data and give it to my application. The data would remain in a network queue and every 6-10 seconds, the application would receive a rush of data and it would drop again.

SOLUTION: Well I don't have anything for Cent OS 5. but we switched the OS to Fedora 14 x86_64. Memory utilisation was less than 1% and the kernel was able to process that data at extremely high speeds without any queueing. this is all I have and I don't know why CentOS didn't support this hardware architecture. our other CentOS installation works fine. But when we went for a dual multi core architecture, we hit this brick wall.

Hope this helps.

Thanks

Sid

1
  • Recommending moving from a server oriented release to a desktop oriented one is probably not the best solution for a server. With the number of differences between CentOS 5 (which was based on Fedora Core 6) and F14 there's no telling what fixed the problem.
    – Scott Pack
    Dec 5, 2012 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .