Why is Memory Usage always so high?

Discussion in 'Linux VPS/Dedicated - General' started by Jaxel, Nov 26, 2008.

  1. Jaxel

    Jaxel New Member

    I started with KnownHost a few months ago, and I noticed from the start that Memory Usage was always reported at 85-95% on cPanel... even before opened my website to the public, it was this high.

    http://www.8wayrun.com

    Anyway, the website runs GREAT... But we're about to get a whole bunch of advertising and I'm worried about how that will affect anything. Is it normal to have memory usage reported so high? Is there anything I can do to improve memory usage?

    I already asked KnownHost to go over my website and tell me if any of the scripts I run are against their terms of service, and thankfully they said I was fine... (I was afraid that flashchat may actually be against the rules) Server Load also varies greatly... but thankfully it never goes above 2.5... even with 43 people in flashchat at once!

    *EDIT*... I just turned off spam assassin since I dont use the email server...
    wow... memory usage dropped to 70%... nevermind, its back up to 95% now...

    Also... "cpsrvd" failed... but I can still access my cPanel... huh?
     
  2. Bryan

    Bryan Very Happy KH VPS User

    What plan are you using? I'm using the VPSxl and I don't think I've ever seen my memory usage above the high 40%. It normally sits in the high 30's, low 40's.

    What processes are shown to be using your memory?
     
  3. JasonF

    JasonF New Member

    I'm having the same problem. Is it possible to find out which pages/scripts are using the most resources?
     
  4. Jaxel

    Jaxel New Member

    I have a VPS-XL

    MySQLD is using 20%
    whostmgr2 is using 12%
    Then I have a whole bunch of httpd using 4-6% each

    I've never seen memory usage below 70%

    Right now its 3AM, and memory usage is 71%, with 0.12 server load.
     
  5. bdmorrison

    bdmorrison New Member

    I have/had httpd processes take all the RAM. Sites run fine, but control panel shows 100% RAM. I could go in and see what was taking it, kill the process, but it always comes back.

    If you figure out what is doing it on your box, maybe it'll fix it on mine. Post back results if you find anything.

    Thanks!
     
  6. Dan

    Dan Moderator

    Hello Jaxel,

    Spamassassin and ClamAV are both serious memory hogs, are you certain you disabled SA?

    In WHM under Tweak Settings there is a check box for SpamAssassin Spam Filter and in the Service Manager there are check boxes for enabling and monitoring spamd (you do not want either checked). There are also options for it in the Exim Configuration Editor.

    When your memory usage is high you can run the command
    Code:
    ps aufx > ps.txt 
    in SSH and it will create a file in the directory you are currently in named ps.txt. Take and attach it to a post here and we can take a look at it. You can delete the post from the server after doing this of course.
     
  7. Jaxel

    Jaxel New Member

    Okay... TODAY's CPU USAGE

    eightway8wayrun.com23.78162.511.2Top Process%CPU 17.0httpd [8wayrun.com] [/f5/the-official-nec9-results-thread-t1729/page7.html]Top Process%CPU 15.0httpd [8wayrun.com] [/f6/bad-habits-when-defending-against-pressure-rushdown-t14]Top Process%CPU 12.1httpd [8wayrun.com] [/w/images/4/49/T.gif]mysql1.1221.760.0Top Process%CPU 1.2/usr/sbin/mysqld --basedir/ --datadir/var/lib/mysql --usermysql --pid-file/var/lib/mysql/host.8wayrun.com.pid --skip-external-lockingTop Process%CPU 1.1/usr/sbin/mysqld --basedir/ --datadir/var/lib/mysql --usermysql --pid-file/var/lib/mysql/host.8wayrun.com.pid --skip-external-lockingnobody0.686.860.0Top Process%CPU 4.7[httpd] Top Process%CPU 3.3/usr/local/apache/bin/httpd -k start -DSSLTop Process%CPU 2.9/usr/local/apache/bin/httpd -k start -DSSLroot0.0121.311.9Top Process%CPU 1.0/usr/bin/perl /usr/local/cpanel/whostmgr/bin/dnsqueueeximstats0.000.001.0mailnull0.001.400.0mailman0.000.020.0unauthenticated0.000.000.2named0.001.800.0

    SERVER STATUS
    cpsrvdupServer Load1.07 (4 cpus)Memory Used99.8 %Swap Used0.00 %Disk /dev/vzfs (/) 28 %
     
  8. LeMarque

    LeMarque Member

    Don't want to hijack the thread, but, just to say and ask; I did disable Spamassassin months ago and strangely enough have not had a single "make your webhost BIGGER" email ever since. :rolleyes:

    But I did install ClamAV after receiving a virus in an email (kudos to Kaspersky). So, is there a better solution?
     
  9. Dan

    Dan Moderator

    Hello Jaxel,

    As difficult as this is to read I'm not seeing any problems with these numbers. I thought we were talking about memory usage though not CPU usage.

    Looking at your previous post I would say your site is very heavy on the database usage. Perhaps there are some optimizations you could make there.

    The whostmgr2 will not be in use when you are not logged in to WHM.

    And the httpd children it could be that some optimization that could be done there. Are you using mod_security with custom rules? I use only the core ruleset myself and when I did use a custom ruleset from elsewhere I saw memory usage for each child go over 8%. There may be code on your webpages that need optimizing. And search engines will very quickly cause memory usage to rise, you might want to look into using robots.txt to limit which ones can access your site since there are literally thousands of them out there and most of them do nothing but crawl for email addresses to add to their spam lists.

    Hi Lemarq,

    Unfortunately not so far as I know. It is not unusual to see clamd using 60-100MB of memory at all though. I actually have a script I run every 30 minutes to check the memory usage of clamd and my spam software and it restarts them if it gets too high. Sometimes it goes for days without a restart and others it restarts multiple times in a day, there's no rhyme or reason. Although I also do not use the cPanel install of clamav since it is so far between updates I just installed it manually and it works just the same.
     
  10. chaddro

    chaddro New Member

    Jaxel,

    If your running in the 70-80% without hitting the 90-100% wall, then I'd say your doing pretty well.

    I have a site that is vps-L that was constantly in the 90-100 range. Company site with 30 e-mails requiring spam assassin on cpanel. After many attempts at tweaking mysql and other settings, what finally worked was to simply up my memory to 384mb.

    I could restart the server an be at 40%, but then every bot on the planet would decide to crawl my site at the same time and there I'd be at 100% again. Now after the memory upgrade I rarely hit 80%.

    All the server tweaking in the world won't fix poorly written sql statements or code.

    You should also use the robots.txt file to set the rate at which the various bots are crawling your site. You may also want to watch which bots are crawling your site and deny the bogus ones (like email scanners).

    -cj
     

Share This Page