note 114989 added to memcache.connect

From: Date: Sat, 10 May 2014 04:28:46 +0000
Subject: note 114989 added to memcache.connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-199497@lists.php.net to get a copy of this message
In describing the timeout there is a statement that is not completely correct, increase the timeout does not necessarily preclude or unfeasible memcache, only allows the system to wait for more concurrent connections, which is a large minority of the number of connections, this causes several problems and could simply be corrected if the timeout was increased and perform some tests. To prove the concept and show that the connection does not wait if the server goes down: <?PHP while ( ++$loop < 10000 ) { try { $memcache = new Memcache; @$memcache->pconnect( "127.0.0.1" , 11211 , 30 ); $loopset = 0; $loopget = 0; while ( ++$loopset < 50 ) { if ( @$memcache->set( "foo" , "bar" ) === false ) { echo "Fail!" . PHP_EOL; } } while ( ++$loopget < 500 ) { if ( @$memcache->get( "foo" ) === false ) { echo "Fail!" . PHP_EOL; } } if ( $loop % 100 == 0 ) { echo "Try: " . $loop . PHP_EOL; } } catch ( Exception $e ) { echo "Fail: " . $e->getMessage() . PHP_EOL; } } ?> Replace with an invalid host and test the timeout will not make a difference! It serves only for connections to the socket that are occupied. More detail about troubleshooting timeouts in memcached google code. ---- Server IP: 72.52.91.14 Probable Submitter: 200.221.145.22 ---- Manual Page -- http://php.net/manual/en/memcache.connect.php Edit -- https://master.php.net/note/edit/114989 Del: integrated -- https://master.php.net/note/delete/114989/integrated Del: useless -- https://master.php.net/note/delete/114989/useless Del: bad code -- https://master.php.net/note/delete/114989/bad+code Del: spam -- https://master.php.net/note/delete/114989/spam Del: non-english -- https://master.php.net/note/delete/114989/non-english Del: in docs -- https://master.php.net/note/delete/114989/in+docs Del: other reasons-- https://master.php.net/note/delete/114989 Reject -- https://master.php.net/note/reject/114989 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199497) next »