Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


wordpress site tons of time waits
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

wordpress site tons of time waits

twaintwain Member
edited January 2013 in General

x.x.x.x is the server's public IP... this is a high traffic wordpress site.

max_connections are at 1000 now.. however before I changed, the server load would get to over 100 and then server would crash and need rebooted.

Server load is ~1 at time of this netstat -antup snapshot, however I think this might happen again.. eg load gets unmanageable and mysql restart (or reboot) needed.. x.x.x.x is the server's public IP

Wordpress appears to default to mysql_connect (vs pconnect) according to the sites wp-db.php:

 * @param resource $dbh     The resource given by mysql_connect
        $this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );
        $this->dbh = @mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );

** Would changing to mysql_pconnect help ?? **

tcp 0 0 x.x.x.x:80 x.x.x.x:46405 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46271 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46267 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46431 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46361 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46351 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46315 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46345 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46296 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46329 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46289 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46368 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46399 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46428 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46398 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46280 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46277 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46264 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46363 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46380 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46440 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46335 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46281 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46385 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46438 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46383 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46274 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46290 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46347 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46411 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46389 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46306 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46416 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46408 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46419 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46367 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46292 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46369 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46295 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46268 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46375 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46327 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46417 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46415 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46341 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46266 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46388 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46414 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46410 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46432 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46334 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46358 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46270 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46395 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46435 TIME_WAIT -
tcp 0 0 x.x.x.x:80 x.x.x.x:46349 TIME_WAIT -

Comments

  • actually this would indicate max_clients issue in apache config wouldn't it?

  • increase max clients, make sure keep_alive is fairly low ~15.

  • my.cnf> decrease the mysql idle timeout and increase the thread cache size

  • RobertClarkeRobertClarke Member, Host Rep

    Are you sure you aren't being hit with an attack? Might also be bad code.

  • Have a look through mysqltuner.pl, that should give you some recommendations on how to alter your MySQL configuration.

    If you aren't using some form of caching, you should seriously consider implementing it.
    Batcache is very similar to the caching system that Wordpress.com uses, and is incredibly easy to implement.

    Whilst you're looking at caching methods/plugins, have a look at the amount of plugins you have activated. Whilst you have a high traffic site, the majority of problems initially occur from poorly optimised plugins causing additional unnecessary load on the server.

    If you're still having some problems, drop me a PM and I'll be happy to take a look for you. I'm used to squeezing performance out of WordPress installs through significant research, as well as trial and error :-)

    Good luck!

  • Wordpress costs so much cpu,I tried lots of tricks on a wordpress e-commerce site ,but the request per second is still poor when I bench it.There is a shopping cart on the header,so the site couldn't be entirely cached.If your site's contents are static type,cache is the best way to solve the problem,cache your database and objects with memcache,use varnish and redis to load the site,save sessions in memory,separate the static part with CDN,you could get a lighting fast wordpress site,4000+ request per second is a piece of cake.

  • Thanks for the recommendations here..

    In netstat there are 700+ local connections (random port to 80) over the server's public IP... crazy..

    Anything immediately glaring from this mysqltuner output that should be done besides its own recommendations?

    MySQLTuner 1.2.0_1 - Major Hayden major@mhtx.net
    Bug reports, feature requests, and downloads at http://mysqltuner.com/
    Run with '--help' for additional options and output filtering

    -------- General Statistics --------------------------------------------------
    [^[[0;34m--^[[0m] Skipped version check for MySQLTuner script
    [^[[0;32mOK^[[0m] Currently running supported MySQL version 5.1.66-cll
    [^[[0;32mOK^[[0m] Operating on 64-bit architecture

    -------- Storage Engine Statistics -------------------------------------------
    [^[[0;34m--^[[0m] Status: ^[[0;32m+Archive^[[0m ^[[0;31m-BDB^[[0m ^[[0;31m-Federated^[[0m ^[[0;32m+InnoDB^[[0m ^[[0;31m-ISAM^[[0m ^[[0;31m-NDBCluster^[[0m
    [^[[0;34m--^[[0m] Data in MyISAM tables: 506M (Tables: 165)
    [^[[0;34m--^[[0m] Data in InnoDB tables: 208K (Tables: 13)
    [^[[0;31m!!^[[0m] Total fragmented tables: 16

    -------- Performance Metrics -------------------------------------------------
    [^[[0;34m--^[[0m] Up for: 3h 13m 20s (1M q [119.586 qps], 8K conn, TX: 4B, RX: 205M)
    [^[[0;34m--^[[0m] Reads / Writes: 96% / 4%
    [^[[0;34m--^[[0m] Total buffers: 34.0M global + 2.7M per thread (1000 max threads)
    [^[[0;32mOK^[[0m] Maximum possible memory usage: 2.7G (17% of installed RAM)
    [^[[0;32mOK^[[0m] Slow queries: 0% (4K/1M)
    [^[[0;32mOK^[[0m] Highest usage of available connections: 5% (50/1000)
    [^[[0;32mOK^[[0m] Key buffer size / total MyISAM indexes: 8.0M/245.8M
    [^[[0;32mOK^[[0m] Key buffer hit rate: 96.0% (5B cached / 221M reads)
    [^[[0;31m!!^[[0m] Query cache is disabled
    [^[[0;32mOK^[[0m] Sorts requiring temporary tables: 3% (14K temp sorts / 393K sorts)
    [^[[0;31m!!^[[0m] Temporary tables created on disk: 40% (124K on disk / 309K total)
    [^[[0;31m!!^[[0m] Thread cache is disabled
    [^[[0;31m!!^[[0m] Table cache hit rate: 0% (64 open / 9K opened)
    [^[[0;32mOK^[[0m] Open file limit used: 1% (79/5K)
    [^[[0;32mOK^[[0m] Table locks acquired immediately: 99% (1M immediate / 1M locks)
    [^[[0;32mOK^[[0m] InnoDB data size / buffer pool: 208.0K/8.0M

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Set thread_cache_size to 4 as a starting value
    Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
    query_cache_size (>= 8M)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    thread_cache_size (start at 4)
    table_cache (> 64)

Sign In or Register to comment.