Results 1 to 20 of 20
  1. #1

    * VPS problems with wordpress + fastcgi php etc

    Hi i hope someone can help me.

    I'm running 16 wordpress installs (2 of which are multi sites with 7 and 8 other domains/sites running on the install)
    The sites are getting roughly 12k pageviews a day.

    my vps has 2 cores @ 2.66GHz with 2gigs of ram.

    I am running cpanel, apache 2.2, mysql 5.0.91-community and php 5.3.4.

    using easyapache i enabled Mod FCGID, MPM Prefork, MPM Worker, MemCache, EAccelerator for PHP and MySQL "Improved" extension in php.

    my apache config is:

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

    I had a problem with eaccelerator filling up my temp drive very quickly so i set up a symbolic link to a new folder /var/eaccelerator giving it full rights to write there and setup a cron job to clean up all the older files in the folder.

    The server hovers around at 1.4 gig memory usage with a little background traffic but if i open up 6 of my sites backends i can see the usage jump from 1.4 to over my 2 gigs and into the swapfile which kills all my sites.

    If i use fastcgi it eats the ram much quicker. As soon as i turn it on my ram usage jumps right up to 90 odd percent as if there is a memory leak or something.
    From what i read fastcgi should have a lower memory print than standard cgi.

    No mater what i try the usage generally goes over my 2 gigs of ram.

    Anyone got any ideas on what i can do?

    These sites were all running fine split over 2 different shared hosting accounts (they have supercache enabled and afaik no bad plugins.)

    here is what it currently says if i use top:

    top - 20:20:02 up 4:13, 1 user, load average: 58.17, 61.27, 43.95
    Tasks: 184 total, 1 running, 182 sleeping, 0 stopped, 1 zombie
    Cpu(s): 7.7%us, 12.1%sy, 0.2%ni, 0.0%id, 68.2%wa, 10.9%hi, 0.9%si, 0.0%st
    Mem: 2057524k total, 1653592k used, 403932k free, 11624k buffers
    Swap: 4192924k total, 1347108k used, 2845816k free, 708492k cached

    Anyone got any ideas?

  2. #2
    Join Date
    May 2006
    Location
    San Francisco
    Posts
    7,200
    Can you post top with the processes included sorted by memory usage? Your loads are extremely high - have you optimized MySQL?

  3. #3
    top - 20:35:30 up 4:29, 1 user, load average: 123.63, 112.87, 82.49
    Tasks: 264 total, 1 running, 263 sleeping, 0 stopped, 0 zombie
    Cpu(s): 1.4%us, 4.8%sy, 0.0%ni, 0.0%id, 84.0%wa, 9.4%hi, 0.3%si, 0.0%st
    Mem: 2057524k total, 2049728k used, 7796k free, 7224k buffers
    Swap: 4192924k total, 2389808k used, 1803116k free, 600472k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    29616 sitesone 17 0 110m 17m 12m D 1.3 0.9 0:00.42 php
    29641 sitestwo 17 0 111m 17m 13m D 1.3 0.9 0:00.32 php
    29240 sitestwo 16 0 117m 17m 8716 D 1.0 0.9 0:01.99 php
    2264 mysql 15 0 404m 59m 2836 S 0.7 3.0 11:59.75 mysqld
    22089 root 15 0 12868 1116 744 R 0.7 0.1 0:19.03 top
    29401 sitestwo 16 0 124m 21m 8184 S 0.7 1.0 0:00.96 php
    29410 sitesone 16 0 122m 20m 8624 D 0.7 1.0 0:01.11 php
    29413 sitesone 16 0 122m 19m 7884 S 0.7 1.0 0:01.02 php
    29416 sitesone 16 0 126m 25m 10m D 0.7 1.3 0:01.12 php
    29554 sitesone 16 0 116m 19m 11m D 0.7 1.0 0:00.72 php
    29653 root 18 0 41716 3116 748 D 0.7 0.2 0:00.14 tailwatchd
    33 root 10 -5 0 0 0 S 0.3 0.0 0:40.78 kblockd/1
    1887 root 16 0 5908 544 492 D 0.3 0.0 0:01.21 syslogd
    2677 root 18 0 37408 1832 1256 S 0.3 0.1 0:00.62 queueprocd
    3216 named 18 0 161m 2156 1148 S 0.3 0.1 1:08.71 named
    29327 sitesone 16 0 126m 16m 8984 S 0.3 0.8 0:01.59 php
    29356 sitestwo 16 0 123m 19m 8848 D 0.3 1.0 0:01.55 php

  4. #4
    i haven't optimised mysql, where can i do that in the cpanel?

  5. #5
    Join Date
    May 2006
    Location
    San Francisco
    Posts
    7,200
    That list doesn't appear to be ordered by memory use. Can you do SHIFT-M while in top?

    You'll need to modify your /etc/my.cnf file - I recommend using MySQLTuner for guidance.

    http://blog.mysqltuner.com/download/

  6. #6
    oops sorry here it is:

    top - 20:44:58 up 4:38, 1 user, load average: 115.32, 115.69, 98.24
    Tasks: 225 total, 3 running, 222 sleeping, 0 stopped, 0 zombie
    Cpu(s): 3.9%us, 6.4%sy, 0.2%ni, 0.0%id, 77.9%wa, 11.1%hi, 0.5%si, 0.0%st
    Mem: 2057524k total, 2049572k used, 7952k free, 5800k buffers
    Swap: 4192924k total, 710448k used, 3482476k free, 838216k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    2264 mysql 15 0 404m 72m 2808 S 4.3 3.6 12:09.16 mysqld
    29931 wiividzc 15 0 181m 36m 18m D 1.3 1.8 0:01.41 php
    29852 root 18 0 117m 35m 2184 S 0.0 1.7 0:01.59 spamd
    29929 wiividzc 16 0 126m 28m 10m D 2.7 1.4 0:01.00 php
    29895 wiividzc 16 0 120m 25m 12m D 0.3 1.3 0:01.17 php
    29926 wiividzc 15 0 122m 24m 10m S 0.0 1.2 0:00.76 php
    29839 wiividzc 16 0 122m 24m 10m S 1.3 1.2 0:00.94 php
    29890 wiividzc 16 0 112m 24m 18m D 0.3 1.2 0:01.02 php
    29807 esoca 16 0 112m 24m 18m D 0.0 1.2 0:00.62 php
    29912 wiividzc 16 0 122m 24m 9m S 0.3 1.2 0:00.79 php
    29930 wiividzc 15 0 122m 24m 9m S 0.0 1.2 0:00.73 php
    29906 wiividzc 15 0 122m 23m 9m S 0.0 1.2 0:00.66 php
    29788 esoca 16 0 112m 23m 18m D 0.0 1.2 0:00.53 php
    29835 esoca 16 0 112m 23m 18m D 0.0 1.2 0:00.60 php
    29848 esoca 18 0 112m 23m 18m D 0.0 1.2 0:00.48 php
    29854 esoca 18 0 112m 23m 18m D 0.0 1.2 0:00.49 php
    29840 esoca 18 0 112m 23m 18m D 0.0 1.2 0:00.56 php


    my mysql settings:

    [mysqld]
    max_connections = 300
    key_buffer = 32M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 4000
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 7000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 2M
    query_cache_size = 12M
    query_cache_type = 1
    tmp_table_size = 16M

  7. #7
    set your keepalive timeout to 1 instead of 5 will free up apache slots faster and save on ram.

    Other than that, I hate to say it, but you just might need another 1gb of ram.
    Phoenix Dedicated Servers -- IOFLOOD.com
    Email: sales [at] ioflood.com
    Skype: iofloodsales
    Backup Storage VPS -- 1TBVPS.com

  8. #8
    sorry here's my full mysql settings
    [mysqld]
    max_connections = 300
    key_buffer = 32M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    read_buffer_size = 1M
    sort_buffer_size = 2M
    table_cache = 4000
    thread_cache_size = 286
    interactive_timeout = 25
    wait_timeout = 7000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 2M
    query_cache_size = 12M
    query_cache_type = 1
    tmp_table_size = 16M
    skip-innodb
    [mysqld_safe]
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 64M
    sort_buffer = 64M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout

  9. #9
    I believe the problem was with my swappiness setting.
    http://kerneltrap.org/node/3000

    i reduced this setting a little and have setup a cron job to clear the cache once a day.

    it seems to be running better now.

  10. #10
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by jambojim View Post
    I believe the problem was with my swappiness setting.
    http://kerneltrap.org/node/3000

    i reduced this setting a little and have setup a cron job to clear the cache once a day.

    it seems to be running better now.
    Were your high io wait values caused by the swapping? If the values are still high, there might be a problem relaetd to disk io performance.

  11. #11
    Quote Originally Posted by bergholt View Post
    Were your high io wait values caused by the swapping? If the values are still high, there might be a problem relaetd to disk io performance.
    here are the disk stats

    Device Trans./Sec Blocks Read/sec Blocks Written/Sec Total Blocks Read Total Blocks Written
    hda 15.23 151.84 472.50 13164647 40967130

  12. #12
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by jambojim View Post
    here are the disk stats

    Device Trans./Sec Blocks Read/sec Blocks Written/Sec Total Blocks Read Total Blocks Written
    hda 15.23 151.84 472.50 13164647 40967130
    Thanks. But how do your io wait values (top command) look after the change?

  13. #13
    sorry for the delay.

    I've upgraded and got an extra gig to leave me lots of room to breathe

    here is what it looks like immediately after clearing the swap stuff

    top - 20:15:18 up 2 days, 23:50, 2 users, load average: 7.66, 4.23, 3.16
    Tasks: 120 total, 11 running, 108 sleeping, 0 stopped, 1 zombie
    Cpu(s): 10.8%us, 16.7%sy, 0.0%ni, 0.2%id, 60.8%wa, 9.9%hi, 1.7%si, 0.0%st
    Mem: 3088688k total, 690792k used, 2397896k free, 3184k buffers
    Swap: 4192924k total, 12k used, 4192912k free, 107448k cached

    and here it looks after a wee while

    top - 20:33:02 up 3 days, 8 min, 2 users, load average: 4.70, 3.20, 3.03
    Tasks: 115 total, 15 running, 99 sleeping, 0 stopped, 1 zombie
    Cpu(s): 34.2%us, 42.4%sy, 0.0%ni, 0.3%id, 0.2%wa, 16.8%hi, 6.0%si, 0.0%st
    Mem: 3088688k total, 1114904k used, 1973784k free, 45108k buffers
    Swap: 4192924k total, 12k used, 4192912k free, 569108k cached

  14. #14
    Join Date
    Jul 2009
    Location
    Indiana
    Posts
    2,193
    You're still running a pretty high load. It's recommended to keep the load under .7 per cpu core (so 1.4 for you).
    Sam Barrow - CEO @ SQUIDIX (1-855-SQUIDIX)
    Ask Us About Sponsoring Your Web Site (High Traffic Sites Only)
    Squidix - Shared, Reseller, Semi-Dedicated, Managed VPS and Managed Dedicated Hosting
    Midwestern Web - Web Design & Development Services

  15. #15
    Join Date
    Oct 2009
    Location
    San Leandro, California
    Posts
    245
    I don't care what else you guys are saying, I'd say:

    F**k FastCGI (Sorry, I hate fastcgi so much), use mod_php instead.

    Also, don't use EA, use APC instead.

    That's it.

  16. #16
    Join Date
    Oct 2009
    Location
    San Leandro, California
    Posts
    245
    Also, if you're hosting heavy duty WordPress, YOU HAVE TO USE MEMCACHED. Otherwise MySQL is going to eat all your resources.

    It's a must, not an option.

  17. #17
    Join Date
    Feb 2006
    Location
    Kepler 62f
    Posts
    14,877
    It's all about caching -- everything you can.
    || Need a good host?
    || See my Suggested Hosts List || Editorial: EIG/Site5/Arvixe/Hostgator Alternatives
    ||

  18. #18
    Quote Originally Posted by SamBarrow View Post
    You're still running a pretty high load. It's recommended to keep the load under .7 per cpu core (so 1.4 for you).
    that was when it was under a particularly large amount of traffic
    here is what it is when not under heavy heavy load

    top - 22:46:51 up 3 days, 3:04, 2 users, load average: 0.55, 0.84, 0.96
    Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie
    Cpu(s): 0.0%us, 0.9%sy, 0.0%ni, 95.5%id, 0.0%wa, 2.7%hi, 0.9%si, 0.0%s
    Mem: 3088688k total, 1572728k used, 1515960k free, 111532k buffers
    Swap: 4192924k total, 37320k used, 4155604k free, 1014148k cached


    Quote Originally Posted by jerrychenme View Post
    I don't care what else you guys are saying, I'd say:

    F**k FastCGI (Sorry, I hate fastcgi so much), use mod_php instead.

    Also, don't use EA, use APC instead.

    That's it.
    I'm currently using suphp. APC = Alternative PHP Cache?

    I've never used it. is it worth using over eAccelerator?

  19. #19
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by jambojim View Post
    that was when it was under a particularly large amount of traffic
    here is what it is when not under heavy heavy load

    top - 22:46:51 up 3 days, 3:04, 2 users, load average: 0.55, 0.84, 0.96
    Tasks: 104 total, 1 running, 103 sleeping, 0 stopped, 0 zombie
    Cpu(s): 0.0%us, 0.9%sy, 0.0%ni, 95.5%id, 0.0%wa, 2.7%hi, 0.9%si, 0.0%s
    Mem: 3088688k total, 1572728k used, 1515960k free, 111532k buffers
    Swap: 4192924k total, 37320k used, 4155604k free, 1014148k cached




    I'm currently using suphp. APC = Alternative PHP Cache?

    I've never used it. is it worth using over eAccelerator?
    If APC and suPHP are not mutually exclusive in your setup, you could try changing from WP Super Cache to W3 Total Cache and enable object caching and page caching (using APC as the memory layer).

    Migrating static content to a Content Delivery Network could also help you scale better (W3 Total Cache supports Amazon CloudFront, Cloudfiles & MaxDN).

    However, your load levels under normal load look ok to me.

  20. #20
    Join Date
    Oct 2010
    Location
    Copenhagen
    Posts
    252
    Quote Originally Posted by bergholt View Post
    If APC and suPHP are not mutually exclusive in your setup, you could try changing from WP Super Cache to W3 Total Cache and enable object caching and page caching (using APC as the memory layer).

    Migrating static content to a Content Delivery Network could also help you scale better (W3 Total Cache supports Amazon CloudFront, Cloudfiles & MaxDN).

    However, your load levels under normal load look ok to me.

    W3 Total Cache
    supports supports eAccelrator too, btw.

Similar Threads

  1. Wordpress with fastcgi/cgi
    By edawebdesign in forum VPS Hosting
    Replies: 5
    Last Post: 01-28-2011, 01:43 PM
  2. FastCGI problems (apache 2.2, php 5.1, suexec)
    By Xia in forum Hosting Security and Technology
    Replies: 0
    Last Post: 12-17-2008, 01:05 PM
  3. Replies: 3
    Last Post: 06-08-2006, 11:49 PM
  4. Paying someone to move /fix some problems (wordpress) *php*
    By shelfspot in forum Employment / Job Offers
    Replies: 3
    Last Post: 02-12-2006, 06:10 PM
  5. Php with fastcgi?
    By Froggy in forum Programming Discussion
    Replies: 0
    Last Post: 10-12-2005, 08:56 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
  •