MessagePublisherper message, versus creating a unbound (
MessageProducerand using that to send all messages (
For the lazy and link-click-shy, this is a tiny benchmark of how to publish small messages as fast as possible against SonicMQ 7.5.1 using the 7.5 JMS driver.
There is a difference, but a pretty small one.
- Creating a single
producer.send(destination, message)gave me 32352mps sent.
- Creating a new
MessageProducerfor each new message/topic gave me 31847mps sent.
- This was definitely reproducible, and I ran each test many times to make sure I got a pretty consistent result.
So there's a minor performance enhancement (1.5%), but it's pretty small, and judging from network traffic, it's not actually hitting the wire for the new
MessageProducer, so it's entirely a local driver optimization.