SlideShare a Scribd company logo
13
Most read
14
Most read
22
Most read
Running Kafka as
a Native Binary using GraalVM
Ozan Gunalp, Red Hat
Ozan Gunalp, Red Hat – Quarkus
@ozangunalp
Running Kafka as a
Native Binary using GraalVM
The Problem
Kafka is fast!
3
Can we make it faster?
Reducing broker startup time as much as possible
sub second startup time
Integration Tests with Kafka
KafkaContainer
- Confluent platform image, provided by
org.testcontainers:kafka
- Zookeeper & Kraft-mode
- Not compatible with random
bootstrap.servers port
StrimziKafkaContainer
- Strimzi image, provided by
io.strimzi:strimzi-test-container
- Zookeeper & Kraft-mode
- Can be used with random port
- Cluster support
- Toxiproxy support to simulate network
conditions
4
Both are slow to startup
Kraft with format-storage uses another Java process to create log-dir
Quarkus Dev Services
5
Quarkus
6
Frictionless development
Optimized for Distributed Architectures
Quarkus Developer Joy
7
Dev Mode with live reload, Dev services and Continuous testing
Unified Configuration
Customizable defaults
Quarkus Kube-Native
8
Low memory overhead + Fast startup time + Small container size
=
Increase the deployment density
Observability & Resilience
❤
Quarkus Build-Time
9
kafka-native
10
Kafka broker embedded in a Quarkus application
Default configuration for dev/test purposes
Completely configurable
Compiled to native binary using GraalVM
GraalVM Native Image
Run the same workload on smaller machines on the cloud
11
🚀 🔐 🗜
Smaller size images
– no JVM included
Minimal attack
surface
🍃
Smaller memory
footprint
Faster startup time
– No warmup
native-image compilation
Reachability analysis
Build-time Class Initialization
Heap snapshotting
Metadata for Runtime Reflection, Security Providers 12
Compiling Kafka to native
Netty GraalVM support inherited from Quarkus
Security Providers
Plain, Scram, OAuth, GSSAPI
Substitutions
No Random init on static fields, No thread initialization
Bytecode manipulation
No JMX Support – YammerMetrics, MBean
13
kafka-native Quarkus Dev Service
14
Startup time RSS at startup
quay.io/strimzi-test-container/test-
container
@0.103.0-kafka-3.3.2
~3s 370Mb
vectorized/redpanda
@v22.3.4
~200ms 135Mb
quay.io/ogunalp/kafka-native
@0.2.0-kafka-3.4.0
~120ms 45Mb
quarkus.kafka.devservice.provider=kafka-native
kafka-native-test-container
<!-- https://mvnrepository.com/artifact/com.ozangunalp/kafka-native-test-container -->
<dependency>
<groupId>com.ozangunalp</groupId>
<artifactId>kafka-native-test-container</artifactId>
<version>0.2.0</version>
</dependency>
15
try (var container = new KafkaNativeContainer()) {
container.start();
String bootstrapServers = container.getBootstrapServers();
// create topics
// produce
// consume
}
kafka-native-test-container
16
String clusterId = Uuid.randomUuid().toString();
String quorumVotes = "1@broker1:9094";
var controllerAndBroker = new KafkaNativeContainer();
var brokerOnly = new KafkaNativeContainer();
var common = Map.of(
"SERVER_CLUSTER_ID", clusterId,
"KAFKA_CONTROLLER_QUORUM_VOTERS", quorumVotes);
common.forEach(controllerAndBroker::addEnv);
common.forEach(brokerOnly::addEnv);
controllerAndBroker.withNetworkAliases(broker1);
controllerAndBroker.withNetwork(network);
controllerAndBroker.addEnv("SERVER_HOST", "broker1");
controllerAndBroker.addEnv("KAFKA_BROKER_ID", "1");
brokerOnly.withNetworkAliases(broker2);
brokerOnly.withNetwork(network);
brokerOnly.addEnv("SERVER_HOST", "broker2");
brokerOnly.addEnv("KAFKA_BROKER_ID", "2");
brokerOnly.addEnv("KAFKA_PROCESS_ROLES", "broker");
Startables.deepStart(controllerAndBroker, brokerOnly);
var bs = brokerOnly.getBootstrapServers();
// produce, consume
kafka-native on the Cloud
17
Azure Container Instances
Single-node 1vCPU - 1Gb
~$1.30 per day (us-central)
1rps, 100rps, 1000rps, 5000rps
This is not a benchmark
Caveats
Good for tests and dev
Not production-ready
Classes are linked statically: limited strategy classes
GC performance – only Serial GC in GraalVM CE for now
Lacks managed beans / JMX for observability
Experimental support coming in GraalVM 23
18
What’s Next?
19
Support Zookeeper (Thanks to @kwall)
Support multiple Kafka versions (Thanks to @franvila)
Multi-arch images (ARM support)
Move to Smallrye organization
Experimental JMX Support
https://github.com/ozangunalp/kafka-native
https://quarkus.io
@quarkusio
https://quarkusio.zulipchat.com
https://code.quarkus.io
$>
vs Redpanda
kafka-native IS Kafka upstream code
Redpanda is more than a Kafka-compatible broker
Schema registry, HTTP proxy and UI console
Redpanda behaves slightly differently
Redpanda transactions do not support complete Kafka transactions protocol (?)
21
Strategy config
principal.builder.class, default: DefaultKafkaPrincipalBuilder
replica.selector.class
sasl.client.callback.handler.class
sasl.login.callback.handler.class
sasl.login.class
sasl.server.callback.handler.class
security.providers
ssl.engine.factory.class
alter.config.policy.class.name
authorizer.class.name
client.quota.callback.class
create.cluster.link.policy.class.name
create.topic.policy.class.name
kafka.metrics.reporters
metric.reporters
22

