liveBook · Manning

Partition count

As explained in Kafka for Architects

A partition count is the configured number of partitions assigned to a Kafka topic.

A partition count is the configured number of partitions assigned to a Kafka topic. It establishes how broadly records can be processed in parallel, while also shaping ordering, broker workload, and operational recovery. section 2.3.3 section 2.1

Choose the count alongside the topic’s ordering and operational requirements:

  • Direct records that must remain ordered to the same partition, commonly by using a stable key such as a customer identifier. section 2.3.3 section 2.2.3
  • Treat increasing the count as a capacity and scalability decision: more partitions can increase parallelism but consume broker resources and enlarge metadata. section 2.4.6 section 2.1
  • Set the count deliberately before production. Increasing it later can disrupt key-based ordering, while decreasing it requires deleting and recreating the topic. section 2.4.6
  • Review recovery impact: more leader partitions can lengthen leader re-election after a broker shutdown. section 2.4.6

Customer 360 topic configuration

A Customer 360 proof of concept assigns nine partitions to customer-profile and transaction topics. Events keyed by customer identifier remain together, allowing balance or profile updates to be processed in order while consumers work in parallel. The same configuration also specifies three replicas and two minimum in-sync replicas; these settings address availability rather than partition count itself. section 2.3.3 section 2.2.3

asyncapi: 3.0.0
info:
  title: Customer 360 Project
  version: 1.0.0
  description: >
    This project aims to aggregate data from various sources, providing a
    comprehensive view of customer information.

channels:
  customerProfile: 
    description: Storing profile information of customers.
    address: CUSTOMER_PROFILES
    bindings: 
      kafka:
        partitions: 9 #1
        replicas: 3    
        topicConfiguration:
          min.insync.replicas: 2    #2
  transactions:
    description: Information about customer transactions.
    address: TRANSACTIONS 
    bindings:
      kafka:
        partitions: 9 
        replicas: 3 
        topicConfiguration:
          min.insync.replicas: 2

Inspect the AsyncAPI Kafka bindings showing nine partitions alongside replicas and minimum in-sync replicas for customer-profile and transaction channels. section 2.3.3

How Kafka for Architects covers it

How deep it goes
Explains selection trade-offs, key-based ordering, resource costs, metadata limits, recovery effects, and topic-change constraints.
Examples
Uses Customer 360 profile and transaction topics, nine-partition configurations, and keyed customer balance updates.
What it assumes
Assumes Kafka topics, brokers, producers, consumers, and keys; establishes partitions as Kafka’s unit of parallel processing and ordering.
What you can do after
Evaluate partition sizing and configure topics without separating parallelism, ordering, availability, and operational cost.
How it connects
Connects Kafka topics with message ordering, keys, consumer groups, replication factor, brokers, and metadata management.

Also explained in

Compare how 2 books explain partition count →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.