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.

How To Optimize VPS ?

Discussion in 'Workarounds and Optimization' started by Muhammad_1, Apr 27, 2011.

  1. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello Cpanel Team and Respectable Members,

    My website PINDITUBE | Pakistan Fastest Growing TV Program Videos Library with Wordpress CMS Run on VPS
    My VPS Specification is
    Total processors: 2
    Processor #1
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5506 @ 2.13GHz
    Speed
    800.049 MHz
    Cache
    4096 KB
    Processor #2
    Vendor
    GenuineIntel
    Name
    Intel(R) Xeon(R) CPU E5506 @ 2.13GHz
    Speed
    800.049 MHz
    Cache
    4096 KB

    And ram is 2GB Dedicated and 2 GB SWAP
    With 80 GB HDD ,

    Problem is Website Load too much Slow ,i Have average Traffic is only 10000 ,
    Can any one help me Step by Step how to Solve Website Loading issue
    i have no experience
    Regards
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What is your PHP handler? You can grab that information from WHM > Apache Configuration > PHP and SuExec Configuration area.

    Next, what are the current uptime and sar details for your machine to see the load and other details? You'd simply run "uptime" and "sar" commands in root SSH and paste that information.

    What are your Apache settings for MaxClients, ServerLimit, etc? You can grab those from WHM > Apache Configuration > Global Configuration area.
     
  3. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello
    This Information is Listed Below
    Default PHP Version (.php files) 5
    PHP 5 Handler suphp
    PHP 4 Handler none

    Apache suEXEC on
     
  4. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello
    our settings have been saved.

    The values are:

    keepalivetimeout 6
    maxrequestsperchild 4000
    traceenable On
    fileetag All
    serversignature Off
    keepalive On
    minspareservers 5
    maxclients 512
    startservers 8
    servertokens Full
    maxkeepaliverequests 100
    sslciphersuite ALL:!ADH:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
    root_options ExecCGI FollowSymLinks Includes IncludesNOEXEC Indexes -MultiViews SymLinksIfOwnerMatch
    serverlimit 512
    timeout 30
    maxspareservers 10



    and Server uptime is
    erver Version: Apache/2.2.16 (Unix) mod_ssl/2.2.16 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_bwlimited/1.4
    Server Built: Sep 3 2010 08:28:58
    Current Time: Wednesday, 27-Apr-2011 13:54:11 MDT
    Restart Time: Wednesday, 27-Apr-2011 10:41:41 MDT
    Parent Server Generation: 0
    Server uptime: 3 hours 12 minutes 30 seconds
    Total accesses: 21640 - Total Traffic: 155.7 MB
    CPU Usage: u.42 s.17 cu125.6 cs0 - 1.09% CPU load
    1.87 requests/sec - 13.8 kB/second - 7.4 kB/request
    2 requests currently being processed, 8 idle workers
    W.__.......W_...__...___........................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
    ................................................................
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Do you have the sar information?
     
  6. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    helllo Here is Sar information

    Linux 2.6.18-194.26.1.el5.028stab079.2 (us02345.sitevalley.com) 04/27/2011

    12:00:01 AM CPU %user %nice %system %iowait %steal %idle
    12:10:01 AM all 13.59 0.01 1.54 0.00 0.00 84.86
    12:20:02 AM all 59.63 0.02 6.15 0.00 0.00 34.20
    12:30:01 AM all 34.20 0.01 3.77 0.00 0.00 62.02
    12:40:01 AM all 77.75 0.04 8.55 0.00 0.00 13.66
    12:50:01 AM all 74.62 0.02 8.51 0.00 0.00 16.84
    01:00:02 AM all 68.03 0.65 7.96 0.00 0.00 23.36
    01:10:01 AM all 71.93 0.02 7.74 0.00 0.00 20.31
    01:20:01 AM all 26.65 0.01 3.01 0.00 0.00 70.33
    01:30:01 AM all 17.92 0.02 2.01 0.00 0.00 80.04
    01:40:01 AM all 17.79 0.01 2.09 0.00 0.00 80.10
    01:50:01 AM all 8.05 0.01 0.99 0.00 0.00 90.95
    02:00:01 AM all 8.14 0.01 1.02 0.00 0.00 90.84
    02:10:01 AM all 13.39 0.01 1.53 0.00 0.00 85.07
    02:20:01 AM all 18.79 0.02 2.15 0.00 0.00 79.04
    02:30:01 AM all 47.17 0.02 5.02 0.00 0.00 47.80
    02:40:02 AM all 19.88 0.01 2.21 0.00 0.00 77.90
    02:50:01 AM all 23.31 0.01 2.58 0.00 0.00 74.09
    03:00:01 AM all 19.91 0.01 2.15 0.00 0.00 77.93
    03:10:01 AM all 18.23 0.02 2.04 0.00 0.00 79.71
    03:20:01 AM all 27.32 0.01 3.03 0.00 0.00 69.64
    03:30:01 AM all 26.61 0.01 3.01 0.00 0.00 70.37
    03:40:01 AM all 20.68 0.01 2.45 0.00 0.00 76.85

    03:40:01 AM CPU %user %nice %system %iowait %steal %idle
    03:50:01 AM all 22.34 0.01 2.60 0.00 0.00 75.04
    04:00:01 AM all 17.32 0.02 2.11 0.00 0.00 80.54
    04:10:01 AM all 18.67 0.01 2.21 0.00 0.00 79.11
    04:20:01 AM all 23.84 0.01 2.88 0.00 0.00 73.28
    04:30:01 AM all 22.26 0.01 2.62 0.00 0.00 75.11
    04:40:01 AM all 20.33 0.01 2.18 0.00 0.00 77.48
    04:50:01 AM all 15.98 0.02 1.74 0.00 0.00 82.26
    05:00:01 AM all 22.12 0.01 2.40 0.00 0.00 75.47
    05:10:01 AM all 15.62 0.01 1.73 0.00 0.00 82.63
    05:20:01 AM all 18.44 0.01 2.05 0.00 0.00 79.50
    05:30:01 AM all 31.75 0.01 3.66 0.00 0.00 64.58
    05:40:01 AM all 21.77 0.02 2.45 0.00 0.00 75.76
    05:50:01 AM all 19.85 0.01 2.25 0.00 0.00 77.88
    06:00:01 AM all 36.59 0.01 4.38 0.00 0.00 59.02
    06:10:01 AM all 21.69 1.17 2.44 0.00 0.00 74.70
    06:20:01 AM all 20.50 0.01 2.28 0.00 0.00 77.21
    06:30:01 AM all 18.74 0.02 2.05 0.00 0.00 79.19
    06:40:01 AM all 21.55 0.01 2.30 0.00 0.00 76.14
    06:50:01 AM all 27.40 0.01 2.88 0.00 0.00 69.70
    07:00:01 AM all 21.22 0.01 2.44 0.00 0.00 76.33
    07:10:01 AM all 19.23 0.01 2.14 0.00 0.00 78.62
    07:20:01 AM all 23.23 0.02 2.46 0.00 0.00 74.28

    07:20:01 AM CPU %user %nice %system %iowait %steal %idle
    07:30:01 AM all 29.07 0.01 3.10 0.00 0.00 67.82
    07:40:01 AM all 33.48 0.01 3.53 0.00 0.00 62.98
    07:50:01 AM all 16.83 0.01 1.88 0.00 0.00 81.27
    08:00:02 AM all 20.00 0.01 2.17 0.00 0.00 77.82
    08:10:01 AM all 28.62 0.03 3.21 0.00 0.00 68.15
    08:20:01 AM all 35.51 0.01 3.92 0.00 0.00 60.55
    08:30:01 AM all 25.41 0.01 2.72 0.00 0.00 71.86
    08:40:01 AM all 34.27 0.01 3.72 0.00 0.00 62.00
    08:50:02 AM all 37.54 0.02 4.01 0.00 0.00 58.42
    09:00:01 AM all 47.69 0.03 5.28 0.00 0.00 47.00
    09:10:01 AM all 31.41 0.01 3.30 0.00 0.00 65.27
    09:20:01 AM all 20.38 0.01 2.22 0.00 0.00 77.38
    09:30:01 AM all 21.87 0.01 2.46 0.00 0.00 75.66
    09:40:01 AM all 24.54 0.01 2.74 0.00 0.00 72.71
    09:50:01 AM all 25.80 0.01 2.93 0.00 0.00 71.26
    10:00:01 AM all 29.86 0.03 3.40 0.00 0.00 66.72
    10:10:07 AM all 27.67 0.46 3.18 0.00 0.00 68.69
    10:20:01 AM all 31.20 0.01 3.46 0.00 0.00 65.33
    10:30:02 AM all 55.01 0.03 6.05 0.00 0.00 38.91
    10:40:02 AM all 74.94 0.02 7.89 0.00 0.00 17.15
    10:50:04 AM all 51.99 0.03 5.39 0.00 0.00 42.59
    11:00:01 AM all 46.24 0.01 4.78 0.00 0.00 48.97

    11:00:01 AM CPU %user %nice %system %iowait %steal %idle
    11:10:02 AM all 35.18 0.01 3.73 0.00 0.00 61.08
    11:20:01 AM all 41.94 0.02 4.70 0.00 0.00 53.35
    11:30:01 AM all 28.92 0.01 3.15 0.00 0.00 67.92
    11:40:01 AM all 22.32 0.02 2.51 0.00 0.00 75.14
    11:50:01 AM all 25.82 0.01 2.81 0.00 0.00 71.35
    12:00:01 PM all 20.28 0.01 2.25 0.00 0.00 77.46
    12:10:01 PM all 20.78 0.01 2.32 0.00 0.00 76.90
    12:20:01 PM all 20.60 0.01 2.23 0.00 0.00 77.15
    12:30:01 PM all 22.38 0.02 2.41 0.00 0.00 75.19
    12:40:01 PM all 31.20 0.01 3.63 0.00 0.00 65.15
    12:50:03 PM all 39.26 0.01 4.33 0.00 0.00 56.40
    01:00:01 PM all 20.63 0.01 2.30 0.00 0.00 77.06
    01:10:01 PM all 16.97 0.01 1.90 0.00 0.00 81.12
    01:20:01 PM all 26.28 0.03 2.91 0.00 0.00 70.78
    01:30:01 PM all 36.96 0.01 4.09 0.00 0.00 58.94
    01:40:01 PM all 30.82 0.01 3.39 0.00 0.00 65.77
    01:50:01 PM all 22.40 0.01 2.39 0.00 0.00 75.20
    02:00:01 PM all 20.84 0.01 2.16 0.00 0.00 77.00
    02:10:01 PM all 21.83 0.02 2.31 0.00 0.00 75.84
    02:20:01 PM all 19.13 0.01 1.97 0.00 0.00 78.89
    Average: all 26.52 0.04 2.93 0.00 0.00 70.51
     
  7. k-planethost

    k-planethost Well-Known Member

    Joined:
    Sep 22, 2009
    Messages:
    199
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Athens Greece
    Hop T1 T2 T3 IP
    1. 5.60ms 5.86ms 5.68ms 66.249.16.2 Reverse IP | Ping | DNS Lookup
    2. 5.59ms 8.10ms 5.60ms 64.246.161.201 Reverse IP | Ping | DNS Lookup
    3. 6.59ms 7.12ms 7.60ms igr1-pe2.blh.fibercloud.net Reverse IP | Ping | DNS Lookup
    4. 10.61ms 9.99ms 12.59ms 12.119.199.41 Reverse IP | Ping | DNS Lookup
    5. 32.55ms 31.86ms 34.57ms cr1.st6wa.ip.att.net Reverse IP | Ping | DNS Lookup
    6. 31.56ms 31.86ms 32.53ms cr2.sffca.ip.att.net Reverse IP | Ping | DNS Lookup
    7. 31.62ms 31.32ms 30.59ms 12.122.136.205 Reverse IP | Ping | DNS Lookup
    8. 31.57ms 32.41ms 31.69ms 192.205.34.34 Reverse IP | Ping | DNS Lookup
    9. 31.54ms 31.87ms 31.47ms te2-4.ccr02.sjc03.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    10. 32.59ms 32.49ms 31.56ms te4-2.ccr02.sjc01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    11. 33.53ms 33.10ms 33.63ms te0-1-0-5.ccr22.sfo01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    12. 78.58ms 79.62ms 79.57ms te0-4-0-1.ccr22.mci01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    13. 68.59ms 68.41ms 68.51ms te0-5-0-4.ccr22.ord01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    14. 159.56ms 159.05ms 158.54ms te0-5-0-6.ccr22.bos01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    15. 158.52ms 159.32ms 158.51ms te0-4-0-1.ccr22.lpl01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    16. 160.50ms 160.03ms 159.48ms te4-2.ccr01.man01.atlas.cogentco.com Reverse IP | Ping | DNS Lookup
    17. 159.48ms 159.94ms 159.49ms 149.6.11.170 Reverse IP | Ping | DNS Lookup
    18. 160.51ms 160.91ms 160.49ms lv0202.1b0701.mnuk01.hostnoc.eu Reverse IP | Ping | DNS Lookup
    19. * * * Request Timed Out
    20. * * * Request Timed Out

    this is a traceroute for your domain
    for a USA virtual its ok i think.
    maybe is cause of the distance that the DC is located from your country that cause issues.
    the provider that you deal with has a DC available in UK also in Miami , LA and Scrapton
    for my location loads good for a USA vps
     
  8. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Thanks k-planethost
    u can see how much VPS Used Memory
    System information

    Server load 4.81 (7 CPUs)
    Memory Used 12.73% (533944 of 4194304)
    Swap Used 0.00% (0 of 1)
    i wonder why CPU Dont use more memorey
    is any restraction on Vps to use memorey?
     
  9. JawadArshad

    JawadArshad Well-Known Member
    PartnerNOC

    Joined:
    Apr 8, 2008
    Messages:
    447
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    PK
    cPanel Access Level:
    DataCenter Provider
    VPS' parent OS has several CPU QoS parameters that can be used to cap your CPU. Your host might be capping CPU. Run 'sar -q' and paste the results. Secondly, check "Daily Process Log" in WHM to find the most resource intensive processes as well as monitor your server via top to find the cause of high CPU usage.

     
  10. Muhammad_1

    Muhammad_1 Member

    Joined:
    Mar 20, 2011
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Here is 'sar -q result
    Linux 2.6.18-194.26.1.el5.028stab079.2 (server1.pinditube.com) 04/30/2011

    12:00:01 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15
    12:10:01 AM 3 64 2.53 2.43 2.60
    12:20:02 AM 4 65 2.71 2.40 2.47
    12:30:02 AM 3 71 2.34 2.56 2.54
    12:40:02 AM 6 69 1.94 2.38 2.51
    12:50:01 AM 3 67 2.37 2.40 2.43
    01:00:01 AM 3 64 2.50 2.45 2.47
    01:10:01 AM 3 62 2.91 2.62 2.53
    Average: 4 66 2.47 2.46 2.51
    Here is Daily process log data

    You have 9 CPUs; therefore, these CPU percentages are divided by 9 to indicate the true percentage of all CPU power used.

    User Domain % CPU % MEM MySQL Processes
    pinditube 3.30 2.01 1.9
    mysql 1.32 0.82 0.0
    root 0.02 5.98 1.9
    named 0.00 0.10 0.0
    nobody 0.00 0.03 0.0
    cpanel 0.00 0.01 0.0
    dlinksco 0.00 0.00 0.0
    dbus 0.00 0.00 0.0
    dovecot 0.00 0.00 0.0
    mailnull 0.00 0.00 0.0
    mailman 0.00 0.00 0.0
    68 0.00 0.00 0.0
    avahi 0.00 0.00 0.0
    sshd 0.00 0.00 0.0
    wwww 0.00 0.00 0.0
    xfs 0.00 0.00 0.0
    unauthenticated 0.00 0.00 0.0
    eximstats 0.00 0.00 0.1
    leechprotect 0.00 0.00 1.0


    User Domain % CPU Process
    Top Processes
    pinditube 75.0 /usr/bin/php /home/pinditub/public_html/index.php
    pinditube 66.0 /usr/bin/php /home/pinditub/public_html/index.php
    pinditube 62.0 /usr/bin/php /home/pinditub/public_html/index.php
    root 4.8 cpanellogd - updating bandwidth for pinditub
    root 3.0 /usr/bin/perl /scripts/restartsrv_cpanellogd --check
    root 14.0 /usr/bin/perl /scripts/restartsrv_tailwatchd --check
    mysql 12.3 /usr/sbin/mysqld --basedir/ --datadir/var/lib/mysql --usermysql --log-error/var/lib/mysql/us02345.sitevalley.com.err --pid-file/var/lib/mysql/us02345.sitevalley.com.pid
    mysql 12.2 /usr/sbin/mysqld --basedir/ --datadir/var/lib/mysql --usermysql --log-error/var/lib/mysql/us02345.sitevalley.com.err --pid-file/var/lib/mysql/us02345.sitevalley.com.pid
     
  11. k-planethost

    k-planethost Well-Known Member

    Joined:
    Sep 22, 2009
    Messages:
    199
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Athens Greece
  12. dutaspace

    dutaspace Registered

    Joined:
    May 26, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I really do this and it is really very helpful.
     
  13. jackg164

    jackg164 Member

    Joined:
    May 30, 2011
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I will explain how to calculate maxclients:

    ------------------------------------
    MaxClients = Total RAM / Max child process size
    ------------------------------------

    Calculate memory used by Apache:

    Code:
    ps -ylC httpd --sort:rss
    Example of Output:

    Code:
    S   UID   PID  PPID  C PRI  NI   RSS    SZ WCHAN  TTY          TIME CMD
    S    99  6859  5230  0  75   0 [B][COLOR="red"]19616[/COLOR][/B]  25081 semtim ?        00:00:01 httpd
    19616 / 1024 = 19,15 MB per Apache proccess


    Now you need see the total number of processes

    Code:
    lsof -i | grep httpd | wc -l
    Example of Output:

    Code:
    52
    Well, the conclusion of this example:

    19,15 MB used per Apache proccess x 52 Apache processes on memory = 995,8 MB of memory used

    Then if you have 2 GB of RAM, in this case you should set MaxClients to 93, why 93?

    2048 MB (Total RAM) - 256 MB (This memory reserved for OS and cPanel) / 19,15 MB (Memory used per Apache proccess) = 93,57....


    Also, if you have 10000 daily visitors, you should upgrade your VPS or move to dedicated.

    I hope this can help you, if I'm wrong on this, someone correct me.
     
  14. srpurdy

    srpurdy Well-Known Member

    Joined:
    Jun 1, 2011
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    10,000 doesn't seem like much for a vps. I get about half on one of my vps's (30K raw) with only 512 memory, and have zero issues. (load is maybe 0.2 at peak hours) I do have a 16 cores but limited performance as well. Seems the majority of your load is coming from pinditube 3.30 2.01 1.9 user. Is the the primary domain with traffic? Looking at this website, you have very low scores in page speed. This is where I would start, as you can probably improve the load on the server by optimizing the website itself.
     
  15. Sannin

    Sannin Active Member

    Joined:
    May 19, 2011
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    All the optimizing guides i have read talk about calculating maxclients based on apache memory size. From my calculation, i set maxclients at 75 and i did a benchmark with ab and loadimpact.com on my wordpress site. After 20 concurrent connections memory was full because of the forked php processes that spawned with the apache processes.

    So shouldn't we include php process size into the calculation?
     
  16. k-planethost

    k-planethost Well-Known Member

    Joined:
    Sep 22, 2009
    Messages:
    199
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Athens Greece
    with 50-60 dollars you can update to a value dedicated dual core server and avoid hasles like this.
    have you run mysqltuner at all for optimization?
     
  17. Sannin

    Sannin Active Member

    Joined:
    May 19, 2011
    Messages:
    34
    Likes Received:
    0
    Trophy Points:
    6
    Going to dedicated would triple the cost for me (considering i need to change cpanel license too), so it is out a question for now. I also don't believe that a Xen VPS with 768 Mbs ram can' t host a WordPress site with a satisfying number of concurrent connections.

    The site is not live now, so i wait a bit with mysql optimization. I calculated about 70 MaxClients settings for apache with the guides i have found, but i have limited it to 20 since i expect heavy traffic from the WordPress site when it goes live. Unless my thoughts on PHP memory usage are not correct...
     
  18. k-planethost

    k-planethost Well-Known Member

    Joined:
    Sep 22, 2009
    Messages:
    199
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    Athens Greece
    at least one giga of memory.
    cpanel needs about 256mb to operate even if you run an easy apache update should need that time about 512mb
     
  19. dorthyonline

    dorthyonline Registered

    Joined:
    Jun 16, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    I was also facing a similar issue. I contacted someone who told me that it could be related to VPS.
     
  20. dorthyonline

    dorthyonline Registered

    Joined:
    Jun 16, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Is there any better option available rather than a dedicated server ?
     
    #20 dorthyonline, Jun 16, 2011
    Last edited: Jun 16, 2011
Loading...

Share This Page