Redpanda
A Kafka-compatible high-performance streaming platform
A Kafka-compatible high-performance streaming platform
Redpanda is a Kafka-compatible streaming platform developed in C++ by the company of the same name, founded in 2019. While being 100% compatible with the Kafka API, it runs without a JVM and delivers 10x lower P99 latency and 6x faster throughput. It also removes the ZooKeeper dependency, which simplifies operations.
It uses a Thread-per-Core architecture and the Raft consensus algorithm. Each CPU core handles an independent shard to minimize lock contention, and built-in Raft performs leader election and replication without ZooKeeper. A single binary makes installation and upgrades simple.
You can use Kafka clients, Kafka Connect, and Schema Registry as they are, so it is fully compatible with the existing Kafka ecosystem. You can migrate a Kafka cluster to Redpanda without configuration changes, and Tiered Storage automatically stores older data in S3, reducing storage costs.
It supports cloud-native deployment with a Kubernetes Operator and provides topic management, consumer group monitoring, and a schema registry UI through Redpanda Console. It suits real-time data pipelines where low latency matters, such as finance, gaming, and IoT.
# Kafka ํด๋ผ์ด์ธํธ๋ก Redpanda ์ฐ๊ฒฐ (100% ํธํ)
from kafka import KafkaProducer, KafkaConsumer
from kafka.admin import KafkaAdminClient, NewTopic
import json
REDPANDA_BROKERS = ['localhost:9092']
# Admin: ํ ํฝ ์์ฑ
admin_client = KafkaAdminClient(
bootstrap_servers=REDPANDA_BROKERS,
client_id='admin-client'
)
topic = NewTopic(
name='user-events',
num_partitions=6,
replication_factor=3
)
try:
admin_client.create_topics([topic])
print("Topic created")
except Exception as e:
print(f"Topic exists or error: {e}")
# Producer: ๋ฉ์์ง ๋ฐํ
producer = KafkaProducer(
bootstrap_servers=REDPANDA_BROKERS,
value_serializer=lambda v: json.dumps(v).encode('utf-8'),
acks='all', # ๋ชจ๋ ๋ณต์ ๋ณธ ํ์ธ
retries=3,
linger_ms=5 # ๋ฐฐ์น ๋๊ธฐ ์๊ฐ
)
# ์ด๋ฒคํธ ๋ฐํ
for i in range(100):
event = {
'user_id': f'user_{i % 10}',
'action': 'click',
'timestamp': '2024-01-15T10:30:00Z',
'page': f'/product/{i}'
}
future = producer.send('user-events', value=event, key=event['user_id'].encode())
# ๋๊ธฐ ์ ์ก: future.get(timeout=10)
producer.flush()
producer.close()
# Consumer: ๋ฉ์์ง ์๋น
consumer = KafkaConsumer(
'user-events',
bootstrap_servers=REDPANDA_BROKERS,
group_id='analytics-consumer',
auto_offset_reset='earliest',
enable_auto_commit=True,
value_deserializer=lambda m: json.loads(m.decode('utf-8'))
)
for message in consumer:
print(f"Partition: {message.partition}, Offset: {message.offset}")
print(f"Key: {message.key}, Value: {message.value}")
# ์ฒ๋ฆฌ ํ ์๋ ์ปค๋ฐ (enable_auto_commit=False ์)
# consumer.commit()
# rpk CLI ์ฌ์ฉ ์์ (Redpanda ์ ์ฉ ๋๊ตฌ)
# rpk topic create user-events --partitions 6 --replicas 3
# rpk topic produce user-events
# rpk topic consume user-events --group my-group
# rpk cluster info
# rpk topic describe user-events
# Docker๋ก Redpanda ์คํ
# docker run -d --name redpanda \
# -p 9092:9092 -p 8081:8081 -p 8082:8082 \
# docker.redpanda.com/redpandadata/redpanda:latest \
# redpanda start --smp 1 --memory 1G --overprovisioned
Senior: "Operating Kafka is a big burden, but if we switch to Redpanda there's no ZooKeeper and no JVM tuning needed. Latency drops too."
Junior: "Do we have to change our existing Kafka code?"
Senior: "You only need to change the broker address. You can keep using kafka-python and the Confluent client as they are."
Interviewer: "Tell me about your experience with real-time data pipelines."
Candidate: "I built a real-time log pipeline with Redpanda that processes 100,000 events per second. P99 latency dropped from 50ms to 5ms compared with Kafka, and Tiered Storage automatically moves data older than a week to S3, cutting local disk costs by 50%."
Take a mock interview on this topic โ WIA SOOM AI Interview ยท Start for free
Reviewer: "The acks='all' setting looks good. But also set retries so you can handle transient network failures."
Developer: "Yes, I'll add retries=3 and retry_backoff_ms=100."