Kafka
Apache Kafka is a popular opensource distributed event streaming platform. This page contains core concepts, best practices, and how-to guides with code examples.
Kafka Fundamentals
14 articlesApache Kafka: Introduction, Architecture & Core Concepts
What is Kafka, why it exists, brokers, topics, partitions, offsets, and how producers and consumers fit together.
Kafka Topics and Partitions: How Data is Organized
Topic creation, partition count, replication factor, partition assignment strategies, and retention policies.
Kafka Producers: Publishing Messages to Kafka
ProducerConfig, key serializers, acks, retries, idempotent producers, batch settings, and compression.
Kafka Consumers & Consumer Groups: Reading Messages from Kafka
ConsumerConfig, poll loop, offset commits, consumer group rebalancing, and at-least-once vs exactly-once semantics.
Kafka Offsets & Offset Management
How offsets work, auto vs manual commit, offset reset strategies, and seeking to specific offsets.
Kafka Message Serialization
String, JSON with Jackson, custom serializers, and Avro with Schema Registry.
Kafka Streams: Stream Processing
Stream processing with Kafka Streams: KStream, KTable, stateless and stateful operations, and windowing.
Kafka Connect: Data Pipelines
Kafka Connect for building data pipelines: source and sink connectors, standalone vs distributed mode.
Kafka Producer & Consumer Configuration
Essential Kafka producer and consumer configuration: acks, retries, batching, compression, and tuning.
Kafka Exactly-Once Semantics & Transactions
Kafka exactly-once delivery: idempotent producers, transactional APIs, and the read-process-write pattern.
Kafka Schema Registry & Avro Serialization
Define Avro schemas, register with Schema Registry, and produce/consume strongly typed messages with schema evolution.
Kafka Security: SSL, SASL & ACL Authorization
Secure Kafka with SSL/TLS encryption, SASL/PLAIN and SCRAM authentication, and ACL-based topic authorization.
Consumer Group Rebalancing & Strategies
Rebalance protocols, CooperativeStickyAssignor, static group membership, rebalance listeners, and avoiding stop-the-world rebalances.
Kafka Performance Tuning & Monitoring
Optimize batch.size, linger.ms, compression, consumer fetch settings, JMX metrics, and consumer lag monitoring for production.
Kafka Advanced
5 articlesKafka Streams: Stateful Aggregations, KTables & Windowing
Deep dive into stateful Kafka Streams: groupBy, count, reduce, aggregate, KTable operations, tumbling/hopping/session windows, interactive queries, and RocksDB tuning.
Kafka Streams: Stream-Table Joins & GlobalKTable
All join types in Kafka Streams: KStream-KStream, KStream-KTable, KStream-GlobalKTable, KTable-KTable equi and foreign-key joins with co-partitioning rules.
ksqlDB: Streaming SQL for Real-Time Analytics
Build real-time streaming pipelines with SQL: CREATE STREAM, CREATE TABLE, windowed aggregations, stream-table joins, persistent queries, connectors, and the REST API.
Schema Evolution: Avro Compatibility Modes with Schema Registry
Evolve Avro schemas safely: BACKWARD, FORWARD, FULL, and transitive compatibility modes, Schema Registry REST API, Java integration, and Protobuf/JSON Schema alternatives.
Kafka Multi-Cluster Replication: MirrorMaker 2
Replicate Kafka topics across clusters with MirrorMaker 2: active/passive and active/active topologies, offset translation, consumer failover, topic sync, and monitoring.
Production & Operations
5 articlesKafka Consumer Lag Monitoring: Prometheus, Grafana & Alerting
Monitor consumer lag end-to-end: JMX Exporter, Kafka Exporter, Prometheus alert rules, Grafana dashboard queries, AdminClient programmatic lag, and KEDA auto-scaling.
Kafka Streams: Interactive Queries & State Store REST API
Query local RocksDB state stores directly via REST: KeyValueStore and WindowStore queries, multi-node store discovery, scatter/gather proxying, and application.server config.
Kafka Connect: Custom Source & Sink Connectors
Build custom Kafka Connect connectors: SourceConnector and SourceTask with offset management, SinkConnector and SinkTask with batching, error handling, DLQ, and custom SMTs.
Kafka Cluster Administration: Broker Config & Partition Reassignment
Production cluster ops: dynamic config changes, partition reassignment with throttling, preferred leader election, rolling restarts, log retention and compaction, and KRaft vs ZooKeeper.
Kafka Transactions & Idempotent Producers: Deep Dive
Exactly-once semantics end-to-end: idempotent producer internals, transactional API, read-process-write with atomic offset commit, isolation levels, zombie fencing, and Kafka Streams EOS v2.