This is an automated email from the ASF dual-hosted git repository.
zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 2e49a1a default enable cpp client producer batch (#2949)
2e49a1a is described below
commit 2e49a1a3397063cb6fba8259b1bff9be60ad2582
Author: Jia Zhai <[email protected]>
AuthorDate: Wed Nov 14 22:09:44 2018 +0800
default enable cpp client producer batch (#2949)
Motivation
In Cpp client producer batching is disabled by default, This is not align
with java client, and use default value will cause benchmark has a low result.
Modifications
default enable cpp producer batch
---
pulsar-client-cpp/lib/ProducerConfigurationImpl.h | 2 +-
pulsar-client-cpp/tests/BasicEndToEndTest.cc | 5 ++++-
pulsar-client-cpp/tests/ReaderTest.cc | 8 +++++---
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/pulsar-client-cpp/lib/ProducerConfigurationImpl.h
b/pulsar-client-cpp/lib/ProducerConfigurationImpl.h
index 6dfaeed..cc5b9b7 100644
--- a/pulsar-client-cpp/lib/ProducerConfigurationImpl.h
+++ b/pulsar-client-cpp/lib/ProducerConfigurationImpl.h
@@ -53,7 +53,7 @@ struct ProducerConfigurationImpl {
routingMode(ProducerConfiguration::UseSinglePartition),
hashingScheme(ProducerConfiguration::BoostHash),
blockIfQueueFull(false),
- batchingEnabled(false),
+ batchingEnabled(true),
batchingMaxMessages(1000),
batchingMaxAllowedSizeInBytes(128 * 1024), // 128 KB
batchingMaxPublishDelayMs(10), // 10 milli seconds
diff --git a/pulsar-client-cpp/tests/BasicEndToEndTest.cc
b/pulsar-client-cpp/tests/BasicEndToEndTest.cc
index 122a643..396eba7 100644
--- a/pulsar-client-cpp/tests/BasicEndToEndTest.cc
+++ b/pulsar-client-cpp/tests/BasicEndToEndTest.cc
@@ -1080,6 +1080,7 @@ TEST(BasicEndToEndTest, testProduceMessageSize) {
Promise<Result, Producer> producerPromise2;
ProducerConfiguration conf;
conf.setCompressionType(CompressionLZ4);
+ conf.setBatchingEnabled(false);
client.createProducerAsync(topicName, conf,
WaitForCallbackValue<Producer>(producerPromise2));
producerFuture = producerPromise2.getFuture();
result = producerFuture.get(producer2);
@@ -1267,6 +1268,7 @@ TEST(BasicEndToEndTest, testEncryptionFailure) {
{
ProducerConfiguration prodConf;
prodConf.setCryptoKeyReader(keyReader);
+ prodConf.setBatchingEnabled(false);
prodConf.addEncryptionKey("client-non-existing-rsa.pem");
Promise<Result, Producer> producerPromise;
@@ -1282,6 +1284,7 @@ TEST(BasicEndToEndTest, testEncryptionFailure) {
{
ProducerConfiguration prodConf;
prodConf.setCryptoKeyReader(keyReader);
+ prodConf.setBatchingEnabled(false);
prodConf.addEncryptionKey("client-rsa.pem");
Promise<Result, Producer> producerPromise;
@@ -2158,4 +2161,4 @@ TEST(BasicEndToEndTest,
testSyncFlushBatchMessagesPartitionedTopic) {
producer.close();
client.shutdown();
-}
\ No newline at end of file
+}
diff --git a/pulsar-client-cpp/tests/ReaderTest.cc
b/pulsar-client-cpp/tests/ReaderTest.cc
index 1f293c9..fd6cf5d 100644
--- a/pulsar-client-cpp/tests/ReaderTest.cc
+++ b/pulsar-client-cpp/tests/ReaderTest.cc
@@ -363,7 +363,7 @@ TEST(ReaderTest, testReaderReachEndOfTopic) {
client.close();
}
-TEST(ReaderTest, testReaderReachEndOfTopicMessageWithBatches) {
+TEST(ReaderTest, testReaderReachEndOfTopicMessageWithoutBatches) {
Client client(serviceUrl);
std::string topicName =
@@ -371,7 +371,9 @@ TEST(ReaderTest,
testReaderReachEndOfTopicMessageWithBatches) {
// 1. create producer
Producer producer;
- ASSERT_EQ(ResultOk, client.createProducer(topicName, producer));
+ ProducerConfiguration producerConf;
+ producerConf.setBatchingEnabled(false);
+ ASSERT_EQ(ResultOk, client.createProducer(topicName, producerConf,
producer));
// 2. create reader, and expect hasMessageAvailable return false since no
message produced.
ReaderConfiguration readerConf;
@@ -415,4 +417,4 @@ TEST(ReaderTest,
testReaderReachEndOfTopicMessageWithBatches) {
producer.close();
reader.close();
client.close();
-}
\ No newline at end of file
+}