Skip to main content

Apache Pulsar

At a glance
  • Problem solved: give many applications in the same company a shared messaging service, with millions of topics, a latency of a few milliseconds and replication across datacenters, without tying serving to storage.
  • Era: first deployment at Yahoo in Q2 2015, open sourced in September 2016, Apache Incubator on June 1, 2017, top-level project on September 19, 2018.
  • Created by: Yahoo (open source post signed by Joe Francis and Matteo Merli); Matteo Merli becomes Vice President of Apache Pulsar and co-founds Streamlio then StreamNative.
  • Category: pub-sub messaging and event streaming.

Historical context​

In the mid-2010s, Yahoo products such as Mail, Finance, Sports, the Gemini Ads platform or the Sherpa database need to exchange messages reliably, across several datacenters. Yahoo wants a shared service where each application is "onboarded as tenants", aiming at "supporting a million topics" and a publish latency of 5 ms on average, 15 ms at the 99th percentile.

Yahoo already has home-grown building blocks: ZooKeeper, "open-sourced by Yahoo in 2008", and BookKeeper, a distributed log "originally developed at and open-sourced by Yahoo in 2011". Pulsar assembles them differently from Kafka: the broker "has no durable state", and messages are written to BookKeeper. The first instance is deployed in Q2 2015.

In September 2016, Joe Francis and Matteo Merli open source Pulsar. The service then runs in more than 10 datacenters with "full mesh" replication, more than 100 billion messages per day and more than 1.4 million topics. Pulsar enters the Apache Incubator on June 1, 2017 and becomes a top-level project on September 19, 2018; the ASF hails a "multi-tenant" system that "separates the serving and storage layers", with Matteo Merli as Vice President.

Matteo Merli also co-founds Streamlio with Karthik Ramasamy and Sanjeev Kulkarni, around Pulsar and Heron (the successor of Storm at Twitter); Splunk announces its intent to acquire it on October 21, 2019. The same year, Sijie Guo and Matteo Merli found StreamNative, which raises a $23M Series A in September 2021.

Key idea​

In Kafka, the broker serves clients and stores partitions on its disks. Pulsar splits the two roles: stateless brokers receive and serve messages, and a separate storage layer, Apache BookKeeper, makes them durable. Each topic is served by a single broker, but its data does not live on that machine: it is replicated across several bookies, and capacity grows by adding bookies. On top of that, Pulsar was "created from the ground up as a multi-tenant system".

How it works​

  • Brokers: "a stateless component" that receives messages from producers, writes them to BookKeeper and dispatches them to consumers.
  • Bookies: the BookKeeper nodes. They keep the write journal and the storage on separate disks.
  • Ledgers and managed ledger: a ledger is "append-only" with "a single writer"; a topic is a sequence of ledgers, handled by the managed ledger.
  • Metadata: a metadata store of choice, Oxia (recommended), ZooKeeper or RocksDB.
  • Multi-tenancy: tenant, namespace, topic hierarchy. The tenant carries authentication and allowed clusters; policies set on a namespace (retention, storage quotas) apply to all its topics.
  • Cursors: the position of each subscription is also stored in BookKeeper.
  • Subscriptions: an exclusive subscription behaves like a classic pub-sub topic, a shared subscription like a work queue.
  • Geo-replication: replicators built into the brokers copy messages to the other clusters.
  • Tiered storage: older, already sealed segments of a topic are offloaded to object storage (S3, Google Cloud Storage, Azure...).
persistent://acme/payments/transactions
| | |
| | topic
| namespace (retention, quotas)
tenant (a team, an application)

clients producers and consumers
|
serving stateless brokers
|
storage BookKeeper bookies (3 copies by default)
|
archive object storage for sealed segments

By the numbers​

FigureContextSource
5 ms and 15 msAverage and 99th percentile publish latency targeted by Yahoo (2016)Yahoo Engineering blog 2016
More than 100 billionMessages per day at Yahoo (2016)Yahoo Engineering blog 2016
More than 1.4 millionTopics in production at Yahoo (2016)Yahoo Engineering blog 2016
More than 10Datacenters linked by "full mesh" replication at Yahoo (2016)Yahoo Engineering blog 2016
40,000Topics served by a single broker at Yahoo (2016)Yahoo Engineering blog 2016
About 15 monthsLength of Apache incubation, from June 2017 to September 2018Incubator page
$23MStreamNative Series A led by Prosperity7 Ventures (September 2021)StreamNative press release

Milestones​

  • 2008 and 2011: Yahoo open sources ZooKeeper then BookKeeper, Pulsar's building blocks.
  • Q2 2015: first Pulsar instance in production at Yahoo.
  • September 2016: open sourced by Yahoo.
  • June 1, 2017: enters the Apache Incubator.
  • September 19, 2018: Apache top-level project (announced on September 25).
  • October 21, 2019: Splunk announces its intent to acquire Streamlio.
  • 2019: Sijie Guo and Matteo Merli found StreamNative.
  • September 14, 2021: StreamNative raises a $23M Series A.

Did you know?​

  • A Yahoo family. ZooKeeper (2008), BookKeeper (2011) and Pulsar (2016) were all open sourced by Yahoo.
  • A million topics. Yahoo designed Pulsar for "supporting a million topics"; it was above 1.4 million in production as early as 2016, with up to 40,000 per broker.
  • Queue and pub-sub in one tool. Depending on the subscription type, the same topic acts as a broadcast (exclusive) or a work queue (shared).
  • The garbage collector as an opponent. Yahoo cites JVM garbage collection pauses among the challenges of holding latencies of a few milliseconds.

Strengths and limitations​

StrengthsLimitations
Stateless brokers, storage that grows by adding bookiesThree systems to deploy: brokers, bookies and metadata store
Native multi-tenancy (tenant, namespace, topic)JVM garbage collection pauses, a challenge cited by Yahoo (2016)
Built-in geo-replication, "full mesh" at Yahoo across more than 10 datacentersLong tied to ZooKeeper for metadata (Oxia and RocksDB alternatives today)
Tiered storage to a "cheaper storage mechanism" to keep a long historyReading offloaded data is slower than reading from BookKeeper

What came next​

  • To compare with Kafka, where the broker both serves and stores partitions: Pulsar separates these two layers.
  • Streamlio combined Pulsar and Heron, the successor of Storm at Twitter, before its acquisition by Splunk.
  • Pulsar adds to messaging "lightweight compute and a connector frameworks", cited by the ASF as early as 2018.

Sources​

To do
  • Origin of the name "Pulsar": no source found.
  • Exact date of Yahoo's open source post (September 7, 2016 according to secondary sources).
  • Start of development at Yahoo: 2010 according to the StreamNative press release, 2014 according to Yahoo Japan slides [S]; only the Q2 2015 production deployment is sourced by Yahoo.
  • Founding date of Streamlio: 2017 according to StreamNative, 2016 according to Lightspeed [S].
  • Actual closing of Splunk's acquisition of Streamlio: only the intent announcement is sourced.