Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Intermittent test failure #280

Merged
merged 1 commit into from
Mar 7, 2017
Merged

fix Intermittent test failure #280

merged 1 commit into from
Mar 7, 2017

Conversation

rdhabalia
Copy link
Contributor

Motivation

Fix: #279 Intermittent test failure in BrokerServiceThrottlingTest.testLookupThrottlingForClientByBrokerInternalRetry

Modifications

Wait strategically for consumers to get reconnect with broker

@rdhabalia rdhabalia added this to the 1.17 milestone Mar 6, 2017
@rdhabalia rdhabalia self-assigned this Mar 6, 2017
@@ -265,6 +272,15 @@ public void testLookupThrottlingForClientByBrokerInternalRetry() throws Exceptio
pulsarClient.close();
}

private boolean isAllConsumersConnected(List<Consumer> consumers) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

areAllConsumersConnected

@merlimat merlimat merged commit fbdbddd into apache:master Mar 7, 2017
@rdhabalia rdhabalia deleted the s_t_t branch June 21, 2017 18:54
hrsakai pushed a commit to hrsakai/pulsar that referenced this pull request Dec 10, 2020
Previously, the producer maximum batch size was hard-coded to 128 KB.

Now, the produdcer maximum batch size is exposed via ProducerOptions
and defaults to 128 KB

Co-authored-by: Daniel Ferstay <dferstay@splunk.com>
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
…uf (apache#280)

Currently, KoP has some significant performance overhead in the conversion between Kafka's records and Pulsar's messages. For pure Kafka users, i.e. no Pulsar client is involved, the conversion is unnecessary.

So this PR provides a config `entry.format` to specify if the entry's format can be accepted by Pulsar clients. And a `EntryFormatter` is used to do the format conversion instead of static methods of `MessageRecordUtils`.

In future, we'll implement a new `EntryFormatter` to avoid this conversion so that the performance can be improved a lot. After that, users can choose whether to support Pulsar clients for KoP.
hangc0276 pushed a commit to hangc0276/pulsar that referenced this pull request May 26, 2021
It's a follow PR of [apache#280](streamnative/kop#280). This PR adds an optional value to `entry.format` config so that user can improve the performance because there's little entry conversion between `MemoryRecords` and entry's `ByteBuf`, while the cost is that Kafka client won't be compatible with Pulsar client.

Because the entry format of `kafka` still adds a `MessageMetadata` header to record the `entry.format`, it will be possible for Pulsar broker/client to decode these messages later.

This PR adds a `KafkaEntryFormatter` class associated to `entry.format=kafka` and apply this config to existed tests that have relation to Kafka client but not Pulsar client. An exception is `SaslPlainTest`, it will fail when multiple test instances are created because `LOOKUP_CACHE` is a static variable, the `findBroker` call of other test instances may be influenced. So we create two separated derived classes for test.

Finally this PR adds a performance test that can be run to see the time cost of different `EntryFormatter`s, a simple run result is:

```
--- fixed records for 1000 times ---
PulsarEntryFormatter encode time: 7287 ms
KafkaEntryFormatter encode time: 79 ms
NoHeaderKafkaEntryFormatter encode time: 0 ms
--- random records for 1000 times ---
PulsarEntryFormatter encode time: 6947 ms
KafkaEntryFormatter encode time: 78 ms
NoHeaderKafkaEntryFormatter encode time: 1 ms
```

The default batch is 2048 messages and each message contains 1024 bytes. We can see the behavior of `KafkaEntryFormatter`  has some overhead caused by adding header and copying the original bytes from `MemoryRecords`. However it's not significant much. But `PulsarEntryFormatter` takes about 7 ms for each batch, which may be not acceptable.

Another performance test that compares `PulsarEntryFormatter` and `KafkaEntryFormatter` is done by running KoP with Pulsar 2.8.0-SNAPSHOT (commit 11b9359) standalone on my LapTop.

```bash
$ ./bin/kafka-producer-perf-test.sh --topic my-topic --producer-props bootstrap.servers=127.0.0.1:9092 \
 --num-records 100000000 --record-size 128 --throughput -1
```

Sampling from 5 lines from the output after the throughput/latency are stable, and calculating the average value. The result is:

| entryFormat | Throughput (MB/sec) | Avg. Latency (ms) | Max Latency (ms) |
| - | - | - | - |
| pulsar | 39.768 | 740.74 | 802.8 |
| kafka | 44.212 | 667.98 | 756.6 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants