On 02/26/2010 05:13 AM, David Stewart wrote:
The session was synchronous. Using the AsyncSession brought the 75 seconds down 
to 5-10 which is a fantastic improvement.
The bottleneck still appears to be the SessionManager though.

I should mention that we're running a vc90 C++ client against a vc90 C++ 
broker. Could the broker be the problem?
Should I see better performance from a linux broker?


I suspect the synchronous subscribe() is still the big hold up.
Attached patch adds a synchronous option to SubscriptionSettings

Use it like this:

    SubscriptionSettings settings;
    settings.synchronous = false;
    subs.subscribe(*this, queue, settings);

If it helps I'll consider committing it if there are no objections.

Gordon/Rafi: this raises an interesting question for the new APIs. It seems like async declare/bind/subscribe are important features for cases like this. This isn't the first such case, I seem to remember JPMC folks having a case where they were declaring large quantities of queues and needed it to be async.
commit 99b8b7274c68b5cfb39079be9d93acc5ac87244a
Author: Alan Conway <[email protected]>
Date:   Fri Feb 26 09:25:03 2010 -0500

    Added synchronous option to SubscriptionSettings.
    
    True by default, if false it makes the SessionManager::subscribe call asynchronous
    and makes all Session call asynchronous, e.g. setFlowControl.

diff --git a/qpid/cpp/include/qpid/client/SubscriptionSettings.h b/qpid/cpp/include/qpid/client/SubscriptionSettings.h
index b4cb302..97acc33 100644
--- a/qpid/cpp/include/qpid/client/SubscriptionSettings.h
+++ b/qpid/cpp/include/qpid/client/SubscriptionSettings.h
@@ -46,7 +46,7 @@ struct SubscriptionSettings
         AcquireMode acquire=ACQUIRE_MODE_PRE_ACQUIRED,
         unsigned int autoAck_=1,
         CompletionMode completion=COMPLETE_ON_DELIVERY
-    ) : flowControl(flow), acceptMode(accept), acquireMode(acquire), autoAck(autoAck_), completionMode(completion), exclusive(false) {}
+    ) : flowControl(flow), acceptMode(accept), acquireMode(acquire), autoAck(autoAck_), completionMode(completion), exclusive(false), synchronous(true) {}
 
     FlowControl flowControl;    ///@< Flow control settings. @see FlowControl
     /**
@@ -116,6 +116,18 @@ struct SubscriptionSettings
      * the queue while this subscription is active.
      */
     bool exclusive;
+
+    /**
+     * If true the subscription is made synchronously, i.e.  the
+     * subscribe() operation does not return until the broker has
+     * confirmed the subscription is complete.
+     *
+     * If false, subscribe() returns immediately. This is useful for
+     * creating a very large number of subscriptions, but you
+     * need to call sync() on the session after the calls to subscribe()
+     * to ensure they have all completed.
+     */
+    bool synchronous;
 };
 
 }} // namespace qpid::client
diff --git a/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp b/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp
index a8a0b47..902ddb1 100644
--- a/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp
+++ b/qpid/cpp/src/qpid/client/SubscriptionImpl.cpp
@@ -67,7 +67,7 @@ void SubscriptionImpl::setFlowControl(const FlowControl& f) {
     s.messageSetFlowMode(name, f.window); 
     s.messageFlow(name, CREDIT_UNIT_MESSAGE, f.messages); 
     s.messageFlow(name, CREDIT_UNIT_BYTE, f.bytes);
-    s.sync();
+    if (settings.synchronous) s.sync();
 }
 
 void SubscriptionImpl::grantCredit(framing::message::CreditUnit unit, uint32_t value) {

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to