Skip to content

Commit

Permalink
[Pulsar C++ Client] make pool connections configurable in perf tools (a…
Browse files Browse the repository at this point in the history
…pache#8913)

### Motivation

make pool connections configurable in c++ performance test.
  • Loading branch information
ltamber authored Feb 15, 2021
1 parent fd9875c commit 530c128
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pulsar-client-cpp/perf/PerfConsumer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct Arguments {
int receiverQueueSize;
int ioThreads;
int listenerThreads;
bool poolConnections;
std::string encKeyName;
std::string encKeyValueFile;
};
Expand Down Expand Up @@ -174,7 +175,7 @@ void startPerfConsumer(const Arguments& args) {
conf.setAuth(auth);
}

Client client(pulsar::PulsarFriend::getClient(args.serviceURL, conf, false));
Client client(pulsar::PulsarFriend::getClient(args.serviceURL, conf, args.poolConnections));

ConsumerConfiguration consumerConf;
consumerConf.setMessageListener(messageListener);
Expand Down Expand Up @@ -299,6 +300,9 @@ int main(int argc, char** argv) {
("listener-threads,l", po::value<int>(&args.listenerThreads)->default_value(1),
"Number of listener threads") //

("pool-connections", po::value<bool>(&args.poolConnections)->default_value(false),
"whether pool connections used") //

("encryption-key-name,k", po::value<std::string>(&args.encKeyName)->default_value(""),
"The private key name to decrypt payload") //

Expand Down
6 changes: 5 additions & 1 deletion pulsar-client-cpp/perf/PerfProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct Arguments {
unsigned int batchingMaxMessages;
long batchingMaxAllowedSizeInBytes;
long batchingMaxPublishDelayMs;
bool poolConnections;
std::string encKeyName;
std::string encKeyValueFile;
std::string compression;
Expand Down Expand Up @@ -278,6 +279,9 @@ int main(int argc, char** argv) {
po::value<long>(&args.batchingMaxPublishDelayMs)->default_value(3000),
"Use only is batch-size > 1, Default is 3 seconds") //

("pool-connections", po::value<bool>(&args.poolConnections)->default_value(false),
"whether pool connections used") //

("encryption-key-name,k", po::value<std::string>(&args.encKeyName)->default_value(""),
"The public key name to encrypt payload") //

Expand Down Expand Up @@ -376,7 +380,7 @@ int main(int argc, char** argv) {
conf.setAuth(auth);
}

pulsar::Client client(pulsar::PulsarFriend::getClient(args.serviceURL, conf, false));
pulsar::Client client(pulsar::PulsarFriend::getClient(args.serviceURL, conf, args.poolConnections));

std::atomic<bool> exitCondition(false);
startPerfProducer(args, producerConf, client, exitCondition);
Expand Down

0 comments on commit 530c128

Please sign in to comment.