Problems with binary protocol and memcached PECL extension
Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay
Re: Problems with binary protocol and memcached PECL extension
does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay
Re: Problems with binary protocol and memcached PECL extension
It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moon br...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay
Re: Problems with binary protocol and memcached PECL extension
and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay
Re: Problems with binary protocol and memcached PECL extension
What server version are you using? Trond On Wednesday, January 6, 2010, Brian Moon br...@moonspot.net wrote: and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay -- Trond Norbye
Re: Problems with binary protocol and memcached PECL extension
1.4.4 On Jan 6, 5:07 pm, Trond Norbye trond.nor...@gmail.com wrote: What server version are you using? Trond On Wednesday, January 6, 2010, Brian Moon br...@moonspot.net wrote: and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay -- Trond Norbye
Re: Problems with binary protocol and memcached PECL extension
Try running your server from a console and add -vvv to the command line. Does ti print out any progress? On Wednesday, January 6, 2010, Jay Paroline boxmon...@gmail.com wrote: 1.4.4 On Jan 6, 5:07 pm, Trond Norbye trond.nor...@gmail.com wrote: What server version are you using? Trond On Wednesday, January 6, 2010, Brian Moon br...@moonspot.net wrote: and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay -- Trond Norbye -- Trond Norbye
Re: Problems with binary protocol and memcached PECL extension
This is very odd. If I run it from the command line (with or without vv) it works as expected. If it starts from init.d it doesn't work. [r...@rhd011 test]# /etc/init.d/memcached start Starting memcached:[ OK ] [r...@rhd011 test]# ps aux | grep memcached 101 29441 0.0 0.0 52448 1008 ?Ssl 20:07 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/ memcached.pid ^^the above does not work [r...@rhd011 test]# /etc/init.d/memcached stop Stopping memcached:[ OK ] [r...@rhd011 test]# memcached -d -p 11211 -u memcached -m 64 -c 1024 - P /var/run/memcached/memcached.pid [r...@rhd011 test]# ps aux | grep memcached 101 29473 0.0 0.0 128064 996 ?Ssl 20:09 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/ memcached.pid ^^the above works What the heck is the difference? Jay On Jan 6, 5:15 pm, Trond Norbye trond.nor...@gmail.com wrote: Try running your server from a console and add -vvv to the command line. Does ti print out any progress? On Wednesday, January 6, 2010, Jay Paroline boxmon...@gmail.com wrote: 1.4.4 On Jan 6, 5:07 pm, Trond Norbye trond.nor...@gmail.com wrote: What server version are you using? Trond On Wednesday, January 6, 2010, Brian Moon br...@moonspot.net wrote: and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay -- Trond Norbye -- Trond Norbye
Re: Problems with binary protocol and memcached PECL extension
Ok, I'm officially semi-retarded. Apparently when I did a make install of the latest version of memcached on our dev server it installed in / usr/local/bin but the old version was still in /usr/bin -- when I ran the daemon it ran from /usr/local/bin but the init.d script was running it from /usr/bin I made a sym link from /usr/bin to /usr/local/bin and restarted, and it works like magic. Jay On Jan 6, 8:11 pm, Jay Paroline boxmon...@gmail.com wrote: This is very odd. If I run it from the command line (with or without vv) it works as expected. If it starts from init.d it doesn't work. [r...@rhd011 test]# /etc/init.d/memcached start Starting memcached: [ OK ] [r...@rhd011 test]# ps aux | grep memcached 101 29441 0.0 0.0 52448 1008 ? Ssl 20:07 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/ memcached.pid ^^the above does not work [r...@rhd011 test]# /etc/init.d/memcached stop Stopping memcached: [ OK ] [r...@rhd011 test]# memcached -d -p 11211 -u memcached -m 64 -c 1024 - P /var/run/memcached/memcached.pid [r...@rhd011 test]# ps aux | grep memcached 101 29473 0.0 0.0 128064 996 ? Ssl 20:09 0:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /var/run/memcached/ memcached.pid ^^the above works What the heck is the difference? Jay On Jan 6, 5:15 pm, Trond Norbye trond.nor...@gmail.com wrote: Try running your server from a console and add -vvv to the command line. Does ti print out any progress? On Wednesday, January 6, 2010, Jay Paroline boxmon...@gmail.com wrote: 1.4.4 On Jan 6, 5:07 pm, Trond Norbye trond.nor...@gmail.com wrote: What server version are you using? Trond On Wednesday, January 6, 2010, Brian Moon br...@moonspot.net wrote: and what versions of libmemcached and pecl/memcached are you using? php -i can tell you that. Brian. http://brian.moonspot.net/ On 1/6/10 3:45 PM, Jay Paroline wrote: It looks like both/either. I added print statements in front of each, and it doesn't get to the get. If I comment out the set, then it hangs on the get. Thanks, Jay On Jan 6, 4:43 pm, Brian Moonbr...@moonspot.net wrote: does the get or the set hold it up? Brian. http://brian.moonspot.net/ On 1/6/10 3:38 PM, Jay Paroline wrote: Hi guys, I posted this to the libmemcached mailing list a while ago and didn't get a response, but this list is a lot more active so I'm hoping someone here will have answers for me. :) I've taken some time to work on porting our code from using the PHP PECL memcache extension to using the PECL memcached extension so we can take advantage of all the advanced functionality that libmemcached has to offer, but I'm running into some issues using the binary protocol. Here is my code: ?php $servers = array(array('localhost', '11211')); $m = new Memcached(); $m-addServers($servers); $m-setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT); $m-setOption(Memcached::OPT_CONNECT_TIMEOUT, 500); $m-setOption(Memcached::OPT_SEND_TIMEOUT, 500); $m-setOption(Memcached::OPT_RECV_TIMEOUT, 500); $m-setOption(Memcached::OPT_BINARY_PROTOCOL, true); $m-setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1); $m-set('foo', '100'); var_dump($m-get('foo')); ? If I run this, the script never finishes executing. If I change OPT_BINARY_PROTOCOL to false, it instantly returns with the results. So the two major issues are that it doesn't seem to be obeying my timeout settings, and of course the binary protocol doesn't seem to be working. Is there something I need to change on the server end to support binary protocol? I'm running version 1.4.4 of memcached and have the latest libmemcached and PECL memcached extensions installed. Thanks! Jay -- Trond Norbye -- Trond Norbye