Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-7677

[C++ broker] broker requires much more memory for AMQP1.0 subscription than for 0-10 one

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.32, qpid-cpp-1.36.0
    • qpid-cpp-1.37.0
    • C++ Broker

    Description

      Having an AMQP 1.0 consumer of a queue increases memory usage of qpidd by much more than having an AMQP 0-10 consumer - the difference is approx. 0.5MB.

      This affects scalable usage of the broker, where having thousands of 1.0 consumers require gigabytes of memory.

      Trivial test:

      qpid-config add queue qqq
      
      for i in $(seq 1 10); do qpid-receive -a qqq -f & sleep 0.1; done
      
      # this added small 26kB VSZ and 75kB RSS per one consumer/receiver
      
      for i in $(seq 1 10); do qpid-receive -a qqq -f --connection-options "{protocol:'amqp1.0'}" & sleep 0.1; done
      
      # this added 640kB VSZ and 805kB RSS per one consumer/receiver
      

      Better test: have multiple consumers on the same AMQP connection (I can provide such program in case of interest).

      Running such scenario under valgrind/massif showed the extra memory is consumed by:

      ->91.90% (143,361,792B) 0x5D544F1: qpid::broker::amqp::OutgoingFromQueue::OutgoingFromQueue(qpid::broker::Broker&, std::string const&, std::string const&, boost::shared_ptr<qpid::broker::Queue>, pn_link_t*, qpid::broker::amqp::Session&, qpid::sys::OutputControl&, qpid::broker::SubscriptionType, bool, bool) (Outgoing.h:57)

      And really, when I changed in:

      https://github.com/apache/qpid-cpp/blob/master/src/qpid/broker/amqp/Outgoing.cpp#L68

      the "deliveries(5000)" to "deliveries(50)", memory consumption dramatically decreased.

      I don't understand this part of code, but please make the "CircularArray<Record> deliveries(5000)" more memory efficient.

      Attachments

        1. memdiff.sh
          1 kB
          Alan Conway

        Activity

          People

            aconway Alan Conway
            pmoravec Pavel Moravec
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: