I've created some load tests to compare Topic Exchange vs Header Exchange message publishing performance.
I've created 10 queues bound to a topic exchange. Each queue is using a different part of a routing key path. So, queue 1 is bound to a topic exchange with a routing key 1.*.*.*.*.*.*.*.*.* and queue 2 is bound with a routing key of *.2.*.*.*.*.*.*.*.*. The data is obviously fake but I have a system where we have at least 10 different dimensions that queues might be bound on.
Then I've created 10 queues bound to a header exchange with 10 different header names. So, header bound queue 1 is bound to the header "header-1: 1" and queue 10 is bound to "header-10: 10".
I'm using confirm channels with the publisher to verify that the published messages are actually committed to the durable queues (no consumers are bound to the queues).
I've found I can get around 2,500 messages published per second with the topic exchanges verse around 20,000 messages published per second with the header exchange.
Consuming from the queues that were populated via topic or header exchanges is the same. It makes no difference as far as I can tell. Consuming speeds from the queues are identical when the queue data is from disk and not live (because publishing speeds are irrelevant)
I'm pretty surprised about this. I've always thought header exchanges were slower.
Anyone out there have any experience with header vs topic exchange performance?
Thanks,