On 02/25/2010 11:51 AM, David Stewart wrote:
Hi all,
we are running a bridge between our old middleware and qpid system which at
startup queries the existing middleware for the number of broadcast groups it
knows about. It is a pricing system so there are ~20000.
The bridge creates a fanout exchange for each broadcast group, creates a queue
and binds it to the exchange. All this takes ~75 seconds for 20000. Not a
problem.
When we add a SubscriptionManager.subscribe() to the loop we get though 1000
requests in ~3 minutes.
I have created an example below which exhibits the problem. The question are we
using the SubscriptionManager incorrectly? Is there a better way for us to
achieve the result we require?
for (int i=0; i< 20000; ++i) {
std::stringstream ss; ss<< "listener"<< i;
// Try and declare the exchange. Will succeed even if it already
exists.
oSession.exchangeDeclare(qpid::client::arg::exchange=ss.str(),
qpid::client::arg::type="fanout",
qpid::client::arg::alternateExchange=std::string(),
qpid::client::arg::passive=false,
qpid::client::arg::durable=true);
oSession.queueDeclare(qpid::client::arg::queue=ss.str(),
qpid::client::arg::exclusive=true,
qpid::client::arg::autoDelete=false);
oSession.exchangeBind(qpid::client::arg::exchange=ss.str(),
qpid::client::arg::queue=ss.str(),
qpid::client::arg::bindingKey=ss.str());
oSubscriptionManager.subscribe(*this, ss.str());
}
The Session calls above are synchronous, you can make them asynchronous by
doing:
async(oSession).exchangeDeclare() etc.
That will probably make a big difference. Unfortunately there isn't currently a
way to make the SessionManager::subscribe() call asynchronous. You might get
better mileage by doing the asynchronous declare/bind in one loop and the
subscribe()s in another.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]