100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Kafka

Topics, Partitions, and Offsets

How Kafka organizes data into topics and partitions, how ordering and offsets work, and what that means for scaling producers and consumers.

Kafka FoundationsBeginner9 min readJul 10, 2026
Analogies

Topics, Partitions, and Offsets

A topic is Kafka's logical category for a stream of records, such as orders, page-views, or payment-events, and every topic is split into one or more partitions, each of which is an independently ordered, append-only log stored on disk. Kafka guarantees strict ordering only within a single partition, not across an entire topic, and every record within a partition is assigned a sequential integer offset (0, 1, 2, ...) the moment it's appended, which consumers use as the durable bookmark for exactly where they are in that partition's log.

🏏

Cricket analogy: A topic is like the overall 'match', while each partition is like one bowler's individual over sequence: deliveries within an over (partition) are strictly ordered ball 1 through 6 (offsets), but there's no guaranteed cross-bowler ordering across the whole innings.

Why Partitions Matter: Parallelism and Ordering Trade-offs

Partitions are Kafka's primary unit of horizontal scale: because each partition can be hosted on a different broker and read by a different consumer within a consumer group, adding more partitions lets you add more consumers to increase read throughput, up to the point where the number of active consumers equals the number of partitions (beyond that, extra consumers sit idle). The trade-off is that if you need strict ordering across a set of related events, such as all updates for a given customer ID, you must ensure they land in the same partition, which Kafka achieves by default via hashing the record's key, so choosing a good partition key (like customer_id rather than a random UUID) is one of the most consequential early design decisions in a Kafka-based system.

🏏

Cricket analogy: Adding partitions is like adding more bowling attacks to bowl overs in parallel from both ends, speeding up the innings, but if you need every delivery to a specific batsman analyzed in strict order, you must ensure the same 'partition' (analysis feed) always tracks that batsman.

Offsets and Consumer Position Tracking

Every record's offset is a monotonically increasing, partition-local integer assigned by the broker at append time and never reused, even if earlier records are later deleted by retention or compaction; consumers periodically commit the offset of the last record they've successfully processed, typically to Kafka's internal __consumer_offsets topic, so that if a consumer crashes and restarts (or a new consumer takes over during a rebalance), it resumes exactly where the previous one left off rather than reprocessing everything or skipping records. This offset-commit model is also what makes 'replaying' data possible: an operator can manually reset a consumer group's committed offset to an earlier point, or to the very beginning, to reprocess historical events, for example after fixing a bug in the consuming application.

🏏

Cricket analogy: An offset is like the exact ball number in an over a scorer has last logged; if the scorer's laptop crashes, they check the last logged ball number and resume from ball 4 rather than re-scoring balls 1 through 3 or skipping to ball 6.

java
// Producer sending records keyed by customerId so all events for one customer
// land in the same partition, preserving per-customer ordering.
ProducerRecord<String, String> record =
    new ProducerRecord<>("customer-events", customerId, eventJson);
producer.send(record);

// Consumer manually committing offsets after processing, for at-least-once semantics
while (true) {
    ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(500));
    for (ConsumerRecord<String, String> r : records) {
        process(r.value());
    }
    consumer.commitSync(); // commits the offset of the last record processed
}

You can inspect and reset consumer group offsets using the CLI: bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group my-group --describe shows current offsets and lag per partition, while --reset-offsets --to-earliest --execute rewinds a group to replay a topic from the start, a common technique after fixing a downstream processing bug.

Choosing a poor partition key, such as a low-cardinality field like a boolean status flag, causes 'hot partitions' where most records hash to one or two partitions, creating a throughput bottleneck and unbalanced load across brokers, even though the topic technically has many partitions available. Prefer high-cardinality, evenly distributed keys like customer or order IDs.

  • A topic is a logical stream split into one or more independently ordered partitions.
  • Kafka guarantees ordering only within a partition, never across an entire topic.
  • Each record gets a monotonically increasing, partition-local offset at append time.
  • Partitions are the unit of parallelism; more partitions allow more concurrent consumers.
  • Records with the same key hash to the same partition by default, preserving per-key ordering.
  • Consumers commit offsets (often to __consumer_offsets) to resume correctly after a restart.
  • Offsets can be manually reset to replay historical data, e.g., after fixing a processing bug.

Practice what you learned

Was this page helpful?

Topics covered

#Kafka#ApacheKafkaStudyNotes#DevOps#TopicsPartitionsAndOffsets#Topics#Partitions#Offsets#Matter#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse