Topic Exchange Vs Header Exchange Publishing Performance

257 views
Skip to first unread message

bart...@gmail.com

unread,
Mar 8, 2022, 6:19:30 PM3/8/22
to rabbitmq-users
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,

Wes Peng

unread,
Mar 8, 2022, 7:37:49 PM3/8/22
to rabbitm...@googlegroups.com
Topic exchange using regex for matching which is maybe slower. You can test again with direct exchange VS header exchange.

Thanks

> --
> You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/fd5e63c4-0f7c-4ccc-9c3f-cda262496d70n%40googlegroups.com.
>
-------------------------------------------------------------------------------------------------
FreeMail powered by mail.de - MEHR SICHERHEIT, SERIOSITÄT UND KOMFORT

Reply all
Reply to author
Forward
0 new messages