Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent connections to memcached in PHP

In our current use of memcached, we are running into problems in a high volume server because so much time is used setting up and tearing down connections to our memcache server. Would using persistent connections to memcached help alleviate this problem?

Also, what is the preferred way to connect and use persistent memcahced connections? I was thinking of setting a "pool_size" variable then randomly choosing from 1-$POOL_SIZE and using that connection

$mem = new Memcached(rand(1, $pool_size));

Either I am looking in the wrong place or there is not a lot of information on this out there.

like image 279
jW. Avatar asked Jun 11 '09 21:06

jW.


Video Answer


1 Answers

Both pecl/memcache and pecl/memcached support persistent connections per process. However, the bug does exist in pecl/memcached at this time.

like image 91
brianlmoon Avatar answered Sep 20 '22 23:09

brianlmoon