php - 600+ memcache req/s problems - help! -
i running memcached on server , when hits 600+ req/s becomes unstable , causes big load of problems. appears when request rate gets high, php applications @ random times unable connect memcache server, causing slow load times makes nginx , php-fpm freak out , receive bunch of 104: connection reset peer errors in nginx logs.
i point out in memcache server have 'hot objects' - objects @ times receive 90% of memcache requests. noticed when many requests hit single object, adds little more load time overall page (when manages load).
i appreciate problem. much!
switch away using tcp sockets , going unix sockets (assuming on unix based server)
start memcached socket enabled: add -s /tmp/memcached.socket
memcached startup line (note, sockets disables networking support)
then in php, connect using persistent connections, , new memcache socket:
$memcache_obj = new memcache; $memcache_obj->pconnect('unix:///tmp/memcached.socket', 0);
another recommendation, if have multiple "types" of cached objects, start memcached instance each "type" , distribute hot items amongst them.
drupal this, can see how config file , memcached init setup here.
also, sounds me memcached timeout set way high. if it's above 1 or 2 seconds, can lock scripts up. timeout should reached, , script should default retrieving object via method (sql, file, etc)
the other thing verify memcache isn't being put swap file, if cache smaller average free ram, try starting memcache -k option, force it's cache stay in ram , can't swapped.
if have multi-core server, make sure memcached compiled thread support, , enable using -t <numcores>
Comments
Post a Comment