Results 1 to 13 of 13
  1. #1
    Join Date
    Jul 2005
    Posts
    598

    Running out of RAM and Processing power

    I have a client which run an active CMS and the server is utilizing the swap space at the moment. It is running on 6GB memory and a Xeon processor now. Is there anything that I could do before going for hardware upgrade? The apache and mysql keep exhausting the memory during peak hours.

  2. #2
    Join Date
    May 2009
    Location
    On a Speck!!!!!
    Posts
    216
    Can you paste the result of the "top -c" command here?

  3. #3
    Most modern CMS sytems are written carefully to close mysql connections after finishing with the clients request . And flushes that part of the work from the memory.
    mysql_close ()

    However some are not. But still this could be not related to Your problem.

  4. #4
    Join Date
    Jul 2005
    Posts
    598
    This is the top -c during off peak hours:-

    Code:
    top - 05:27:49 up  5:45,  1 user,  load average: 0.37, 0.39, 0.36
    Tasks: 116 total,   1 running, 115 sleeping,   0 stopped,   0 zombie
    Cpu(s): 23.3%us,  4.9%sy,  0.0%ni, 71.6%id,  0.2%wa,  0.0%hi,  0.0%si,  0.0%st
    Mem:   6126384k total,  5708844k used,   417540k free,    40972k buffers
    Swap:  6024248k total,     1528k used,  6022720k free,  3909616k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                
    20541 user    20   0  218m  36m 4480 S   42  0.6   0:31.44 /usr/sbin/apache2 -k start                                             
     2465 mysql     20   0  972m 248m 5120 S   39  4.2  24:30.47 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql -
    19760 user    20   0  229m  45m 4924 S   23  0.8   0:47.63 /usr/sbin/apache2 -k start                                             
    21931 user    20   0  218m  36m 4224 S    8  0.6   0:04.14 /usr/sbin/apache2 -k start
    This is the top during peak hours:-
    Code:
    top - 16:55:22 up 38 days, 12:36,  1 user,  load average: 52.51, 55.48, 31.08
    Tasks: 234 total,   2 running, 232 sleeping,   0 stopped,   0 zombie
    Cpu(s):  2.1%us, 21.6%sy,  0.0%ni,  0.1%id, 75.3%wa,  0.1%hi,  0.8%si,  0.0%st
    Mem:   6126384k total,  6090564k used,    35820k free,     4256k buffers
    Swap:  6024248k total,  2253772k used,  3770476k free,    71060k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                
     7066 user    20   0  217m  14m 4088 S    5  0.2   0:04.30 apache2                                                                
     7621 user    20   0  217m  34m 4020 D    5  0.6   0:01.80 apache2                                                                
     7886 user    20   0  191m 7848 2948 D    5  0.1   0:00.34 apache2                                                                
     7891 user    20   0  191m 8056 3084 D    5  0.1   0:00.38 apache2                                                                
     7064 user    20   0  217m  13m 4092 D    4  0.2   0:03.28 apache2                                                                
     7538 user    20   0  216m  28m 4096 D    3  0.5   0:01.84 apache2                                                                
     7869 user    20   0  216m  34m 4064 D    3  0.6   0:00.86 apache2                                                                
    13971 mysql     20   0 1419m 394m 2720 S    3  6.6   2554:36 mysqld                                                                 
     7638 user    20   0  237m  27m 3676 D    3  0.5   0:01.48 apache2                                                                
     7894 user    20   0  190m 6668 2860 D    3  0.1   0:00.18 apache2                                                                
     3630 user    20   0  217m  34m 4128 S    2  0.6   0:13.16 apache2                                                                
     3633 user    20   0  217m  33m 4144 D    2  0.6   0:17.54 apache2                                                                
     5200 user    20   0  217m  34m 4144 D    2  0.6   0:15.52 apache2                                                                
     7619 user    20   0  233m  50m 4016 D    2  0.8   0:02.70 apache2                                                                
     4008 user    20   0  239m  37m 4136 D    1  0.6   0:10.30 apache2                                                                
     7539 user    20   0  238m  54m 4000 D    1  0.9   0:01.96 apache2                                                                
     7605 user    20   0  239m  23m 3776 D    1  0.4   0:01.62 apache2                                                                
     7892 user    20   0  190m 6520 3080 D    1  0.1   0:00.16 apache2
    What that is bothering me now is the apache process is hogging the process for quite long with a lot of CPU power. What could I do as I am not the developer of the CMS? Does adding a second Xeon would improve this issue?
    Last edited by Tomcatf14; 07-23-2009 at 05:35 PM.

  5. #5
    Join Date
    Jan 2005
    Posts
    2,203
    Look into replacing Apache with a lightweight web server such as litespeed or nginx. If the person is using Cpanel, the former would be a better solution. Apache is known to use a lot of memory per process. Based on your top, it ranges from 13M to 54M.
    Last edited by HD Fanatic; 07-23-2009 at 08:05 PM.

  6. #6
    Join Date
    Nov 2003
    Location
    Toronto, Ontario
    Posts
    651
    You should consider splitting your database off onto a dedicated machine with faster disks, or switch over to something like mosso or any other clustered system.

    You are definitely facing an issue with disk performance, but its unclear if its a result of the swapping, or are you swapping because you cannot keep up which resulted in spawning so many childern etc.

    litespeed is awesome and I would definetly recommend it over apache, it will help to some degree without a doubt.
    Kevin

  7. #7
    Additional processors will not solve your problem. Ultimately your best option would be to add additional hardware and move your database off of your application server. A second best option would be to add additional RAM to your server. Finally before going and replacing your web server with another, check that MySQL and Apache have been tuned. From looking at your memory usage, it is clear that Apache has not been tuned. Check out this page. Also check your MaxRequestsPerChild and ensure it is not set to some low number like 0. I would recommend somewhere between 500 and 1000.

    A good portion of your high disk i/o is probably caused by the swapping which is in turn caused by running out of RAM. There may not be much you can do to fix the amount of RAM MySQL is using but a bit of tuning on Apache can go a long way.
    ZZ Servers - Business Hosting, HIPAA and PCI Compliant Hosting Solutions - http://www.zzservers.com
    Xen Virtual Private Servers | Dedicated Servers | Shared Hosting
    Custom configurations, firewall, VPN, load balancers, private networks and more.

  8. #8
    Join Date
    Mar 2009
    Posts
    254
    Post a my.cnf here. Its rather strange that such a site could consume all your resources. In addition, I would recommend getting faster disks for your server.

  9. #9
    Join Date
    Jul 2005
    Posts
    598
    Quote Originally Posted by lemeneid View Post
    Post a my.cnf here. Its rather strange that such a site could consume all your resources. In addition, I would recommend getting faster disks for your server.
    Code:
    key_buffer              = 32M
    max_allowed_packet      = 32M
    thread_stack            = 256K
    thread_cache_size       = 8
    myisam-recover          = BACKUP
    #max_connections        = 100
    #table_cache            = 64
    #thread_concurrency     = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit       = 6M
    query_cache_size        = 512M

    What is a proper way to check the disk I/O problem?

  10. #10
    Join Date
    Jul 2005
    Posts
    598
    This is the result from the iostat, is this too slow or just right for SATA RAID1 drive?

    Code:
    iostat 
    Linux 2.6.26-2-amd64 (xx)       07/28/2009      _x86_64_
    
    avg-cpu:  %user   %nice %system %iowait  %steal   %idle
              18.81    0.00    2.19    1.21    0.00   77.80
    
    Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
    sda              18.51       716.67       937.61  288349436  377242616
    sda1             18.00       710.60       917.97  285906040  369341024
    sda2              0.00         0.00         0.00          4          0
    sda5              0.51         6.07        19.64    2443080    7901592
    sdb              17.74       600.18       937.61  241478974  377242616
    sdb1             17.25       594.37       917.97  239140706  369341024
    sdb2              0.00         0.00         0.00          4          0
    sdb5              0.49         5.81        19.64    2338000    7901592
    md0             131.37      1304.96       908.39  525045650  365486016
    md1               3.94        11.88        19.63    4780720    7898872

  11. #11
    Join Date
    Jul 2009
    Posts
    178
    use strace <pid> when the cms runs check which all plugins it is accessing and this will help you resolve this issue.

  12. #12
    Join Date
    Apr 2009
    Location
    Western New York
    Posts
    34
    I configured a vps server that runs apache to handle a little under 25,000 hits per hour once, it still runs fairly well. I use preforks to do this, it keeps apache within line.

    If apache finds its responding to way too many requests, it will just load a temporarily busy error or something to that effect. I haven't heard a complaint.

    I wrote a guide about this once, maybe it might help:
    Optimizing Apache on WHM/Cpanel
    Philip Matuskiewicz
    Univ at Buffalo Computer Science Student
    My Hosting Company Site / My Personal Site

  13. #13
    Join Date
    Mar 2009
    Location
    Israel
    Posts
    1,212
    anything shows in /var/log/messages about issues?
    look for kernel messages, this could be more then pure hardware issues.
    also check out the error_log for your apache.

    a badly written script / sql syntax could cause these loads also.

Similar Threads

  1. VPN - What kind of processing power and RAM is needed?
    By mrzippy in forum Hosting Security and Technology
    Replies: 1
    Last Post: 09-24-2007, 04:40 AM
  2. Processing Power!?
    By Mekhu in forum Dedicated Server
    Replies: 1
    Last Post: 12-22-2006, 01:10 PM
  3. Power VPS order processing
    By adrianus in forum VPS Hosting
    Replies: 19
    Last Post: 03-29-2005, 10:58 AM
  4. Server for running Paypal like payment processing service
    By Maxo in forum Hosting Security and Technology
    Replies: 5
    Last Post: 10-06-2004, 11:53 AM
  5. how to report site running unsecure CC processing?
    By hassi in forum Hosting Security and Technology
    Replies: 18
    Last Post: 05-19-2003, 01:23 PM

Posting Permissions

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