Skip to main content

Apache Pinot

At a glance
  • Problem solved: serve analytics on fresh data (a few seconds old) not to a handful of analysts, but directly to a website's end users, meaning tens of thousands of queries per second at a latency of a few milliseconds.
  • Era: created at LinkedIn in 2013, presented in September 2014, open source on 10 June 2015, Apache Incubator in October 2018, Apache top-level project in July 2021 (announced on 2 August 2021).
  • Created by: LinkedIn's data infrastructure team, including Kishore Gopalakrishna and Xiang Fu, later founders of StarTree.
  • Category: real-time distributed OLAP database (columnar).

Historical context​

In the early 2010s, LinkedIn builds its analytics products on generic systems: Oracle (relational) and Voldemort (key-value). They are not designed for OLAP, and data volume grows "exponentially in both breadth and depth". In 2014, the team writes: "Two years ago we hit a wall". The open source options they examine do not scale: relational and key-value stores serve point lookups well, while "offline" engines such as Hive, Impala or Presto need hundreds of milliseconds to dozens of seconds just to start a query.

So in 2013 LinkedIn starts a multi-year project, codenamed Pinot. After about eight months of iterative development, Pinot serves, in early 2014, the new version of "Who's Viewed Your Profile", the flagship analytics product offered to members, with a target of a few tens of milliseconds per query. By September 2014, Pinot already powers 18 member-facing products and more than 15 internal products, including the XLNT A/B testing platform.

On 10 June 2015, Kishore Gopalakrishna announces that the code is open on GitHub under the Apache 2.0 license. LinkedIn then stores hundreds of billions of records in it and ingests more than a billion per day. The paper "Pinot: Realtime OLAP for 530 Million Users" (Im, Gopalakrishna et al., SIGMOD 2018) describes the architecture and compares it with Druid, the closest system.

Adoption spreads through Uber: Xiang Fu introduces Pinot there, and from March 2017 it powers UberEATS's Restaurant Manager dashboard. The project enters the Apache Incubator on 21 October 2018 and graduates on 21 July 2021. In between, Kishore Gopalakrishna and Xiang Fu found StarTree (seed at the end of 2019 according to its investor CRV, $24M Series A announced in May 2021) to offer Pinot as a managed service.

Key idea​

Turn OLAP into an online service like any other, with website constraints: predictable latency, very high query throughput, no maintenance window. To get there, Pinot is a derived store: it accepts no direct writes, it ingests Kafka streams (freshness of a few seconds) and batches produced on Hadoop (the source of truth), then aggressively indexes immutable segments. The team deliberately gave up joins to guarantee latency.

How it works​

  • Tables and segments: a table is split into immutable, replicated columnar segments (a few dozen million rows, from a few hundred MB to a few GB). Fixing data means replacing a whole segment.
  • Four components:
    • controller: manages tables, schemas and the assignment of segments to servers, through Apache Helix and ZooKeeper (three instances for fault tolerance);
    • broker: receives the query, picks the servers using a routing table, merges partial results (scatter-gather);
    • server: hosts segments and executes queries;
    • minion: background tasks, for example reindexing segments.
  • Hybrid tables: an offline table (Hadoop batches) and a realtime table (Kafka stream) share a time column; the query is rewritten into two, before and after a time boundary, then the results are merged (lambda architecture).
  • Indexes: dictionary and bit packing, inverted indexes (bitmaps), physical sorting on a heavily filtered column (vieweeId for "Who viewed my profile") and star-tree, a partial pre-aggregation structure used transparently when the query allows it.
  • Multi-tenant: several teams share the same hardware, a token bucket prevents one tenant from starving the others.
  • Language: originally PQL, a subset of SQL without joins or subqueries; since Pinot 1.0 (2023), a multi-stage engine brings query-time joins.
SELECT country, COUNT(*) AS views
FROM profile_views
WHERE vieweeId = 42
AND viewDate >= '2018-06-01'
GROUP BY country
ORDER BY views DESC
LIMIT 5;

