惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News | PayPal Newsroom
云风的 BLOG
云风的 BLOG
GbyAI
GbyAI
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Register - Security
The Register - Security
L
LangChain Blog
A
About on SuperTechFans
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
Stack Overflow Blog
Stack Overflow Blog
The Hacker News
The Hacker News
AWS News Blog
AWS News Blog
博客园 - 司徒正美
Scott Helme
Scott Helme
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
腾讯CDC
Recorded Future
Recorded Future
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
G
GRAHAM CLULEY
Security Latest
Security Latest
S
Securelist
D
Darknet – Hacking Tools, Hacker News & Cyber Security
aimingoo的专栏
aimingoo的专栏
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
T
The Exploit Database - CXSecurity.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
V2EX
T
The Blog of Author Tim Ferriss
D
Docker
S
Security Affairs
F
Full Disclosure
Know Your Adversary
Know Your Adversary
N
News and Events Feed by Topic
N
News and Events Feed by Topic
T
Tor Project blog
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Microsoft Security Blog
Microsoft Security Blog
Simon Willison's Weblog
Simon Willison's Weblog
Recent Announcements
Recent Announcements
博客园_首页
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Security @ Cisco Blogs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Apache Kafka: A Beginner's Guide to Key Concepts
Robert Njugu · 2026-05-17 · via DEV Community

Apache Kafka

A busy post office keeps on delivering even when one worker is slow. The letters keep on arriving on a constant rate, delivery staff picks the letters up and drops them, and no one waits for the other.

Now, Apache Kafka works this way but now for data. It is a distributed platform for data streaming. Some application sends data to Kafka, and other read the same data from Kafka. Everything happens fast and in real time

The problem Kafka actually solves.

Before Kafka was developed, applications used to talk to each other directly. APP A sent data to APP B, which in turn sent the data to APP C. It seems easy at first, but as system grew, the massive amount of data sending becomes messy. If APP C is down APP A has to wait and APP B is down, the whole process collapses.

This is where Kafka comes in, instead of the apps sending data directly to other apps, Kafka acts as an intermediate. producers send data into Kafka and consumers read that data from Kafka.

Key Concepts:

1. Events and Messages

An event is a record that something happened. A user clicked a button, a sensor recorded a temperature or a payment was processed. These messages are referred to as records in Kafka.

Every message has 3 parts:

  • A key, which is an optional identifier( e.g : userID)
  • A value, this is the actual data( e.g: {"user": "jane", "action": "purchase"})
  • Timestamp, when it happened.

2. Topics

A topic is a named channel where the messages live. A topic is like a folder in a computer, where the messages are the files inside that folder. If one creates a topic named users, each time a new user registers, then the app where the user was registered sends a message to the user topic in Kafka.

Topics are append only, meaning new messages go at the end, and old messages still remain. No messages disappear even after being read.

A small example:

Topic: payments
├── msg 1: {"id": "a1", "amount": 50}
├── msg 2: {"id": "a2", "amount": 120}
└── msg 3: {"id": "a3", "amount": 30}

Enter fullscreen mode Exit fullscreen mode

Kafka allows as many topics as one wishes to create. May it be users, inventory, payments, email-sent etc.

3. Partitions.

A Topic can hold data in large amounts. In order to handle this, Kafka splits topics into partitions. Each partition contains a numbered log of messages. For example, if payment has 3 partitions, then Kafka spreads messages across all the 3 partitions.

Each message inside a partition gets a number called an offset. offset 0 is the first message and offset 1 is the second message. The offset never changes, which allows consumers to track where they are.

Partition 0: [offset 0] [offset 1] [offset 2]
Partition 1: [offset 0] [offset 1]
Partition 2: [offset 0] [offset 1] [offset 2] [offset 3]

Enter fullscreen mode Exit fullscreen mode

This is important because of parrarelism, which allows multiple consumers to read messages at the same time. If there are 10 partitions, then 10 consumers can read the data.

4. Producers

A producer is any application that sends messages to kafka. When an e-commerce backend sends order data , it is a producer, and when a mobile app sends user activity, it as also a producer.

When writing topics, producers get to pick which topic they are writing. Producers can also either chose where the message they are writing goes or let Kafka chose. If Kafka decides, it writes data in one partition, then the next, and the next, then comes back to the first. Like that.

To simplify this, one can decide what partition they wish the data to go by passing a key argument directly in the send () call. Messages with the same key, go to the same partition. e.g.

from kafka import KafkaProducer
import json

producer = KafkaProducer(
    bootstrap_servers='localhost:9092',
    value_serializer=lamda v: json.dumps(v).encode('utf-8')
)
.
# This message goes to partition with key 'user-10'

producer.send(
    topic='payments',
    key=b'user-10',
    value={"amount": 50}
)

producer.flush()

Enter fullscreen mode Exit fullscreen mode

Here you are specifying the exact partition where the message goes.

5. Consumers and Consumer Groups

A consumer reads messages from a topic. A consumer tracks the offsets, so as to determine which messages have already been processed.

A consumer Group is a team of consumers working together to read messages from a topic. Kafka assigns one partition to one consumer in the group. For example, if a topic has 4 partitions, each consumer get assigned exactly one partition, and if one consumer fails, Kafka assigns the partition to the others automatically, in a process called rebalancing.

from kafka import KafkaConsumer
import json

consumer = KafkaConsumer(
    topic='payments',
    bootstrap_servers='localhost:9092',
    group_id='payments-processor',
    value_deserializer=lambda v: json.loads(v.decode('utf-8'))
)

for message in consumer:
    print(f"Offset: {message.offset}, Data: {message.value}")

Enter fullscreen mode Exit fullscreen mode


plaintext

6. Brokers and the Cluster

A broker is a single Kafka server. Brokers store the partitions and serve the producers and consumers. A cluster is a group of brokers. In production, one runs at least 3 brokers. Data is copied, or replicated, onto each broker for safety. If one broker fails, another broker has the data it needs to serve the clients.

Each partition has a leader (one of the brokers) and the replica brokers. Producers and consumers always communicate with the leader. The replicas stay in sync with the leader. If the leader broker fails, one of the replica brokers automatically becomes the new leader.

Broker 1 (Leader for partition 0)
Broker 2 (Replica for partition 0, Leader for partition 1)
Broker 3 (Replica for partition 1)

Enter fullscreen mode Exit fullscreen mode

7. Retention

Messages are kept for a set amount of time. The default time is 7 days. After that time, the messages will be automatically deleted. This period can be changed on a per-topic basis. This is very powerful as it allows consumers to fall behind in processing the events and then catch up later. Another consumer could also replay all the events that occurred from the beginning of the topic. There is no limit to processing these events in real time or catching up later.

A Real Example of How Kafka Fits in

  • Customer places an order - This is a backend that produces a message to orders topic.
  • The kitchen app consumes from orders - starts preparing the food.
  • The delivery app consumes from orders - assigns a driver.
  • The billing app consumes from orders - charges the customer.

All the three consumers work independently, such they never block one another. So if the delivery app crashes, it picks up where it left off when it resumes since the offsets are saved.

Conclusion

Kafka may seem complicated at the start, but becomes simpler as one connects the process to familiar objects. Topics are folders, messages/events are files., Partitions are subfolders in the big folder. Producers are writers of these files and consumers read these files. Brokers are the office buildings that physically hold the filing cabinets. If one building burns down, another building already has a backup copy of those files. Work continues without losing anything.