DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Building Scalable AI-Driven Microservices With Kubernetes and Kafka
  • Big Data Realtime Data Pipeline Architecture
  • Streaming Data Pipeline Architecture
  • Kafka: Powerhouse Messaging

Trending

  • While Performing Dependency Selection, I Avoid the Loss Of Sleep From Node.js Libraries' Dangers
  • Solid Testing Strategies for Salesforce Releases
  • Is Agile Right for Every Project? When To Use It and When To Avoid It
  • The 4 R’s of Pipeline Reliability: Designing Data Systems That Last
  1. DZone
  2. Data Engineering
  3. Big Data
  4. Kafka Producer Architecture - Picking the Partition of Records

Kafka Producer Architecture - Picking the Partition of Records

This article covers Kafka Producer Architecture, including how a partition is chosen, producer cadence, partitioning strategies, and consumers.

By 
Jean-Paul Azar user avatar
Jean-Paul Azar
·
Aug. 18, 17 · Analysis
Likes (12)
Comment
Save
Tweet
Share
69.2K Views

Join the DZone community and get the full member experience.

Join For Free

this article covers some lower level details of kafka producer architecture. it is a continuation of the kafka architecture and kafka topic architecture articles.

this article covers kafka producer architecture with a discussion of how a partition is chosen, producer cadence, and partitioning strategies.

kafka producers

kafka producers send records to topics. the records are sometimes referred to as messages.
the producer picks which partition to send a record to per topic. the producer can send records round-robin. the producer could implement priority systems based on sending records to certain partitions based on the priority of the record.

generally speaking, producers send records to a partition based on the record’s key. the default partitioner for java uses a hash of the record’s key to choose the partition or uses a round-robin strategy if the record has no key.
the important concept here is that the producer picks partition.

kafka architecture: kafka producers

producers are writing at offset 12, while at the same time, consumer group a is reading from offset 9.

kafka producers write cadence and partitioning of records

producers write at their cadence so the order of records cannot be guaranteed across partitions. the producers get to configure their consistency/durability level (ack=0, ack=all, ack=1), which we will cover later. producers pick the partition such that record/messages go to a given partition based on the data. for example, you could have all the events of a certain ‘employeeid’ go to the same partition. if order within a partition is not needed, a ‘round robin’ partition strategy can be used, so records get evenly distributed across partitions.

review of producers

can producers occasionally write faster than consumers?

yes. a producer could have a burst of records, and a consumer does not have to be on the same page as the consumer.

what is the default partition strategy for producers without using a key?

round-robin

what is the default partition strategy for producers using a key?

records with the same key get sent to the same partition.

what picks which partition a record is sent to?

the producer picks which partition a record goes to.

kafka consumer architecture

please continue reading about kafka architecture. the next article covers kafka consumer architecture with a discussion of how records are divided up among consumers in a consumer group, consumer failover, and consumer load balancing.

kafka Record (computer science) Architecture

Published at DZone with permission of Jean-Paul Azar. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Building Scalable AI-Driven Microservices With Kubernetes and Kafka
  • Big Data Realtime Data Pipeline Architecture
  • Streaming Data Pipeline Architecture
  • Kafka: Powerhouse Messaging

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!