How do HornetQ, RabbitMQ, Kafka, SQS and MongoDB compare performance-wise? What kind of features do they offer if you want to do persistent, replicated messaging?
2. @adamwarski
About me
❖ coder @
❖ open-source: Supler, MacWire, Envers, …
❖ long time interest in message queues
❖ ElasticMQ - local SQS implementation
❖ http://www.warski.org / @adamwarski
7. @adamwarski
Why persistent & replicated?
❖ Reactive manifesto: responsive, resilient
❖ We want to be sure no messages are lost
❖ Brings new problems
❖ But, “it depends”
8. @adamwarski
Scenario: send
❖ Client wants to send a message
❖ If the request completes, we want to be sure that the
message will be eventually processed
❖ Making sure by:
❖ writing to disk
❖ replicating
11. @adamwarski
What is measured
❖ Number of messages per second sent & received
❖ Msg size: 100 bytes
❖ Other interesting metrics, not covered:
❖ Send latency
❖ Total msg processing time
❖ Resource consumption at a given msg rate
12. @adamwarski
Testing methodology
❖ Message broker: 3 nodes
❖ 1-4 nodes sending, 1-4 nodes receiving
❖ Each sender/receiver node: 1-25 threads
❖ Each thread:
❖ sending messages in batches, random size 1-10
(1-100/1-1000)
❖ receiving messages in batches, acknowledging
13. @adamwarski
Servers
❖ Single EC2 availability zone
❖ -> fast internal network
❖ m3.large
❖ 2 CPUs
❖ 7.5 GiB RAM
❖ 32GB SSD storage
19. @adamwarski
HornetQ notes
❖ Poor documentation of replication guarantees
❖ Poor documentation on network failure behaviours
❖ Very high load: primary node considered dead even
though working
27. @adamwarski
SQS replication
❖ We don’t really know ;)
❖ If a send completes, the message is replicated to
multiple nodes
❖ Unfair competition: might use multiple replicated
clusters with routing/load-balancing clients
28. @adamwarski
SQS operations
❖ Sending messages in batches
❖ Receiving messages in batches (long polling).
❖ Redelivery: after timeout (message blocked for some
time)
❖ Deleting (acknowledging) in batches
32. @adamwarski
❖ Different approach to messaging
❖ Streaming publish-subscribe system
❖ Topics with multiple partitions
❖ more partitions -> more concurrency
33. @adamwarski
Point-to-point messaging in Kafka
❖ Messages in each partition are processed in-order
❖ Consumers should consume at the same speed
❖ Messages can’t be selectively acknowledged, only “up
to offset”
❖ No “advanced” messaging options
36. @adamwarski
Kafka operations
❖ Send: blocks until accepted by partition leader, no
guarantees for replication
❖ Consumer offsets: committed every 10 seconds
manually; during that time, message receiving is
blocked
❖ Redelivery: starting from last known stream position
41. @adamwarski
Mongo operations
❖ Sending: in batches, waiting until the DB write
completes
❖ Receiving: find-and-modify, one-by-one
❖ Redelivery: after timeout (message blocked for some
time)
❖ Deleting: in batches, DB delete
44. @adamwarski
Summing up
❖ SQS: good performance, easy setup
❖ Mongo: no need to maintain separate system
❖ RabbitMQ: rich messaging options, good persistence
❖ HornetQ: good performance, many interfaces
❖ Kafka: best performance and scalability