skip to content

When is a single-partition topic justified for ordering, and what alternatives give ordering without sacrificing throughput?

level: principalimportance: should knowfreq 40%

answer

  1. 1 partition = global order, no scaling
  2. Single partition only for low-volume global streams
  3. Key by the ordering domain
  4. Oversize partitions up front (repartition breaks keys)
  5. Per-entity order > global order in practice

basics

~10 s

A single partition gives total topic order but caps throughput to one consumer and one broker. Prefer keyed multi-partition topics so you keep per-entity order while scaling, reserving single-partition for genuinely global-order, low-volume streams.

solid answer

~50 s

A single-partition topic is the only way to get a global total order across a topic, but it serializes all traffic through one partition leader and one consumer in a group — no horizontal scaling, and the partition becomes a hotspot and a single point of replication load. It's justified only for low-volume control/audit streams where every event truly must be globally ordered (e.g. a config-change log). The scalable alternative is a keyed multi-partition topic: choose a partition key matching your ordering domain (the entity you need ordered) so you get per-key total order while spreading keys across partitions for parallelism. Choose partition count generously up front since growing it later remaps keys. If a single key is itself a hotspot, you can sub-shard the key or accept that that key's throughput is bounded. Global order is rarely a true requirement — usually per-entity order suffices.

go deeper

for a junior

Knows one partition gives full order but no parallelism.

for a middle

Contrasts single-partition vs keyed multi-partition and the throughput cost.

for a senior

Sizes partitions, picks keys to the ordering domain, and handles repartition hazards.

for a principal

Narrows the ordering requirement to the minimal domain, sets key/partition-count conventions, and manages hotspot and growth tradeoffs across the platform.

## Why single partition = global order Kafka orders only within a partition. So the *only* way to totally order an entire topic is to have exactly **one partition**: all records funnel into one append-only log with one offset sequence. ## The cost - **No parallelism in the consumer group:** at most one consumer instance can own a partition, so consumption can't scale out. Throughput is capped at a single consumer's rate. - **Broker hotspot:** one broker is the leader for that partition and handles all produce/replicate/fetch traffic for the topic. You can't spread load. - **No room to grow:** you can add partitions later, but that *breaks* the global-order property you bought the single partition for, and remaps any keys. ## When it's actually justified Reserve single-partition topics for **low-volume streams where global order is a genuine requirement**: a cluster-wide config/feature-flag change log, a small audit/command stream, a leader-election or sequencing channel. The volume is low enough that one consumer keeps up, and the semantics demand a single global timeline. ## The better default: keyed multi-partition For almost everything, you don't need *global* order — you need **per-entity order** (all events for one user/order/account ordered). Use a multi-partition topic keyed by that entity: - Same key -> same partition -> per-key total order. - Different keys spread across partitions -> parallel consumption. This gives ordering *where it matters* and scaling *everywhere else*. ## Design decisions for the keyed approach 1. **Pick the key = your ordering domain.** If you need orders ordered per customer, key by customerId. The key defines the granularity of both ordering and parallelism. 2. **Size partitions generously up front.** Because partition selection is `hash(key) % numPartitions`, increasing partitions later remaps keys and breaks cross-boundary per-key order. Over-provisioning partitions is cheaper than repartitioning an ordered topic. 3. **Watch key hotspots.** A skewed key (one giant customer) bounds that key's throughput to one partition. Mitigate by sub-sharding the key (e.g. `customerId#bucket`) when global per-customer order can be relaxed to per-bucket order, or accept the cap. 4. **Consumer parallelism = partition count.** You can't have more *active* consumers in a group than partitions, so partition count also caps consumer scale-out. ## Principal-level framing Global total order is an expensive, rarely-true requirement. The architectural job is to *narrow* the ordering requirement to the smallest domain that the business actually needs (usually per-entity), express that as the partition key, and size partitions for both throughput and future growth — so you never have to choose between order and scale.

  • What concrete workload would justify a single-partition topic?
    A low-volume, global-order stream such as a cluster-wide config/feature-flag change log or an audit/command sequence, where one consumer easily keeps up and a single global timeline is semantically required.
  • You picked a keyed topic but one key is a throughput hotspot. What are your options?
    Sub-shard that key (e.g. append a bucket to it) to spread it across partitions if you can relax to per-bucket order, increase overall partition count proactively, or accept that the key's throughput is capped at one partition because strict per-key order requires co-location.

saying these in an interview costs you the question

  • Defaulting to single-partition topics for ordering on high-volume streams
  • Assuming you can later add partitions to a single-partition ordered topic for free
  • Treating global order as a default requirement instead of per-entity order
  • Ignoring that consumer parallelism is capped by partition count
  • Choosing a key without considering hotspot skew

context