Low-latency, large-scale message queuing

@MSalters

Re ‘message queue’:

RabbitMQ’s default operation is exactly what you describe: transient pubsub. But with TCP instead of UDP.

If you want guaranteed eventual delivery and other persistence and recovery features, then you CAN have that too – it’s an option. That’s the whole point of RabbitMQ and AMQP — you can have lots of behaviours with just one message delivery system.

The model you describe is the DEFAULT behaviour, which is transient, “fire and forget”, and routing messages to wherever the recipients are. People use RabbitMQ to do multicast discovery on EC2 for just that reason. You can get UDP type behaviours over unicast TCP pubsub. Neat, huh?

Re UDP:

I am not sure if UDP would be useful here. If you turn off Nagling then RabbitMQ single message roundtrip latency (client-broker-client) has been measured at 250-300 microseconds. See here for a comparison with Windows latency (which was a bit higher) http://old.nabble.com/High%28er%29-latency-with-1.5.1–p21663105.html

I cannot think of many multiplayer games that need roundtrip latency lower than 300 microseconds. You could get below 300us with TCP. TCP windowing is more expensive than raw UDP, but if you use UDP to go faster, and add a custom loss-recovery or seqno/ack/resend manager then that may slow you down again. It all depends on your use case. If you really really really need to use UDP and lazy acks and so on, then you could strip out RabbitMQ’s TCP and probably pull that off.

I hope this helps clarify why I recommended RabbitMQ for Jon’s use case.

Leave a Comment