[LRUG] AMQP threads. Where did my messages go?
Simon Morley
simon at polkaspots.com
Fri Mar 21 04:47:59 PDT 2014
Morning All
Having asked SO, I remembered we were supposed to be encouraging more
questions here! I hope you can help (sorry this is a long message).
Relatively new to the world of RabbitMQ, I'm getting stuck debugging the
problem of missing messages. All was / is fine in my dev. environment, the
problems arise when we start chucking thousand of messages at things.
I've narrowed the problem down to messages that are sent from within
another job. For example, we have a job that moves a customer's
subscription when they sign up. We publish this to our rabbit servers using
the AMQP gem and EM using something like this:
https://gist.github.com/simonmorley/9684010
def queue_process_subscription
user. process_subscription
end
def process_subscription
hammer_time
MESSAGE_QUEUE.push(json_message, 'ps.routing.key')
end
After the job's been completed, we use MESSAGE_QUEUE to push a message to
our notification servers (which run NodeJS, node-amqp and SocketIO).
On my lonely laptop, the jobs process perfectly, the notification are sent
and my SocketIO client receives them. Happy days.
On my production servers, the job is queued in RabbitMq, processed
perfectly and the notification is published apparently. The problem is, it
doesn't appear to be received by the node amqp consumer 100% of the time.
Maybe 1 in 10 get delivered (and sometimes they don't look like the full
message). The rest just vanish.. It gets worse as we load the servers up.
I thought it was the AMQP on the Node servers but I created a loop to run
MESSAGE_QUEUE 10,000 times and they were all consumed..
So, I'm assuming the problem is that we're sending a message from within
another thread. At least, that's what I think it is. My knowledge of such
things has now come to an end...
We've now replaced the last notification with Redis publish which works a
treat. But that's another cog to think about.
Like I said, I'm new to this messaging / threading stuff, and would
appreciate it if someone can point me in the right direction, tell me what
to read or suggestion something else to try. Or tell me to give up and go
home.
Cheers
Simon
Simon Morley
Big Chief | PolkaSpots Supafly Wi-Fi
simon at PolkaSpots.com
020 7183 1471
@polkaspots
---------------------------------------------------------------------------------------
The information contained in this email and its attachments is confidential and may be the subject of legal, professional or other privilege. It is intended only for the named addressees and may not be disclosed to anyone else without consent from PolkaSpots Limited. If you are not the named addressee you must not use, disclose, distribute, copy, print or rely on the contents of this email and should destroy it immediately. Whilst PolkaSpots Limited takes care to protect its systems from electronic virus attack or other harmful event, the firm gives no warranty that this email message (including any attachments to it) is free of any virus or other harmful matter and accepts no responsibility for any loss or damage resulting from the recipient receiving, opening or using it. If you need any further information, please contact the originator of this message on +44 (0) 20 7183 1471.
PolkaSpots Limited is registered in the UK, number 05508105. Registered Office: 62 Britton Street (behind the bike sheds), Clerkenwell, London EC1M 5UY
Website: polkaspots.com
WiFi Shop: shop.polkaspots.com
Blog: polkaspots.com/blog
---------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140321/b59f5546/attachment-0003.html>
More information about the Chat
mailing list