WEB how does linux manage memory?

Discussion in 'OT Technology' started by drpepper, Oct 22, 2007.

  1. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    does it keep using it even if it doesnt needed it? this might be a stupid question but i honestly dont know.

    i read somwhere that a server running linux will use the memory to its fullest extent and just 'release' it to programs that need it.

    im just wondering why my server is reading high memory usage but it doesnt seem slow.
     
  2. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    this is what i get with the free command

    Code:
    -sh-3.1$ free
                 total       used       free     shared    buffers     cached
    Mem:        506908     500672       6236          0       2856     143868
    -/+ buffers/cache:     353948     152960
    Swap:      2096632        100    2096532
     
  3. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,922
    Likes Received:
    11
    Location:
    Los Angeles
    One reason: disk cache.
     
  4. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    awesome details, turtlewax
     
  5. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,922
    Likes Received:
    11
    Location:
    Los Angeles
    :rofl:

    :love:

    Memory usage in Linux is obviously a bit different than a Windows machine. So, when you look at high memory usage, you usually panic. But on a linux machine, it's really not all that bad, and you're actually benefiting from it instead.

    To keep it short, you shouldn't really have to worry about or pay attention to the free memory on your linux box. The linux kernel keeps your disk cache as large as possible for speed accessibility and response time.
     
  6. drpepper

    drpepper Active Member

    Joined:
    Nov 13, 2006
    Messages:
    38,076
    Likes Received:
    2
    Location:
    San Antonio
    :cool:

    thanks broseidon.
     
  7. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,922
    Likes Received:
    11
    Location:
    Los Angeles
    If you need a more detailed explanation do a search, there's a shit ton of articles based specifically off this question.
     
  8. RaginBajin

    RaginBajin Have you punched a donkey today?

    Joined:
    Dec 24, 2001
    Messages:
    8,740
    Likes Received:
    0
    Location:
    NoVA
    What Kingtoad said.. Basically anything after kernel 2.4, you will see a lot more "used" memory. The biggest thing if you are concerned about memory usage is to watch your swap. If you start to see a lot of usage in the swap category, then you probably are running out of memory and need to start investigating what is going on with your processes.
     
  9. ba3698

    ba3698 New Member

    Joined:
    Feb 23, 2005
    Messages:
    19,029
    Likes Received:
    0
    So this is ok?

    [​IMG]
     
  10. vincentfasho

    vincentfasho New Member

    Joined:
    Jun 17, 2004
    Messages:
    1,322
    Likes Received:
    0
    Location:
    Houston
    If you're using a SSH terminal, try typing in "top cd1" and it will show you all active processes, which are using most memory and cpu usage as well as memory swap and how much memory is free per second.

    as far as memory in linux or a webserver, it is in an as-needed basis, when the program or php file, whatever.. is executed, then it will allolcate the memory, but a php.ini can throttle the max amount of memory used on a script or file via "memory_limit" within php.ini. if it goes over, the script or file will error out and give you an allocation exhausted error
     

Share This Page