[rabbitmq-discuss] How can I set socket timeouts in PHP using the AMQP PHP extension?
Gavin M. Roy
gmr at myyearbook.com
Wed Jun 29 14:47:17 BST 2011
Cool, I meant persistent, such as with the mysql_pconnect or pgsql_pconnect.
Thanks for the work on amqphp, will look deeper at it for use in other
areas. I'm glad there is an active, maintained client!
On Wed, Jun 29, 2011 at 4:08 AM, Robin Harvey <harvey.robin at gmail.com>wrote:
> BTW, Gavin, on this point:
> > iirc the existing implementations do not have connection pooling
> I've recently updated amqphp so that you can manage multiple connections at
> the same time, so for example you can connect to and consume from 2 or more
> different brokers at the same time. There's a demo here:
> On Wed, Jun 29, 2011 at 4:08 AM, Gavin M. Roy <gmr at myyearbook.com> wrote:
>> While not directly related to your question and you've not specified your
>> use case, I have found trying to use native AMQP drivers in my PHP
>> application as having too much overhead for connection management and iirc
>> the existing implementations do not have connection pooling. This means lots
>> of startup time and overhead on every request. To get around this we created
>> a HTTP library that talks to the RabbitMQ JSON RPC Channel plugin. If all
>> you are doing is publishing, you might want to check out VorpalBunny:
>> As far as the underlying implementation, it's worth noting that the
>> rabbitmq-c library is considered experimental. While we use it in our C
>> applications in production, I can't say that we use the PHP extension on top
>> of it. The PHP site has fatal errors for me right now so I can't look up to
>> see which PHP extension the code is based on, otherwise I'd poke into the
>> code and let you know if there are any timeout settings.
>> On Tuesday, June 28, 2011 at 6:44 PM, Keith Krueger wrote:
>> > I am using the PHP AMQP extension, as described here:
>> > http://php.net/manual/en/book.amqp.php
>> > This PHP extension uses the rabbitmq-c library as its underlying
>> > I would like to set socket timeouts for connection establishment and for
>> each of my enqueues and dequeues. I want to do this in case our server
>> performance degrades, to allow the clients to fail quickly rather than hang.
>> > Does anyone have experience doing this in a PHP environment? I have
>> tried setting the PHP socket timeout as follows.
>> > ini_set('default_socket_timeout', 5);
>> > This appears to have no impact on the PHP extension's timeout settings.
>> I am still able to enqueue a multi-megabyte MQ message to rabbitmq without
>> losing the socket connection. It takes about 75 seconds to enqueue this
>> message, but the socket is kept open the entire time.
>> > Is there any support either in the PHP AMQP extension or in a different
>> PHP setting that I can use to reduce the timeouts for our interactions with
>> RabbitMQ? I'd rather not live with a potential problem of hanging client
>> processes if I can avoid it.
>> > Thanks,
>> > -Keith
>> > _______________________________________________
>> > rabbitmq-discuss mailing list
>> > rabbitmq-discuss at lists.rabbitmq.com (mailto:
>> rabbitmq-discuss at lists.rabbitmq.com)
>> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rabbitmq-discuss