CentOS sucking down RAM



  • For some reason my Fog server (1.1.1) is just chewing through RAM. Currently it’s CentOS 6.5, and was only leaving with 120M free out of 8GB after being online for a while and receiving images and deploying only one. I went ahead and removed GDM so it’s headless, and it manages to creep up on the RAM still it seems.

    Short of the occasional reboot, not sure what to keep an eye on. Top (Sorted by memory) is useless and tells me it’s mostly all free anyway. I used [SIZE=14px][COLOR=#000000][FONT=Consolas]ps -e -o pid,vsz,comm= | sort -n -k 2 [/FONT][/COLOR][/SIZE] to figure out it was GDM as the big culprit, now I’m trying to narrow down the rest.



  • FWIW, I’ve found htop to be a lot more useful than top.


  • Senior Developer

    If you’re really worried about the usage, though, you could add a crontab to clean it all up for a small period of time.

    I use the crontab:
    [code]* * * * * sync; echo 3 >| /proc/sys/vm/drop_caches[/code]


  • Testers

    Hi Fhajad, you have nothing to worry about, the memory is all going to cached which is a good thing!

    Basically accessing memory is much faster than accessing disk so if there is memory not being used, the kernel will keep recently accessed files in there, this speeds up the system considerably. When you need that memory for a running process the caches are dropped automatically and your process is given the memory. The relevant numbers in your output are on the “-/+ buffers/cached” line, you have 437m used and 7305 “free”.

    This might explain better: [url]http://www.thomas-krenn.com/en/wiki/Linux_Page_Cache_Basics[/url]

    Incidentally the idea is similar to filesystems like btrfs and ZFS which use copy-on-write to turn “empty” space into something a bit more useful.



  • Here’s my output

    [CODE]-bash-4.1# free -m
    total used free shared buffers cached
    Mem: 7743 7616 126 0 18 7160
    -/+ buffers/cache: 437 7305
    Swap: 7887 0 7887
    -bash-4.1#
    [/CODE]


  • Testers

    What are your cached and buffer numbers though? e.g. in mine above the “free” should be 15111 + 47 + 406. I just rebooted that machine so it’s not a great example, here is a better one
    [CODE]
    free -m
    total used free shared buffers cached
    Mem: 7768 6726 1042 0 530 5136
    -/+ buffers/cache: 1058 6710

    Swap: 8191 56 8135
    [/CODE]
    My free for this machine would be 1042 + 530 + 5136 = 6708.



  • I only have an up time of 1 hour 39 minutes, but I only have 121 free also in free -m for comparison, 7621 used.


  • Testers

    I’m on RHEL 6.5 and I’m not seeing the same thing,
    [CODE]
    $ free -m
    total used free shared buffers cached
    Mem: 15947 835 15111 0 47 406
    -/+ buffers/cache: 381 15565

    Swap:        16383          0      16383
    

    [/CODE]

    What are you using to judge the free memory? Memory management in linux is quite complex. From memory, the kernel will regard any free space as available for caching, so with longer uptimes you will see little free memory, the actual memory available for applications is the sum of free, buffers and cached.


Log in to reply
 

412
Online

39.3k
Users

11.0k
Topics

104.6k
Posts

Looks like your connection to FOG Project was lost, please wait while we try to reconnect.