From 08b6ab7e60a3c8cce985e9f5362a785b75e9ef43 Mon Sep 17 00:00:00 2001 From: Andrew Stitcher Date: Mon, 5 Mar 2012 19:12:12 +0000 Subject: QPID-3883: Using application headers in messages causes a very large slowdown Change perftest to allow it add headers to messages git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1297181 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/tests/qpid-perftest.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/qpid/cpp/src/tests/qpid-perftest.cpp b/qpid/cpp/src/tests/qpid-perftest.cpp index 664f0cf877..c28bdfe5f8 100644 --- a/qpid/cpp/src/tests/qpid-perftest.cpp +++ b/qpid/cpp/src/tests/qpid-perftest.cpp @@ -85,6 +85,7 @@ struct Opts : public TestOptions { size_t pubs; size_t count ; size_t size; + size_t headers; bool confirm; bool durable; bool uniqueData; @@ -112,7 +113,7 @@ struct Opts : public TestOptions { Opts() : TestOptions(helpText), setup(false), control(false), publish(false), subscribe(false), baseName("qpid-perftest"), - pubs(1), count(500000), size(1024), confirm(true), durable(false), uniqueData(false), syncPub(false), + pubs(1), count(500000), size(1024), headers(0), confirm(true), durable(false), uniqueData(false), syncPub(false), subs(1), ack(0), qt(1),singleConnect(false), iterations(1), mode(SHARED), summary(false), intervalSub(0), intervalPub(0), tx(0), txPub(0), txSub(0), commitAsync(false) @@ -131,6 +132,7 @@ struct Opts : public TestOptions { ("npubs", optValue(pubs, "N"), "Create N publishers.") ("count", optValue(count, "N"), "Each publisher sends N messages.") ("size", optValue(size, "BYTES"), "Size of messages in bytes.") + ("headers", optValue(headers, "N"), "Number of headers to add to each message.") ("pub-confirm", optValue(confirm, "yes|no"), "Publisher use confirm-mode.") ("durable", optValue(durable, "yes|no"), "Publish messages as durable.") ("unique-data", optValue(uniqueData, "yes|no"), "Make data for each message unique.") @@ -503,7 +505,13 @@ struct PublishThread : public Client { Message msg(data, routingKey); if (opts.durable) msg.getDeliveryProperties().setDeliveryMode(framing::PERSISTENT); - + if (opts.headers) { + for (size_t i = 0; i < opts.headers; ++i) { + std::stringstream h; + h << "hdr" << i; + msg.getMessageProperties().getApplicationHeaders().setString(h.str(), h.str()); + } + } if (opts.txPub){ session.txSelect(); -- cgit v1.2.1