1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

VPS memory load increasing over time

Discussion in 'Apache' started by alecs, Apr 25, 2009.

  1. #1
    I have a VPS with 384 MB RAM where I host some PHP sites with constant traffic. I don't have diggs or other kind of traffic spikes going on.

    Here is my problem: the memory used keeps increasing CONSTANTLY over a week or two, then the VPS gets slow and the hosting company does something to reset its memory back again. I'll attach a graph to see exactly what I mean.

    Is this my fault or the server (VPS) is not configured properly? I'm thinking that if this would be caused by my websites then there should be daily increases (for peak hours) not a constant one over an entire week.

    The VPS has a default LAMP setup and it is managed by the hosting company.
     

    Attached Files:

    alecs, Apr 25, 2009 IP
  2. axa

    axa Active Member

    Messages:
    915
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    60
    #2
    do you regularly add new content to your site (ex. daily) ?
     
    axa, Apr 25, 2009 IP
  3. webhost.uk.net

    webhost.uk.net Well-Known Member

    Messages:
    296
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    128
    #3
    The problem can also be regarding the mysql dead session related to some site.
    They might just be restarting services to reset things..
     
    webhost.uk.net, Apr 25, 2009 IP
  4. alecs

    alecs Well-Known Member

    Messages:
    156
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #4
    I don't add content daily. But the websites are dynamic so they get updated either by me or users.

    webhost.uk.net, can you please give me more details about the mysql dead session you were talking about?
    Regarding restarted services, Apache has been up and running throughout the memory usage drops visible in the graph. Whatever they do, is not about restarting the vps (or apache).
     
    alecs, Apr 25, 2009 IP
  5. sandeeppai

    sandeeppai Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Did you check which process is eating up the memory, do monitor it regularly and you should find it
     
    sandeeppai, Apr 25, 2009 IP
  6. starfall87

    starfall87 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I would look at your configuration concerning caching for php and mysql. They might be set up to use too much memory. Also consider whatever php optimizers you are using. Also check to see if apache, php, or mysql are leaking memory? What distro are you using? Have you checked for memory leak bug reports?
     
    starfall87, May 1, 2009 IP
  7. SSANZ

    SSANZ Peon

    Messages:
    861
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Did you forget that linux puts a lot of memory into buffers/cache?

    Get munin or hotsanic graphs on, check out how much is being buffered/cached.

    Is the VPS going into swap at all?
     
    SSANZ, May 2, 2009 IP
  8. Thibaut

    Thibaut Well-Known Member

    Messages:
    886
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    140
    #8
    You should have a memory leak somewhere, ie a daemon or any resident program that doesn't free your memory. Quiet common with Windows systems, unusual with Linux.
    Check every process you have (ps aux) to isolate the process consumming your memory and upgrade it to an earlier release.

    Hope this helps.

    Thibaut
     
    Thibaut, May 6, 2009 IP
    alecs likes this.
  9. starfall87

    starfall87 Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    At least with Linux, you should look around the bugs submitted for your distro. Often if there is a memory leak, not only will it be mentioned there but also there will be a work around for it.

    Good luck getting your problem solved, let us know how we can help.
     
    starfall87, May 10, 2009 IP
  10. Host Storm

    Host Storm Peon

    Messages:
    108
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I normally reset all of my Linux servers & VPS every 3 days to lower the load. It's amazing how much it helps. With the amount of RAM you have, your actually doing pretty well if your always getting traffic. Sometimes just restarting the server every night at midnight does a world of good and no one notices the 2 minutes of downtime.
     
    Host Storm, May 18, 2009 IP
  11. tsenseless

    tsenseless Active Member

    Messages:
    368
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    60
    #11
    As per the above posters...

    They are correct, there is a memory leak issue in one of your scripts. The most common place I typically find memory leaks are in poorly coded wordpress modules. If you're running any wordpress sites try fiddling with the plugins (disable/enable) until you can replicate the issue and discover which module is the culprit. There is a cache module floating around that everyone seems to use which ive found is notorious for memory leaks.

    How many sites are you hosting? It's a pain to hunt down this sort of issue.

    If you run the following command on a crontab timer it should correct the memory usage without needing to reboot the server or cause any downtime.

    /usr/sbin/apachectl graceful

    if it says 'command not found' then try

    apachectl graceful

    if it still says command not found, search around your system using whereis & locate to find the proper apachectl binary and run it with graceful as an option.
     
    tsenseless, May 19, 2009 IP
    alecs likes this.
  12. QuadraNet.Adam

    QuadraNet.Adam Active Member

    Messages:
    374
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    95
    #12
    If the following above don't work, then try Litespeed Web Server, it uses a lot less of memory.
     
    QuadraNet.Adam, May 28, 2009 IP
  13. alecs

    alecs Well-Known Member

    Messages:
    156
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    128
    #13
    Host Storm, I never thought of that. But seriously, I don't see a solution in reseting a server daily to fix this. After all, it's a server with linux, not a windows desktop.

    Thanks to everyone for their suggestions. Recently there was a hardware upgrade that affected my vps and since then the memory load has been at a constant 50%. It appears my problem was solved.
     
    alecs, Jun 11, 2009 IP
  14. Host Storm

    Host Storm Peon

    Messages:
    108
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Well thats good news, glad that it fixed its self. On the bright side my advice might help someone else.
     
    Host Storm, Jun 18, 2009 IP