Skip to main content
BRILLIQS

Apache Pulsar

A messaging and streaming platform that keeps its serving layer and its storage layer separate.

Apache Pulsar is an open source platform for messaging and streaming. Applications publish messages to topics and other applications subscribe to them. Pulsar splits the work between brokers, which serve clients, and a storage layer built on Apache BookKeeper, which holds the messages. It also supports multiple tenants on one cluster.

Apache Pulsar in plain terms

Apache Pulsar is a platform for moving messages between systems. One application publishes a message to a named topic and any application that has subscribed to that topic receives it. The documentation describes Pulsar as a messaging and streaming platform, and the word streaming matters because messages are stored rather than dropped once delivered.

The design decision that shapes everything else

Most messaging systems keep serving and storage in the same process. Pulsar separates them.

Brokers accept connections, route messages and track subscriptions. They hold no message data themselves. Storage is handled by Apache BookKeeper, which runs as its own set of nodes.

The practical result is that the two concerns scale independently. Needing more capacity to serve busy clients does not force you to add storage, and keeping a longer history does not force you to add brokers.

Subscriptions decide the behaviour

A Pulsar topic can act like a queue or like a stream. Which one it is depends on how consumers subscribe:

  • Exclusive. One consumer only. Anything else attempting to subscribe is refused.
  • Failover. Several consumers connect, one is active and the others wait to take over.
  • Shared. Messages are spread across all connected consumers, which suits work that can be processed in any order.
  • Key shared. Messages are spread across consumers, but every message with a given key goes to the same consumer, so related messages stay in order.

This is why Pulsar is often described as covering both queuing and streaming. The topic does not change, only the subscription type does.

Tenants, namespaces and topics

A Pulsar cluster is organised in three levels. Tenants sit at the top, usually representing a team or a product. Each tenant holds namespaces, and each namespace holds topics.

Policies such as retention, message expiry and geo replication are applied at the namespace level. That is what makes it practical for separate groups to share one cluster without interfering with each other.

Extra pieces the platform includes

Pulsar Functions run small pieces of logic against messages on a topic and can publish the result elsewhere, without a separate processing framework.

Pulsar IO provides connectors for moving data between Pulsar and external systems.

Tiered storage moves older segments of a topic into object storage. The data remains readable through the same client interface, so consumers do not need to know where it now lives.

Geo replication copies messages between clusters in different regions, configured on the namespace.

Who Pulsar suits

Pulsar fits teams building event driven systems, and platform teams that want one messaging cluster shared by several groups. Client libraries are available for Java, Go, Python, C++, Node.js and C sharp, so applications in different languages can use the same topics.

What to consider before adopting it

Pulsar has more components to operate than a single process broker. A deployment involves brokers, BookKeeper nodes and ZooKeeper or an alternative metadata store, and all of them need monitoring.

The subscription model is also something to learn properly, because the same topic behaves quite differently depending on how it is consumed.

Trying it out

The documentation includes a standalone quickstart that runs Pulsar as a single process on one machine, which is enough to publish and consume messages from the command line. Separate guides cover Docker, Kubernetes and full cluster deployment.

Key features of Apache Pulsar

Capabilities described in the official documentation.

Serving and storage kept apart

Brokers handle client connections while Apache BookKeeper stores the messages, so each layer can be scaled on its own.

Four subscription types

Exclusive, failover, shared and key shared subscriptions let one topic behave as a queue or as a stream depending on the consumer.

Tenants and namespaces

A cluster is divided into tenants and namespaces, each with its own policies, so separate teams can share one deployment.

Geo replication

Messages can be replicated between clusters in different locations as a configuration option on a namespace.

Advantages of Apache Pulsar

Factual advantages that follow from the features above.

Storage grows separately from traffic

Because storage is a separate layer, holding more history does not require adding brokers to serve more clients.

Queue and stream patterns on one system

The subscription type decides the behaviour, so work queues and replayable streams do not need two different products.

Older data can move to cheaper storage

Tiered storage offloads older segments of a topic to object storage while they stay readable through the same interface.

Clients exist for several languages

Applications written in different languages use the same topics through the client libraries the project publishes.

Common use cases for Apache Pulsar

Situations the official documentation describes this tool as being used for.

Application messaging

Distributing work to a pool of consumers

A shared subscription spreads messages across many consumers so tasks are processed in parallel.

Stream processing

Feeding a stream processor

A processing engine subscribes to a topic and reads the message stream as it arrives for continuous computation.

Platform engineering

Running several teams on one cluster

Each team is given its own tenant and namespaces, with quotas and retention set separately for each.

Distributed systems

Replicating events between regions

Geo replication copies messages between clusters so a second region holds the same topics.

Official website

Everything on this page is based on the official documentation for Apache Pulsar. You can read the source here.

Apache Pulsar official documentation

Frequently asked questions about Apache Pulsar

Answers taken from the official documentation for this tool.

It spreads messages across several consumers while sending all messages with the same key to the same consumer. That keeps the order of related messages while still using more than one consumer.

No. Pulsar Functions are part of Pulsar. A function consumes messages from one or more topics, applies logic you supply and can publish the result to another topic, without deploying a separate processing framework.

BookKeeper is the storage layer that holds message data durably. Keeping it separate from the brokers means the two can be sized and scaled independently.

Yes. Retention policies are set per namespace and control how long messages are kept beyond acknowledgement. Topic compaction is also available where only the latest message for each key is needed.