Optimizing Kafka Producers and Consumers: A Hands-On Guide

  Рет қаралды 7,225

Rock the JVM

Rock the JVM

Күн бұрын

blog post: blog.rockthejvm.com/optimizin...
code: github.com/polyzos/kafka-stre...
data: www.kaggle.com/datasets/mkech...
parallel consumer library: github.com/confluentinc/paral...
Contents:
0:00 intro, setup
4:10 code walkthrough
10:14 optimizing Kafka producers
18:05 optimizing Kafka consumers
This video is a hands-on guide to maximizing the performance of your Kafka producers and consumers. We will talk about the artchitecture of a typical application with Kafka, how producers work and how to tune Kafka producers for either max throughput or min latency. Then, we will switch sides to consumers and will discuss how you can scale your Kafka consumers vs number of partitions, and how to leverage multithreading inside a single consumer for 1000x increase in consumption performance.
Blog and code by Giannis Polyzos: github.com/polyzos
Follow Rock the JVM on:
LinkedIn: / rockthejvm
Twitter: / rockthejvm
Blog: blog.rockthejvm.com
-------------------------------------------------------------------------
Home: rockthejvm.com
-------------------------------------------------------------------------

Пікірлер: 8
@ShahriyarRzayev
@ShahriyarRzayev 7 ай бұрын
That was an amazing demo, literally the same ideas can be applied using the Python client and I love the way you described the problem, pretty language agnostic. The blog post is also neat as supplementary material. Thanks for your time.
@rockthejvm
@rockthejvm 7 ай бұрын
Glad it helps!
@johntheblind5842
@johntheblind5842 Жыл бұрын
full kafka course soon? 😇
@rockthejvm
@rockthejvm Жыл бұрын
You'd like that?
@SandeepKongathi
@SandeepKongathi Жыл бұрын
@Rock the JVM your courses and code are so close to real life problems, love it, kafka course will take it
@avalagum7957
@avalagum7957 Жыл бұрын
My naive solution for this optimization is (haven't run it to see if it works): - Producer: KafkaProducer is thread safe, so I will create a coroutine for each message. Each coroutine takes the same kafkaProducer, uses it to send a message, waits until the Future returned from kafkaProducer.send resolves then finishes. So with 10M messages, we'll have 10M coroutines. If 10M coroutines is too many for the Kotlin coroutine library, I hope there'll be a coroutine pool executor service (like the thread pool executor service in Java) for us to use. - Consumer: of course we need a number of kafka consumers which is equals to the number of partitions. To make each kafka consumer consume messages at the highest speed, I won't use the JsonDeserializer (decoding a byte array to a json string takes time) but use the ByteArrayDeserializer (i.e. no decoding is needed). The kafka consumer will send the byte array to a blocking queue / ring buffer for other coroutines to consume and process.Disadvantage of this method is that if our message processing is slow, there'll be a lot of messages in the blocking queue. What do you think of this solution?
@rockthejvm
@rockthejvm Жыл бұрын
Talk is cheap, code is king - try it out!
@avalagum7957
@avalagum7957 Жыл бұрын
@@rockthejvm 😊 fair enlugh
Flink SQL Tutorial - a Gentle Introduction
34:53
Rock the JVM
Рет қаралды 6 М.
What is Apache Kafka®?
11:42
Confluent
Рет қаралды 344 М.
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 8 МЛН
39kgのガリガリが踊る絵文字ダンス/39kg boney emoji dance#dance #ダンス #にんげんっていいな
00:16
💀Skeleton Ninja🥷【にんげんっていいなチャンネル】
Рет қаралды 8 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 64 МЛН
A Simple Kafka and Python Walkthrough
11:34
Quix
Рет қаралды 16 М.
Best Practices for Monitoring and Improving Kafka Performance
45:24
Basic System Design for Uber or Lyft | System Design Interview Prep
16:18
Apache Kafka in 6 minutes
6:48
James Cutajar
Рет қаралды 981 М.
Kafka Streams in Scala - a Comprehensive Tutorial
51:05
Rock the JVM
Рет қаралды 19 М.
Generative AI in a Nutshell - how to survive and thrive in the age of AI
17:57
I've been using Redis wrong this whole time...
20:53
Dreams of Code
Рет қаралды 341 М.
3. Apache Kafka Fundamentals | Apache Kafka Fundamentals
24:14
Confluent
Рет қаралды 456 М.
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 1,3 МЛН
Лазер против камеры смартфона
1:01
NEWTONLABS
Рет қаралды 450 М.
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 389 М.
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2,3 МЛН