[rabbitmq-discuss] chan.flow and vm_memory_high_watermark

Matthew Sackman matthew at rabbitmq.com
Tue Jun 8 15:05:35 BST 2010


Hi Nicolás,

On Tue, Jun 08, 2010 at 08:33:24AM -0300, Nicolás César wrote:
> ----- /etc/rabbitmq/rabbitmq.config ----
> [{rabbit, [{vm_memory_high_watermark, 0.2}]}].
> ------------------------------------------------------
> 
> I hit the maximum:
> ------ tail -f /var/log/rabbitmq/rabbit.log | grep -i memory ------
> vm_memory_high_watermark set. Memory used:434801384 allowed:429496729
>     alarm_handler: {set,{vm_memory_high_watermark,[]}}
> ------------------------------------------------------
> 
> 
> I'm  sopposed  to use channel.flow to stop the producer. My python code is:
> 
> -------------------------------------------
>         while not self.chan.flow(True):
>             sys.stdout.write("W")
>             sys.stdout.flush()
>             time.sleep(1)
> 
>         self.chan.basic_publish(msg,
>                                 exchange=self.config_amqp["exchange"],
>                                 routing_key=self.config_amqp['routing_key'])
> -------------------------------------------
> 
> What i'm doing wrong?

When you hit the memory watermark, the *server* sends to *you* the
channel.flow{active=false} which you're meant to acknowledge by sending
back a channel.flow_ok{active=false}. However, depending on which python
client you're using, this may not be implemented - I'm aware Tony's
produced an experimental patch for pyamqplib, and I'm not sure about the
status of flow control in Pika.

I think what you're doing is sending a channel.flow to the server which
is telling the server whether or not to send message to you, not the
other way around.

Matthew


More information about the rabbitmq-discuss mailing list