Apache Pulsar
Apache Pulsar is an open-source, distributed messaging and streaming platform. Like Kafka, it stores messages in durable, ordered, replayable topics. Unlike Kafka, it separates the two jobs a broker normally does: stateless brokers serve producers and consumers, while a separate storage layer, Apache BookKeeper, keeps the data. It was built at Yahoo to serve many applications on one shared platform and became an Apache top-level project in 2018.
The properties that define it:
- Compute separated from storage: brokers hold no durable data of their own, so they can be added, removed or replaced in seconds without copying anything. Storage nodes (bookies) scale on their own.
- Segment-based storage: a topic isn't one big file on one machine. It's a chain of small segments, each spread across several bookies, so a single topic can grow without bound and new storage nodes take load immediately.
- Queuing and streaming in one system: the same topic can be read as a log (ordered, replayable) or as a work queue (shared consumers with per-message acknowledgement), depending on the subscription type.
- Built for multi-tenancy: tenants, namespaces, quotas and authorization are first-class concepts, and a single cluster can host very large numbers of topics.
- Geo-replication built in: topics can be replicated between clusters in different regions with configuration, not extra tooling.
Pulsar comes up less often than Kafka in interviews, but it's a strong answer when a question pushes on Kafka's weak spots: elastic scaling without rebalancing data, millions of topics (one per user or device), mixing queue and stream semantics, many tenants sharing one platform, or multi-region replication. It's also a great reference architecture if you're asked to design a distributed message queue yourself, because the separation of serving and storage is an idea worth borrowing. This post covers how it works and when it's worth bringing up.
The Core Concepts
Tenant: the top of the hierarchy, usually a team or a customer. Tenants get their own authentication, authorization and allowed clusters.
Namespace: a group of topics within a tenant, and the unit of policy: retention, TTL, quotas, replication to other clusters and more are set per namespace.
Topic: a named channel, addressed as persistent://tenant/namespace/topic. Topics are created automatically on first use if you allow it, and they're cheap, so it's normal to have hundreds of thousands of them.
Partitioned topic: a single topic is served by one broker, so for throughput beyond that, a topic can be split into N partitions. Each partition is an internal topic owned by some broker. Producers route messages to partitions by key hash or round-robin, just as in Kafka.
Subscription: a named cursor on a topic, with a type that says how messages are handed out to the consumers attached to it. Each subscription receives every message on the topic; consumers within a subscription share them.
Message: a payload with optional key, properties, event time and a message ID (ledger ID, entry ID, batch index) that identifies its position.