Results 1 to 19 of 19
  1. #1

    Server using up swap even with 800mb of ram left

    ok I need some help here.. is it normal for centos machine to be using up swap already even though there is 800000+k free ? My other machines tend to use up ram before touching the swap, but this machine functions different and use up swap even after I reboot it will be using a little bit of swap.

    Thanks
    GameWarrior.net - Bringing Gaming To The Next Level
    GamingMonkeys.com - Come Play Fun Flash Games !

  2. #2
    Join Date
    Apr 2003
    Location
    NC
    Posts
    3,080
    What kernel? Some kernels have had trouble with swapping go ahead and upgrade it if you can.
    John W, CISSP, C|EH
    MS Information Security and Assurance
    ITEagleEye.com - Server Administration and Security
    Yawig.com - Managed VPS and Dedicated Servers with VIP Service

  3. #3
    Join Date
    Jan 2004
    Location
    York, UK
    Posts
    371
    Could that 800Mb have been in use a few hours ago?

    If the OS starts using swap/pagefile space during a situation where there is a shortage of real RAM, if won't bother pulling the swapped-out pages back into real RAM as the memory is freed - it will wait until they are used again (which may be never - they could be "used" by a zombie process). Though it would be a faily major "something" to account for 800Mb! (a _massive_ file memory mapped at some point?, have you stopped/restarted and DB services recently?) - how much RAM does the machine have to start with?

    If performance isn't being affected then I wouldn't worry too much about it.
    It might be worth installing something like HotSaNiC to monitor memory usege over time to have a slightly better idea of what your server is doing when you are not looking.

  4. #4
    centos 4.2 default kernel... most updated from yum update.
    GameWarrior.net - Bringing Gaming To The Next Level
    GamingMonkeys.com - Come Play Fun Flash Games !

  5. #5
    Hello,

    Please see the ideal RAM/SWAP space combination if this helps.

    0.5 GB RAM 1 GB - 2 GB Swap Space
    1 GB RAM 2 GB - 3 GB Swap Space
    2 GB RAM 2 GB - 3 GB Swap Space
    3 GB RAM 3 GB Swap Space
    4 GB RAM 4 GB Swap Space
    8 GB RAM 4 GB Swap Space
    16 GB RAM 8 GB Swap Space

  6. #6
    I think the swap files is fine.. I also noticed I always constantly have issues with very high IOwait times and makes my machine all so slow. P4 3ghz, 1gb ram on Centos 4.2. I don't know whati s causing high IOwait times.
    GameWarrior.net - Bringing Gaming To The Next Level
    GamingMonkeys.com - Come Play Fun Flash Games !

  7. #7
    Join Date
    May 2005
    Location
    Bohemia, NY
    Posts
    61
    While I've never seen anything like this, it's very possible that there's patches to the RHEL/CentOS kernel that give priority to the system's disk cache over memory allocated to a sleeping process. If this specific issue doesn't actually affect your performance in a negative way, I wouldn't worry about it.
    Interkey.net Technical Support

  8. #8
    Join Date
    Jul 2005
    Posts
    256
    Yeah, it's perfectly ok for server to swap a bit even if you have plenty of RAM. That's how modern OSes work. Some processes are really never used (mingetty for example), and it's better to swap them and free up RAM for running processes or disk caching.

  9. #9
    I have a CentOS 4.2 fully updated to latest. I too am seeing a real failure on the performance of the "swapiness" of the latest kernel. I used to have the 2.6.9-11 kernel on CentOS4.1 and the mem cache and free memory were always used up. Now, I see TONS of free ram, no real use of the mem cache, and the swap is busy ALL the time (doing what I cannot say).

    I suggest to renegadeavenger to try this and observe:
    (do this when you have a small load and a good amount of free ram)

    1) open two shell sessions
    2) run "top" in one session
    3) run "swapoff -a" in the second window

    Now, be careful that the swap usage is not beyond what your free memory is at. You need to make sure that all free memory does not disappear or, without swap space you could be in trouble.

    What I have observed is that the IOwait times go straight to zero. Where normally, they are always around 4-5% with almost no usage. They jack straight up to 45-65% when busy. Again, the server performs, but it certainly performs with more "snappy" connections after I dump the swap space.

    This is a p4 2.8 HT running 2.6.9-22.0.1 smp w/1GB memory. Simple 80G SATA drive (could be the issue??). Running as a standard webserver (apache,sendmail,bind,mysql,vsftpd,dovecot).

    Also, I've tried recompiling the CentOS (rhel) kernel - what a mess. There could be an issue with this server, but I'm curious that someone else has the same issue.

  10. #10
    hey... I am using a sata hard drive as well..... I know it is not hardware, I got this machine replaced once already.
    GameWarrior.net - Bringing Gaming To The Next Level
    GamingMonkeys.com - Come Play Fun Flash Games !

  11. #11
    Join Date
    Oct 2004
    Posts
    294
    Did anybody solved this problem?

    I'm running 2.6.9.22 on CentOs 4.2. and have over 500 MB free Ram, but system uses SWAP. Also I have 50-60 % IOWAIT.

    Any solutions?

  12. #12
    I think it could be the kernel... not sure yet... hoping to get the kernel upgraded to see if it fixes it. I have the exact same problem as you though.
    GameWarrior.net - Bringing Gaming To The Next Level
    GamingMonkeys.com - Come Play Fun Flash Games !

  13. #13
    Join Date
    Oct 2004
    Posts
    294
    Please update this ticket after kernel upgrade.

    Tom

  14. #14

    having same problem

    same problem with same setup and hardware: p4 2.8 HT, 1GB ram, 80GB sata drive, CentOS 4.2, 2.6.9-22.0.1.ELsmp.

    i have some other machines that are the same except they have 2GB of ram and they don't seem to have any problems.

    i disabled swap on the box, but i'm still seeing high iowait times. free -m shows:

    total used free shared buffers cached
    Mem: 1001 339 661 0 1 12
    -/+ buffers/cache: 326 674
    Swap: 0 0 0

    the buffers/cache seem way too small. if i run iostat, i see:
    Linux 2.6.9-22.0.1.ELsmp (www) 12/02/2005

    avg-cpu: %user %nice %sys %iowait %idle
    6.43 0.00 8.86 13.47 71.23

    Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    sda 31.99 790.93 201.82 808662051 206341416

    basically, the disk is reading like crazy... now, compare this to a box that isn't having the problem:

    [[email protected] ~]$ free -m
    total used free shared buffers cached
    Mem: 2017 1197 819 0 34 576
    -/+ buffers/cache: 587 1430
    Swap: 996 0 996

    [[email protected] ~]$ iostat
    Linux 2.6.9-22.0.1.ELsmp (www2) 12/02/2005

    avg-cpu: %user %nice %sys %iowait %idle
    9.64 0.00 10.17 0.08 80.11

    Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
    sda 2.40 7.21 144.34 7928371 158647176

    so it seems like there's some bug somewhere that's causing all of that juicy memory to go unused. as a result, you start swapping but also you go to disk a lot more because the buffers/cache are basically empty. also interesting to note that there's 819MB free on the box that isn't having problems. shouldn't that memory be used for buffers/cache as well? seems like the problem exists on the 2GB box as well, it's just that it's not using so much memory that it's impacting it right now.

  15. #15
    Even when we turn the swap off, we still get a lot of iowait, with the kswapd0 still doing lots of work. It looks like the reported "cached" usage in top for the swap is still at about 50-70mb. Is there a way to turn this off also so that hopefully kswapd is doing nothing?

  16. #16
    Join Date
    Mar 2003
    Location
    California USA
    Posts
    13,290
    2.6.9-22.0.1 is a very buggy kernel. Some say downgrade but that is a very bad idea. the best thing to do is compile the latest 2.6 source and your problem should be fixed. This is a known issue with the kernel.
    Steven Ciaburri | Industry's Best Server Management - Rack911.com
    Software Auditing - 400+ Vulnerabilities Found - Quote @ https://www.RACK911Labs.com
    Fully Managed Dedicated Servers (Las Vegas, New York City, & Amsterdam) (AS62710)
    FreeBSD & Linux Server Management, Security Auditing, Server Optimization, PCI Compliance

  17. #17
    Join Date
    Jun 2003
    Location
    Calgary, Alberta
    Posts
    531
    There are a ton of problems with the latest kernel, it is very well documented on the CentOS forums about IOWait states, etc. being excessively high.

    We ended up downgrading to 4.1 as it's stable. Once they have the 4.2 issues resolved, we will simply update our CentOS repos to point to the latest version of 4.2 and run the update essentially taking us to 4.2...

    We have been on 4.1 for a long time now and have 0 issues with it...

    Cheers!

    /bin/false
    Jason (JC) Morris, Vice President - Technology
    TechWest Hosting - Enterprise Plesk & cPanel Hosting Since 2003!
    Shared & Reseller Hosting on Dell Quad Core 5420 Servers w/ RAID 10 in Multiple Datacenters!
    Ruby on Rails, FFMPEG, Fantastico, RVSiteBuilder, RVSkins, Nightly Off-site Backups, Clustered DNS!

  18. #18
    Join Date
    Jul 2002
    Location
    Kolding, Denmark
    Posts
    292
    We're running a single server on CentOS 4.2 (x86_64) and there seems to be no problem at all (kernel 2.6.9-22.0.1.ELsmp).

    Mem: 2055620k total, 1421916k used, 633704k free, 72976k buffers
    Swap: 1048568k total, 144k used, 1048424k free, 483944k cached

    The server isn't in production yet so it's not loaded at all but still - from what I understand the problem should occur pretty quickly. The server has a current uptime of 62 days.

    That's not to say that your problem isn't related to the kernel version but as others have mentioned you may also be looking at a runaway script that uses large amounts of RAM and forces a lot of stuff to be moved to swap for a short while.
    Best regards,

    Anders C. Madsen
    Golden Planet Support - http://www.goldenplanet.com

  19. #19
    Our problem definately wasn't run away scripts. 75% of our real ram never got used. Well we upgraded to 2.6.15 and every thing looks fine now. Only 2388k of swap used now and not 1 gig or so.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •