[rabbitmq-discuss] php pecl and max channel reached with php-fpm

B3aT(at)gmail aditza8 at gmail.com
Tue May 27 08:34:26 BST 2014


Hello and thanks for the answers.

I cannot reuse the channels, requests processed trough fpm do not share
resources at app level.
PHP-amqplib cannot be used, is way too slow because it doesn't support
persistent connections (is minimum 6x times slower then the pecl one, and
slows down the entire apps to a factor of 4-5, we tested it in production),
and s all because this line of code (new AMQPConnection...).

I think php-amqplib reuse the channels, I can mark them as DURABLE, and
have a specific name, but the PECL one it doesn't, you must create a new
channel every time.

I will try to close them at the end of the request, but I thought it
automatically does that when the script ends.

With PECL we have multiple persistent connections per server, and each
connection process hundreds of requests, so far the problem didn't appeared
in production tests, maybe because the fpm workers are limited to a small
number of requests.


/********************************
@author *B.G. Adrian*
@as *Game developer*
@from www.*btools*.eu
@games www.*bcardgames.com*
@work www.*mavenhut*.com
*********************************/


On Tue, May 27, 2014 at 9:38 AM, Alvaro Videla <videlalvaro at gmail.com>wrote:

> As MK said, be sure to either close the channels after you don't need
> them, or reuse them. For me it seems that you are keeping persistent
> connections and then you open one channel per request, but you don't close
> the channel at the end, therefore the channels are "leaking", and thus your
> problem.
>
> Regards,
>
> Alvaro
>
>
> On Tue, May 27, 2014 at 7:25 AM, Michael Klishin <mklishin at gopivotal.com>wrote:
>
>>  On 27 May 2014 at 03:00:50, BeaT Adrian (aditza8 at gmail.com) wrote:
>> > > After a while (I guess 65500 requests) a problem occurs halting
>> > all writes
>> > "Could not create channel. Connection has no open channel slots
>> > remaining"
>> >
>> > From what I have read in the sources is because every tcp connection
>> > have an autoincrement channel ID that reaches its max. This happens
>> > because every request must use the channel, and is no way to use
>> > the same channel ( I could not find a way into the php-amqp channel
>> > classs to make it persistent) and scripts cannot communicate
>> > ( to use the same instance of the channel as php object).
>>
>> Every AMQP 0-9-1 connection has 1 or more channels (the max is negotiated
>> between client and server, so this can be limited by the broker). If you
>> open a lot of channels, you need to close them, or use more than 1
>> connection
>> (which in turn will use more than 1 TCP connection).
>>
>> Both channels and especially connections in practice take up some
>> resources.
>> It is very rare that an app actually needs 1000s or 10s of 1000s of
>> channels.
>>
>> See http://www.rabbitmq.com/tutorials/amqp-concepts.html if you need a
>> more
>> detailed explanation.
>>
>> By the way, it is highly recommended that you use
>> https://github.com/videlalvaro/php-amqplib
>> and not the PECL extension (which is not actively maintained AFAIK).
>> --
>> MK
>>
>> Software Engineer, Pivotal/RabbitMQ
>> _______________________________________________
>> rabbitmq-discuss mailing list
>> rabbitmq-discuss at lists.rabbitmq.com
>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140527/134d0eb8/attachment.html>


More information about the rabbitmq-discuss mailing list