More Related Content

PPTX
Evening out the uneven: dealing with skew in Flink
PPTX
Autoscaling Flink with Reactive Mode
PPTX
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
PDF
Apache Flink internals
PPTX
Tuning Apache Kafka Connectors for Flink.pptx
PDF
Disaster Recovery and High Availability with Kafka, SRM and MM2
PDF
Apache Spark Data Source V2 with Wenchen Fan and Gengliang Wang
PPTX
Where is my bottleneck? Performance troubleshooting in Flink
Evening out the uneven: dealing with skew in Flink
Autoscaling Flink with Reactive Mode
Getting up to speed with MirrorMaker 2 | Mickael Maison, IBM and Ryanne Dolan...
Apache Flink internals
Tuning Apache Kafka Connectors for Flink.pptx
Disaster Recovery and High Availability with Kafka, SRM and MM2
Apache Spark Data Source V2 with Wenchen Fan and Gengliang Wang
Where is my bottleneck? Performance troubleshooting in Flink

What's hot (20)

PPTX
Introduction to Kafka Cruise Control
PDF
Flink powered stream processing platform at Pinterest
PPTX
Deep Dive into Apache Kafka
PDF
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
PDF
A Deep Dive into Query Execution Engine of Spark SQL
PDF
Introducing the Apache Flink Kubernetes Operator
PDF
Spark SQL: Another 16x Faster After Tungsten: Spark Summit East talk by Brad ...
PDF
An Introduction to Apache Kafka
PPTX
“Alexa, be quiet!”: End-to-end near-real time model building and evaluation i...
PDF
Fundamentals of Apache Kafka
PPTX
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
PDF
Top 5 Mistakes When Writing Spark Applications
PDF
Getting Data In and Out of Flink - Understanding Flink and Its Connector Ecos...
PDF
Virtual Flink Forward 2020: Autoscaling Flink at Netflix - Timothy Farkas
PDF
HBase Consistency and Performance Improvements
PPTX
Tuning kafka pipelines
PPTX
Emr spark tuning demystified
PDF
Scalability, Availability & Stability Patterns
PPTX
RocksDB compaction
PDF
Dockerを利用したローカル環境から本番環境までの構築設計
Introduction to Kafka Cruise Control
Flink powered stream processing platform at Pinterest
Deep Dive into Apache Kafka
Disaster Recovery with MirrorMaker 2.0 (Ryanne Dolan, Cloudera) Kafka Summit ...
A Deep Dive into Query Execution Engine of Spark SQL
Introducing the Apache Flink Kubernetes Operator
Spark SQL: Another 16x Faster After Tungsten: Spark Summit East talk by Brad ...
An Introduction to Apache Kafka
“Alexa, be quiet!”: End-to-end near-real time model building and evaluation i...
Fundamentals of Apache Kafka
Exactly-Once Financial Data Processing at Scale with Flink and Pinot
Top 5 Mistakes When Writing Spark Applications
Getting Data In and Out of Flink - Understanding Flink and Its Connector Ecos...
Virtual Flink Forward 2020: Autoscaling Flink at Netflix - Timothy Farkas
HBase Consistency and Performance Improvements
Tuning kafka pipelines
Emr spark tuning demystified
Scalability, Availability & Stability Patterns
RocksDB compaction
Dockerを利用したローカル環境から本番環境までの構築設計
Ad

Similar to Running Kafka as a Native Binary Using GraalVM with Ozan Günalp (20)

