The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Memory always going out the roof

Discussion in 'General Discussion' started by dev.null, Jun 21, 2005.

  1. dev.null

    dev.null Well-Known Member

    Joined:
    May 27, 2003
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    6
    I was (still am, transition off of) running cPanel on red hat with a P4 and 740 Meg of RAM.

    This box usually always ran using about 200 Meg of swap space, which evaluates to the system using about 1 Gig of memory (swap + RAM).

    So I built a new system a dual Xeon with 1500 Meg of ram. Should be more than enough. But it's not. It ends up eating into swap space until it's using about 2 Gig of memory (swap + RAM).

    So I increased the RAM to 2.5 Gig. Now it's still got 200 Meg of swap being used.

    It's almost as if apache/mysql/whoever sees there is more memory so it goes and uses more until it spills into the swap.

    Now, not all of the RAM is being used in each case, and more and more RAM is left open as I've given more and more RAM to it, and I understand the system will always have some in the swap after the system has been running for a little while, but there is another factor that shows the problem, the amount of active memory (actv in top).

    The 740M RAM machine only has 400M active at any time. The 1.5G machine always had 700-800M RAM active, the 2.5 always has 1.8G active. So this indicates the services running are *actively* using more memory (not just allocating the memory in case of a flood of "work" coming in).

    The number of processes running between these three is roughly the same, with the 750M machine actually running more (119/120) than the 2.5G box (97/98). So the heavier box is running fewer services that use more total memory than the lighter box.

    Any ideas? I'm wanting to tighten down on this server so that it's not such a hog, but not reduce it's effectiveness either.

    Thanks for any feedback.
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    There's a few potential issues here.

    The first is that Linux performs page caching when there is available RAM and will store pages in the cache for fast retrieval should they be reused instead of freeing them up. For this reason you should nearly always see that free RAM is low - if it's not, memory page caching probably isn't working properly. That said, you shouldn't be using much sawpfile space, unless you have old processes that have ben swapped out in the past (often happens on servers that have been up for a long time).

    Are you actually seeing high load averages? If not, there's probably no problem. If you are actually seeing high load averages with a lot of system and IOWAIT CPU usage, then you may well be running out of memory.

    Just remember that, generally, the amount of memory available for use is free+cache, not just free.

    It would be better if you posted the upper portion of top inside some forum CODE tags.
     
  3. dev.null

    dev.null Well-Known Member

    Joined:
    May 27, 2003
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    6
    Thanks for your help.

    This is what a current top looks like on the 2.5G server:

    Code:
     20:25:29  up 2 days, 17:03,  2 users,  load average: 0.47, 0.21, 0.11
    118 processes: 113 sleeping, 3 running, 2 zombie, 0 stopped
    CPU states:   0.7% user  15.0% system   0.0% nice   0.0% iowait  84.1% idle
    Mem:  2520928k av, 2486544k used,   34384k free,       0k shrd,  141828k buff
                       1822596k actv,  163572k in_d,   98960k in_c
    Swap: 2048276k av,  180280k used, 1867996k free                 1948440k cached
    And the 740M server:

    Code:
     20:43:45  up 5 days,  4:12,  1 user,  load average: 0.19, 0.18, 0.12
    105 processes: 103 sleeping, 2 running, 0 zombie, 0 stopped
    CPU states:   0.0% user   0.1% system   0.0% nice   0.0% iowait  99.8% idle
    Mem:   740032k av,  727256k used,   12776k free,       0k shrd,  105388k buff
                        491932k actv,       0k in_d,   14228k in_c
    Swap: 12289684k av,  124412k used, 12165272k free                  308360k cached
    It would be hard to give you the 1.5G server without taking the memory out of the 2.5 one...


    .
     
  4. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    To me, they both look fine. Most of the memory on the 2.5GB server is being used by the cache - which is good and means that the linux memory management is working well.

    The 750MB server looks a little more used because of the relative size of swap usage, but from the load average it would suggest that it's not memory thrashing (i.e. continually swapping out processes) and therefore coping fine from that snapshot.
     
  5. dev.null

    dev.null Well-Known Member

    Joined:
    May 27, 2003
    Messages:
    75
    Likes Received:
    1
    Trophy Points:
    6
    :) Thanks my friend! :)
     
Loading...

Share This Page