0

I found a rather interesting problem today. I have a queue with 2K messages in it. The consumer:

import rabbitpy
with rabbitpy.Connection('amqp://guest:guest@localhost:5672/%2f') as conn:
    with conn.channel() as channel:
        queue = rabbitpy.Queue(channel, 'example')
        for message in queue.consume_messages():
            message.ack()
takes 41 seconds to get these messages and ack them. (messages vary from 4kB to 52kB) The publisher, however, took 15 seconds to publish them.

Upon profiling, I found that there is a call to sleep were we spend 86% of the time. This, to my application, is not acceptable. Could someone help me get rid of this sleep? (I'm ok if the CPU cycles are wasted or whatever till a message arrives.)

Zoomed in screenshot The culprit found by the profiler

Lelouch Lamperouge
  • 8,171
  • 8
  • 49
  • 60

0 Answers0