Having an issue where calls to memcached->get( $key ) is taking over 30 seconds, and is throwing a fatal exception. Kind of a weird scenario, but basically, the environment we have, has 4 servers running memcached 0.4, and 3 running 1.08.
Here's the exception
Maximum execution time of
30 seconds exceeded in /docroot/www/library/lib/Core/Cache/Memcache.php on line 152
Line number changes, to different functions calling on the memcache connection, but they are always on either a replace
or a get
. I've checked the keys, and they are all alpha numeric.
line 152 of that file is
On the servers running 1.08, im trying to set it so theres a timeout of 3 seconds on a get (which is higher than what it really should be, but no matter)
So, i wrote a simple script to connect to some AWS memcache instances, set the timeouts to one microsecond and try and have it cache a big value.
Heres the script
$cache = new Memcached();
$cache->addServers( $servers );
$cache->setOption( \Memcached::OPT_RECV_TIMEOUT, 1 );
$cache->->setOption( \Memcached::OPT_SEND_TIMEOUT, 5000 );
$key = sha1( microtime( true ) . rand( 0, 9999999999 ) );
$value = sha1( $key );
for( $i = 0; $i < 10000; $i++ ) {
$value .= sha1( $value );
}
$cache->set( $key, $value, 120 );
echo "Value Set\n";
sleep( 5 );
$start = microtime( true );
var_dump( [ 'key' => $key, 'value' => sizeof( $cache->get( $key ) ) ] );
var_dump( $cache->getResultMessage() );
$end = microtime( true );
echo "Elapsed: " . ( $end - $start ) . "\n";
AND, the output of time php test.php
Value Set
array(2) {
["key"]=>
string(40) "c5c9da5ebef83a24da78cdd8bba61b0fa8473296"
["value"]=>
int(1)
}
string(7) "SUCCESS"
Elapsed: 0.0075550079345703
real 0m14.326s
user 0m9.129s
sys 0m0.080s
Anyone have any idea how to solve either of my problems? Help is GREATLY appreciated