This illustrative query (table and columns made up for the example), highly selective and repeated for every member, matches the use case Pinot was designed for.

By the numbers​

FigureContextSource
18 + 15Member-facing and internal products served by Pinot (September 2014)LinkedIn blog, 2014
More than 1 B per dayRecords ingested at LinkedIn, out of hundreds of billions stored (June 2015)LinkedIn blog, 2015
530 millionUsers served, title of the paper (2018)SIGMOD 2018 paper
More than 3,000 hostsLinkedIn deployment: more than 1,500 tables, over one million segments, nearly 30 TiB compressed (2018)SIGMOD 2018 paper
More than 50,000Queries per second in production at LinkedIn, across all data centers (2018)SIGMOD 2018 paper
Under 100 ms99th percentile latency at 1,000 queries per second with three servers, at Uber (2017)Uber blog, 2017
6 to more than 100Companies involved in the project over two years (2019 to 2021)StarTree, 2021
26 and 11Committers and PMC members when leaving the incubator (August 2021)ASF board

Milestones​

  • 2013: created at LinkedIn.
  • Early 2014: Pinot serves the redesigned "Who's Viewed Your Profile".
  • 29 September 2014: public presentation on LinkedIn's engineering blog.
  • 10 June 2015: open source on GitHub, Apache 2.0 license.
  • March 2017: Uber launches Restaurant Manager for UberEATS, built on Pinot.
  • June 2018: paper "Pinot: Realtime OLAP for 530 Million Users" at SIGMOD.
  • 21 October 2018: enters the Apache Incubator.
  • May 2021: StarTree announces a $24M Series A.
  • 21 July 2021: graduation voted by the ASF board, announced on 2 August 2021.
  • 19 September 2023: Pinot 1.0, multi-stage engine and joins.

Did you know?​

  • The name comes from wine: "everyone on our team loves Pinot noir", and the pinot noir grape is said to be the hardest to grow and turn into wine while yielding very complex wines, just like data, hard to gather but precious once put to work.
  • A database built for the general public: LinkedIn's "Who viewed my profile" page is served by Pinot: its queries come not from analysts but from the network's members themselves, hence the need for tens of thousands of queries per second.
  • From LinkedIn to Uber: Xiang Fu, co-creator at LinkedIn, introduces Pinot at Uber; Kishore Gopalakrishna says that seeing this success made him understand the potential of user-facing analytics and found StarTree.
  • Users cited by the ASF in 2021: Amazon-Eero, DoorDash, Factual/Foursquare, LinkedIn, Stripe, Uber, Walmart, Weibo and WePay.

Strengths and limitations​

StrengthsLimitations
Latency of a few milliseconds at very high query throughputData immutable per segment, updated by replacement
Real-time (Kafka) and batch (Hadoop) ingestion in the same tableNo joins before the multi-stage engine (1.0, 2023)
Varied indexes, including star-tree, chosen without changing queriesSeveral components to operate (controller, broker, server, minion, ZooKeeper)
Multi-tenant, schemas changeable without downtimePaper benchmarks against Druid published by LinkedIn itself

What came next​

  • Druid is its closest cousin; the SIGMOD 2018 paper compares them on LinkedIn production queries.
  • ClickHouse, open sourced one year later, targets the same needs with a single binary and parts merged continuously.
  • Trino and Presto plug into Pinot to add full SQL and cross-source joins; this is how Uber exposes Pinot to its BI tools.
  • Superset can query Pinot to build dashboards.

Sources​

To do
  • Exact founding date of the StarTree company (only the late 2019 seed is sourced, by an investor).
  • Date the arrival of real-time upserts with a primary source.
  • Recent LinkedIn figures (after 2018) to be found on a public source.
  • Clarify what the "530 Million Users" of the paper title covers (not detailed in the text).