Abstract
Modern "Aggregation Precomputation" (AggPre) systems, such as Apache Druid, manage massive datasets by partitioning data into small segments and precomputing approximate summaries. While standard mergeable sketches prevent error growth during aggregation, they also fail to reduce error as more data is combined, hitting a fundamental accuracy ceiling. This paper presents CoopStore, which introduces "Cooperative Summaries." These summaries actively compensate for each other's errors during construction and aggregation. By exploiting the resource asymmetry between storage and query-time memory, CoopStore allows error to decrease as more segments are aggregated, achieving up to 25x better accuracy for large-scale analytics compared to traditional methods.
The Accuracy Ceiling Problem
In modern telemetry and analytics tools, data is often stored in 5-minute windows with precomputed summaries like KLL sketches for quantiles or Count-Min sketches for frequency. At query time, these summaries are merged to provide estimates for larger intervals (e.g., a 1-hour aggregate).
The core issue is the accuracy ceiling of mergeable summaries. Standard sketches are designed to be mergeable without increasing error, but they do not decrease error upon aggregation. For instance, if several 5-minute summaries each have a 12% error, their 1-hour aggregate will still exhibit a 12% error. This creates a "mergeability gap" compared to a single large summary built over the entire hour, which would have significantly lower error (approximately 1%).
Methods: Cooperative Summaries
CoopStore bridges this gap by making summaries work together. The approach leverages a key observation: while long-term storage is constrained, the memory available during ingest (construction) and query time (aggregation) is often much larger.
1. Interval Queries (1D/Time-series)
CoopStore tracks cumulative error over "prefix intervals" rather than treating segments independently:
- CoopFreq: For item frequency, the system identifies items underrepresented in previous segments and "boosts" their counts in the current summary to cancel out the error.
- CoopQuant: For quantiles, CoopStore uses a loss function derived from discrepancy theory to select representative values that minimize the maximum cumulative rank error across the sequence.
2. Multi-dimensional Cube Queries
For data cubes where queries can filter on various dimensions, CoopStore treats error reduction as a global optimization problem:
- Space Allocation: Using Lagrange multipliers, it allocates more storage to segments predicted to be more frequent in the query workload.
- Bias Tuning: It intentionally introduces deterministic bias to individual summaries to reduce variance, then balances these biases across the cube so they cancel out during large aggregations.
Key Insights and Error Scaling
The "aha moment" of CoopStore is the realization that intentional bias can be a feature rather than a bug. By making one summary slightly "over" and the next slightly "under," the aggregate result becomes significantly more precise. This is supported by a "precise accumulator" maintained in RAM during query tasks to track and resolve errors.
As shown in the theoretical analysis, for an aggregation of $k$ summaries, mergeable sketches maintain an $O(1/s)$ error. CoopStore reduces this to $O(1/\sqrt{ks})$ for random samples and as low as $O(\log k / ks)$ for interval frequencies.
Evaluation and Key Results
The authors evaluated CoopStore using diverse datasets, including CAIDA internet traffic, Microsoft production logs, Instacart grocery records, and UCI power readings.
- Accuracy Gains: CoopStore reduced error by up to 25x for interval-based quantile queries and 8x for frequency queries compared to standard methods like KLL or Misra-Gries.
- Cube Optimization: Multi-dimensional queries saw a 4.5x reduction in average error through optimized space allocation and bias tuning.
- Efficiency: Query times remained under 10ms for most workloads, ensuring suitability for interactive dashboards.
- Robustness: The system remains effective even when predicted query patterns are slightly inaccurate.
Limitations
While CoopStore offers significant accuracy improvements, it involves higher construction overhead. Building cooperative summaries for quantiles on high-cardinality data can be up to 2000x slower than basic methods, though this is typically acceptable for background batch ingest. Additionally, the cube optimizations depend on a somewhat predictable workload, and the current model assumes static segments, requiring further research for real-time, frequently updated data.
Summary updated