From e0a9b0c0551eb98d031bec1d4bd621d3e4796977 Mon Sep 17 00:00:00 2001 From: Konstantin Kalin <kkalin@mirantis.com> Date: Mon, 28 Dec 2015 10:42:28 -0800 Subject: [PATCH] Optimize sending of a reply in RPC server RPC server uses direct_send method to send replies. The method sets "passive" flag on an exchange. Thus auto_declare doesn't bring any good there, but it costs an additional "exchange.declare" call to RabbitMQ. simulator.py RPC tests shows that a perfomance gain is ~7% Change-Id: Ia9f5f9f52c6cb324eca4ca6a63e80d604ddefa23 --- oslo_messaging/_drivers/impl_rabbit.py | 1 + 1 file changed, 1 insertion(+) diff --git a/oslo_messaging/_drivers/impl_rabbit.py b/oslo_messaging/_drivers/impl_rabbit.py index 1f75b3349..9470b9d9f 100644 --- a/oslo_messaging/_drivers/impl_rabbit.py +++ b/oslo_messaging/_drivers/impl_rabbit.py @@ -974,6 +974,7 @@ class Connection(object): """Publish a message.""" producer = kombu.messaging.Producer(exchange=exchange, channel=self.channel, + auto_declare=not exchange.passive, routing_key=routing_key) expiration = None