Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Evaluation of Kafka client configurations via distributed tracing.

License

NotificationsYou must be signed in to change notification settings

jeqo/tracing-kafka-apps

Repository files navigation

Evaluation of Kafka client configurations via distributed tracing.

Requirements

  • JDK 11
  • Docker engine, Docker compose
  • wrk

Use-case

  • Producers:http-event-producer,http-metadata-producer
  • Stream-Processors:stream-processor-joiner
  • Consumers:console-consumer

Events and Metadata messages are sent to an input Kafka topic, a Stream applicationstore Metadata messages as a table representation, and join Events and Metadatamessages, to then send them to another Kafka topic. A Consumer polls fromthe final Kafka topic and process joined messages.

use-case

How to run

make# this will build containers, start compose, create topics# after it completesmake perf-test# this will start http testing took to create load.

Scenarios

Producer: sync send

  • Event producer: synchronous send.
  • Console consumer: auto-commit.
publicclassEventPublisher {//...voidpublish()throwsException {varrecord =newProducerRecord<>(topic,"A","A");kafkaProducer.send(record).get();  }}

default scenario

We can see that HTTP response is blocked bykafkaProducer.send() operation completes.

As record is stored in Kafka topic, consumption starts even before HTTP response isreturned.

Consumer poll and consume as soon as possible.

Producer: async send

  • Event Producer: async send.
  • Console consumer: auto-commit.
publicclassEventPublisher {// ...voidpublish()throwsException {varrecord =newProducerRecord<>(topic,"A","A");kafkaProducer.send(record);  }}

producer send async

Instead of waiting for an acknowledge from the Kafka broker, producer does not block, and HTTP return response after async send has complete.

Consumer poll and consume as soon as possible.

Producer: batch send

  • Event Producer: async, batched send.
  • Console Consumer: auto-commit.
publicclassEventPublisher {publicEventPublisher(Tracingtracing,Configconfig) {varproducerConfig =newProperties();//...producerConfig.put(ProducerConfig.BATCH_SIZE_CONFIG,100000);producerConfig.put(ProducerConfig.LINGER_MS_CONFIG,1000);//...  }voidpublish()throwsException {varrecord =newProducerRecord<>(topic,"A","A");kafkaProducer.send(record);  }}

producer batch send

Every message will be buffered until a batch of 100KB (batch.size) is created,or 1 second times out (linger.ms).

Depending on how your message is positioned as part of the batch, your transactioncan take up to a second to send a message.

We only execute 1 round-trip (depending onacks andmin.isr) for every batch.

Consumer: commit per record

  • Event Producer: sync send.
  • Console Consumer: commit per record.
publicclassConsoleConsumerimplementsRunnable {privatevoidprintRecord(Consumer<String,String>consumer,ConsumerRecord<String,String>record) {// processingconsumer.commitSync(Map.of(newTopicPartition(record.topic(),record.partition()),newOffsetAndMetadata(record.offset())));// ...  }@Overridepublicvoidrun() {try (Consumer<String,String>tracingConsumer =kafkaTracing.consumer(newKafkaConsumer<>(config))) {tracingConsumer.subscribe(topics);while (running.get()) {varrecords =tracingConsumer.poll(Duration.ofSeconds(1));records.forEach(r ->this.printRecord(tracingConsumer,r));      }    }// ...  }}

scenario consumer commit per record

If we commit per record, is much harder for the consumer to keep up with theproducer pace. In this trace, it took almost a second to consume the recordsince it was produced.

About

Evaluation of Kafka client configurations via distributed tracing.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp