You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2020/03/31 16:32:47 UTC
[qpid-cpp] branch master updated: QPID-8430: Reduce memory
consumption of AMQP 0-10 messages when rerouted by preventing deep copy of
non-persistent messages. AMQP 1.0 memory consumption is unchanged.
This is an automated email from the ASF dual-hosted git repository.
kpvdr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-cpp.git
The following commit(s) were added to refs/heads/master by this push:
new c17d978 QPID-8430: Reduce memory consumption of AMQP 0-10 messages when rerouted by preventing deep copy of non-persistent messages. AMQP 1.0 memory consumption is unchanged.
c17d978 is described below
commit c17d978d02dc0f1624970f447e2d1e3572b62f35
Author: Kim van der Riet <kp...@apache.org>
AuthorDate: Tue Mar 31 12:32:31 2020 -0400
QPID-8430: Reduce memory consumption of AMQP 0-10 messages when rerouted by preventing deep copy of non-persistent messages. AMQP 1.0 memory consumption is unchanged.
---
src/qpid/broker/Message.cpp | 2 +-
src/qpid/broker/PersistableMessage.h | 1 +
src/qpid/broker/amqp/Message.cpp | 4 ++++
src/qpid/broker/amqp/Message.h | 1 +
src/qpid/broker/amqp_0_10/MessageTransfer.cpp | 4 ++++
src/qpid/broker/amqp_0_10/MessageTransfer.h | 1 +
6 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/qpid/broker/Message.cpp b/src/qpid/broker/Message.cpp
index d8450f6..6f28864 100644
--- a/src/qpid/broker/Message.cpp
+++ b/src/qpid/broker/Message.cpp
@@ -172,7 +172,7 @@ void Message::addAnnotation(const std::string& key, const qpid::types::Variant&
void Message::annotationsChanged()
{
- if (persistentContext) {
+ if (persistentContext && persistentContext->isMergeRequired()) {
uint64_t id = persistentContext->getPersistenceId();
persistentContext = persistentContext->merge(getAnnotations());
persistentContext->setIngressCompletion(sharedState);
diff --git a/src/qpid/broker/PersistableMessage.h b/src/qpid/broker/PersistableMessage.h
index cfcf8f0..2f1d3dc 100644
--- a/src/qpid/broker/PersistableMessage.h
+++ b/src/qpid/broker/PersistableMessage.h
@@ -86,6 +86,7 @@ class PersistableMessage : public Persistable
virtual void decodeHeader(framing::Buffer& buffer) = 0;
virtual void decodeContent(framing::Buffer& buffer) = 0;
virtual uint32_t encodedHeaderSize() const = 0;
+ virtual bool isMergeRequired() const = 0;
virtual boost::intrusive_ptr<PersistableMessage> merge(const std::map<std::string, qpid::types::Variant>& annotations) const = 0;
};
diff --git a/src/qpid/broker/amqp/Message.cpp b/src/qpid/broker/amqp/Message.cpp
index 2e19c9a..b0ac6b9 100644
--- a/src/qpid/broker/amqp/Message.cpp
+++ b/src/qpid/broker/amqp/Message.cpp
@@ -514,6 +514,10 @@ void Message::decodeHeader(framing::Buffer& buffer)
}
void Message::decodeContent(framing::Buffer& /*buffer*/) {}
+bool Message::isMergeRequired() const {
+ return true;
+}
+
boost::intrusive_ptr<PersistableMessage> Message::merge(const std::map<std::string, qpid::types::Variant>& added) const
{
//message- or delivery- annotations? would have to determine that from the name, for now assume always message-annotations
diff --git a/src/qpid/broker/amqp/Message.h b/src/qpid/broker/amqp/Message.h
index 67b99a6..fd5a036 100644
--- a/src/qpid/broker/amqp/Message.h
+++ b/src/qpid/broker/amqp/Message.h
@@ -86,6 +86,7 @@ class Message : public qpid::broker::Message::SharedStateImpl, private qpid::amq
void decodeHeader(framing::Buffer& buffer);
void decodeContent(framing::Buffer& buffer);
uint32_t encodedHeaderSize() const;
+ bool isMergeRequired() const;
boost::intrusive_ptr<PersistableMessage> merge(const std::map<std::string, qpid::types::Variant>& annotations) const;
static const Message& get(const qpid::broker::Message&);
diff --git a/src/qpid/broker/amqp_0_10/MessageTransfer.cpp b/src/qpid/broker/amqp_0_10/MessageTransfer.cpp
index 7b64226..99480b2 100644
--- a/src/qpid/broker/amqp_0_10/MessageTransfer.cpp
+++ b/src/qpid/broker/amqp_0_10/MessageTransfer.cpp
@@ -465,6 +465,10 @@ std::string MessageTransfer::getUserId() const
}
MessageTransfer::MessageTransfer(const qpid::framing::FrameSet& f) : frames(f), requiredCredit(0) {}
+bool MessageTransfer::isMergeRequired() const {
+ return isPersistent();
+}
+
boost::intrusive_ptr<PersistableMessage> MessageTransfer::merge(const std::map<std::string, qpid::types::Variant>& annotations) const
{
boost::intrusive_ptr<MessageTransfer> clone(new MessageTransfer(this->frames));
diff --git a/src/qpid/broker/amqp_0_10/MessageTransfer.h b/src/qpid/broker/amqp_0_10/MessageTransfer.h
index af7dfbb..894b393 100644
--- a/src/qpid/broker/amqp_0_10/MessageTransfer.h
+++ b/src/qpid/broker/amqp_0_10/MessageTransfer.h
@@ -114,6 +114,7 @@ class MessageTransfer : public qpid::broker::Message::SharedStateImpl, public qp
* but other meta data e.g.routing key and exchange)
*/
uint32_t encodedHeaderSize() const;
+ bool isMergeRequired() const;
boost::intrusive_ptr<PersistableMessage> merge(const std::map<std::string, qpid::types::Variant>& annotations) const;
QPID_BROKER_EXTERN bool isQMFv2() const;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org