SysPad › analytics lessons › Apache Pinot
How Apache Pinot works
Real-time distributed OLAP store for user-facing analytics: high QPS at low latency, ingesting continuously from Kafka. Brokers scatter each query to the servers holding the segments and merge the answers, so query fan-out and stream ingestion compete for the same cores.
A team doubled their Pinot cluster to make dashboards faster. The average query got quicker and the p99 got worse. Nothing was misconfigured: that is what happens when every query has to ask every server and wait for all of them to answer.
What you will learn
- What does a broker do that a server does not?
- Why does fan-out set your tail latency?
- How do replica groups trade parallelism for predictability?
- Why does real-time ingestion eat into query capacity?
Built for the other kind of analytics
A warehouse is built for a few heavy queries from analysts. Pinot is built for the opposite: thousands of small queries per second from a product feature, answered in tens of milliseconds, over data that arrived from Kafka seconds ago. Think "who viewed your profile this week" rendered inside the app, for every user at once.
Brokers scatter, servers scan
Queries hit a broker. The broker works out which servers hold the segments the query needs, scatters the request to them, and merges what comes back. The servers hold segments on local disk and do the actual scanning. Controllers and Zookeeper keep the map of who holds what.
The published sizing guidance is roughly 1,000 queries per second for a 16 core broker on standard analytical queries, and about the same for a 16 core server in the good case. So you scale brokers with QPS and servers with QPS, data size and ingestion together.
Replica groups: ask fewer servers
Replica group routing arranges servers into groups where each group holds a complete copy of the table. A query is then routed to one group instead of the whole cluster: fan-out drops, the per-server overhead a query pays drops with it, and fewer nodes get the chance to be the slow one.
⚓ On the SysPad node, raise Replica groups and watch throughput climb while latency climbs too. If both moved the same direction, the model would be lying to you.
What else narrows fan-out besides replica groups?
Partitioning the table on the same key the stream is partitioned by lets the broker prune to the servers that can possibly hold matching rows, so a query filtered by that key touches a fraction of the group. Combined with replica groups, a per-user lookup can go from "all 40 servers" to "one server", which is how Pinot reaches the QPS numbers it advertises.
Ingestion runs on the same machines
Real-time tables consume Kafka on the servers themselves: consuming partitions, building segments in memory, then committing them. Those cores are the same cores answering queries, and every replica consumes independently, so a replication factor of 3 means the stream is read and indexed three times over.
⚓ Push Stream ingestion up on the SysPad node and the query ceiling falls even though the server count never changed. A Pinot cluster can be CPU rich and query poor.
Flashcards
- Average query latency is 12 ms, p99 is 400 ms, and every server dashboard looks healthy on average. What is the structural explanation?
- Scatter-gather: each query waits on its slowest participant, so brief per-node hiccups (GC, a hot segment, a noisy neighbour) become the tail for every query that fanned out across them. Narrowing fan-out shrinks the exposure.
- Turning on replica-group routing raised throughput but average latency went up 30%. Did it work?
- Yes, that is the shape of the trade. Fewer servers per query means less parallelism (higher mean) but less overhead and fewer chances to hit a slow node (higher throughput, tighter tail).
- Query capacity dropped by a third after a new real-time table was added, and no query changed. Why?
- Stream consumption and segment building run on the servers, and each replica does that work separately. Ingestion took cores away from scanning.
Sources
- Pinot architecture (brokers, servers, controllers)
- Routing and replica groups
- Capacity planning in Apache Pinot
- Real-time ingestion
- Upsert
Open the SysPad canvas · Official Apache Pinot documentation