Netflix TechBlog | Medium
Follow
Stop Answering the Same Question Twice: Interval-Aware Caching for Druid at Netflix Scale
Netflix implemented an experimental caching layer to improve Druid query performance at its massive scale. This caching system addresses the problem of redundant queries from dashboards, especially during high-profile events. The core idea is to cache portions of results and only query Druid for the freshest data, introducing a small staleness trade-off. Exponential time-to-live (TTL) values are used, with older data cached longer to handle late-arriving events. The caching system uses a map-of-maps structure for efficient range scans of cached data. The cache intercepts requests at the Druid Router, serving results or querying Druid as needed. The solution combines cached and fresh data, returning a complete result and caching the fresh data asynchronously. Negative caching is used for empty buckets, with precautions against caching trailing empty buckets. The system uses Netflix's Key-Value Data Abstraction Layer (KVDAL), backed by Cassandra, which offers independent TTLs on each data point. The caching layer has significantly reduced Druid query load and improved query times, particularly during high-volume events. The caching system is still experimental, with future goals including integration into Druid itself.