PPTX
Bring the Action: Using GraalVM in Production
PDF
PDF
Quarkus - a next-generation Kubernetes Native Java framework
PDF
Quarkus on Knative at Red Hat Summit 2019
PDF
Reactive Amsterdam - Maxim Burgerhout - Quarkus Intro
PPTX
Knative with .NET Core and Quarkus with GraalVM
PPTX
Real-time streaming and data pipelines with Apache Kafka
PPTX
Quarkus and GraalVM
PDF
[DevConf.US 2019]Quarkus Brings Serverless to Java Developers
PPTX
GOING AOT WITH GRAALVM FOR JAVA - JAVAZONE
PDF
Devoxx France 2023 - 1,2,3 Quarkus.pdf
PDF
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
PDF
JCConf.tw 2020 - Building cloud-native applications with Quarkus
PDF
Quarkus Denmark 2019
PDF
Traktor pro Crack 2025 Free Download Advance Form
PDF
Adobe Illustrator 2025 Crack Download free
PDF
USING GRAALVM IN PRODUCTION - JAVAONE.pdf
PDF
PDF Reader Pro Crack FREE Download Latest Version
PDF
Y. Tsesmelis, Uni Systems: Quarkus use cases and business value
PDF
Sergio Seabra - Red Hat - OSL19
Bring the Action: Using GraalVM in Production
Quarkus - a next-generation Kubernetes Native Java framework
Quarkus on Knative at Red Hat Summit 2019
Reactive Amsterdam - Maxim Burgerhout - Quarkus Intro
Knative with .NET Core and Quarkus with GraalVM
Real-time streaming and data pipelines with Apache Kafka
Quarkus and GraalVM
[DevConf.US 2019]Quarkus Brings Serverless to Java Developers
GOING AOT WITH GRAALVM FOR JAVA - JAVAZONE
Devoxx France 2023 - 1,2,3 Quarkus.pdf
D. Andreadis, Red Hat: Concepts and technical overview of Quarkus
JCConf.tw 2020 - Building cloud-native applications with Quarkus
Quarkus Denmark 2019
Traktor pro Crack 2025 Free Download Advance Form
Adobe Illustrator 2025 Crack Download free
USING GRAALVM IN PRODUCTION - JAVAONE.pdf
PDF Reader Pro Crack FREE Download Latest Version
Y. Tsesmelis, Uni Systems: Quarkus use cases and business value
Sergio Seabra - Red Hat - OSL19
Ad

More from HostedbyConfluent (20)

PDF
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
PDF
Renaming a Kafka Topic | Kafka Summit London
PDF
Evolution of NRT Data Ingestion Pipeline at Trendyol
PDF
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
PDF
Exactly-once Stream Processing with Arroyo and Kafka
PDF
Fish Plays Pokemon | Kafka Summit London
PDF
Tiered Storage 101 | Kafla Summit London
PDF
Building a Self-Service Stream Processing Portal: How And Why
PDF
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
PDF
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
PDF
Navigating Private Network Connectivity Options for Kafka Clusters
PDF
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
PDF
Explaining How Real-Time GenAI Works in a Noisy Pub
PDF
TL;DR Kafka Metrics | Kafka Summit London
PDF
A Window Into Your Kafka Streams Tasks | KSL
PDF
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
PDF
Data Contracts Management: Schema Registry and Beyond
PDF
Code-First Approach: Crafting Efficient Flink Apps
PDF
Debezium vs. the World: An Overview of the CDC Ecosystem
PDF
Beyond Tiered Storage: Serverless Kafka with No Local Disks
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Renaming a Kafka Topic | Kafka Summit London
Evolution of NRT Data Ingestion Pipeline at Trendyol
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Exactly-once Stream Processing with Arroyo and Kafka
Fish Plays Pokemon | Kafka Summit London
Tiered Storage 101 | Kafla Summit London
Building a Self-Service Stream Processing Portal: How And Why
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Navigating Private Network Connectivity Options for Kafka Clusters
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Explaining How Real-Time GenAI Works in a Noisy Pub
TL;DR Kafka Metrics | Kafka Summit London
A Window Into Your Kafka Streams Tasks | KSL
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
Data Contracts Management: Schema Registry and Beyond
Code-First Approach: Crafting Efficient Flink Apps
Debezium vs. the World: An Overview of the CDC Ecosystem
Beyond Tiered Storage: Serverless Kafka with No Local Disks

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
KodekX | Application Modernization Development
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Review of recent advances in non-invasive hemoglobin estimation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
KodekX | Application Modernization Development
Spectral efficient network and resource selection model in 5G networks
Building Integrated photovoltaic BIPV_UPV.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Reach Out and Touch Someone: Haptics and Empathic Computing
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology

