I found a rather interesting problem today. I have a queue with 2K messages in it.
The consumer:
takes 41 seconds to get these messages and 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()
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.)