Running Kafka as a Native Binary Using GraalVM with Ozan Günalp

  • 1. Running Kafka as a Native Binary using GraalVM Ozan Gunalp, Red Hat
  • 2. Ozan Gunalp, Red Hat – Quarkus @ozangunalp Running Kafka as a Native Binary using GraalVM
  • 3. The Problem Kafka is fast! 3 Can we make it faster? Reducing broker startup time as much as possible sub second startup time
  • 4. Integration Tests with Kafka KafkaContainer - Confluent platform image, provided by org.testcontainers:kafka - Zookeeper & Kraft-mode - Not compatible with random bootstrap.servers port StrimziKafkaContainer - Strimzi image, provided by io.strimzi:strimzi-test-container - Zookeeper & Kraft-mode - Can be used with random port - Cluster support - Toxiproxy support to simulate network conditions 4 Both are slow to startup Kraft with format-storage uses another Java process to create log-dir
  • 7. Quarkus Developer Joy 7 Dev Mode with live reload, Dev services and Continuous testing Unified Configuration Customizable defaults
  • 8. Quarkus Kube-Native 8 Low memory overhead + Fast startup time + Small container size = Increase the deployment density Observability & Resilience ❤
  • 10. kafka-native 10 Kafka broker embedded in a Quarkus application Default configuration for dev/test purposes Completely configurable Compiled to native binary using GraalVM
  • 11. GraalVM Native Image Run the same workload on smaller machines on the cloud 11 🚀 🔐 🗜 Smaller size images – no JVM included Minimal attack surface 🍃 Smaller memory footprint Faster startup time – No warmup
  • 12. native-image compilation Reachability analysis Build-time Class Initialization Heap snapshotting Metadata for Runtime Reflection, Security Providers 12
  • 13. Compiling Kafka to native Netty GraalVM support inherited from Quarkus Security Providers Plain, Scram, OAuth, GSSAPI Substitutions No Random init on static fields, No thread initialization Bytecode manipulation No JMX Support – YammerMetrics, MBean 13
  • 14. kafka-native Quarkus Dev Service 14 Startup time RSS at startup quay.io/strimzi-test-container/test- container @0.103.0-kafka-3.3.2 ~3s 370Mb vectorized/redpanda @v22.3.4 ~200ms 135Mb quay.io/ogunalp/kafka-native @0.2.0-kafka-3.4.0 ~120ms 45Mb quarkus.kafka.devservice.provider=kafka-native
  • 16. kafka-native-test-container 16 String clusterId = Uuid.randomUuid().toString(); String quorumVotes = "1@broker1:9094"; var controllerAndBroker = new KafkaNativeContainer(); var brokerOnly = new KafkaNativeContainer(); var common = Map.of( "SERVER_CLUSTER_ID", clusterId, "KAFKA_CONTROLLER_QUORUM_VOTERS", quorumVotes); common.forEach(controllerAndBroker::addEnv); common.forEach(brokerOnly::addEnv); controllerAndBroker.withNetworkAliases(broker1); controllerAndBroker.withNetwork(network); controllerAndBroker.addEnv("SERVER_HOST", "broker1"); controllerAndBroker.addEnv("KAFKA_BROKER_ID", "1"); brokerOnly.withNetworkAliases(broker2); brokerOnly.withNetwork(network); brokerOnly.addEnv("SERVER_HOST", "broker2"); brokerOnly.addEnv("KAFKA_BROKER_ID", "2"); brokerOnly.addEnv("KAFKA_PROCESS_ROLES", "broker"); Startables.deepStart(controllerAndBroker, brokerOnly); var bs = brokerOnly.getBootstrapServers(); // produce, consume
  • 17. kafka-native on the Cloud 17 Azure Container Instances Single-node 1vCPU - 1Gb ~$1.30 per day (us-central) 1rps, 100rps, 1000rps, 5000rps This is not a benchmark
  • 18. Caveats Good for tests and dev Not production-ready Classes are linked statically: limited strategy classes GC performance – only Serial GC in GraalVM CE for now Lacks managed beans / JMX for observability Experimental support coming in GraalVM 23 18
  • 19. What’s Next? 19 Support Zookeeper (Thanks to @kwall) Support multiple Kafka versions (Thanks to @franvila) Multi-arch images (ARM support) Move to Smallrye organization Experimental JMX Support https://github.com/ozangunalp/kafka-native
  • 21. vs Redpanda kafka-native IS Kafka upstream code Redpanda is more than a Kafka-compatible broker Schema registry, HTTP proxy and UI console Redpanda behaves slightly differently Redpanda transactions do not support complete Kafka transactions protocol (?) 21
  • 22. Strategy config principal.builder.class, default: DefaultKafkaPrincipalBuilder replica.selector.class sasl.client.callback.handler.class sasl.login.callback.handler.class sasl.login.class sasl.server.callback.handler.class security.providers ssl.engine.factory.class alter.config.policy.class.name authorizer.class.name client.quota.callback.class create.cluster.link.policy.class.name create.topic.policy.class.name kafka.metrics.reporters metric.reporters 22