Time Series Data Encoding for Efficient Storage: A Comparative Analysis in Apache IoTDB

Jinzhao Xiao, Yuxiang Huang, Changyu Hu, Shaoxu Song, Xiangdong Huang, Jianmin Wang

TL;DR

This paper tackles the challenge of efficiently storing massive time series data, a growing problem with the explosion of IoT devices. The authors present a comprehensive comparative analysis of various lossless encoding techniques within the Apache IoTDB database, revealing how different data characteristics significantly impact their performance. This work provides crucial insights for selecting the optimal encoding strategy for specific time series datasets, leading to substantial storage savings and improved query performance.

What Problem Does This Paper Address?

The proliferation of IoT devices and sensors has led to an exponential increase in time series data. Storing and managing this data efficiently is a significant challenge for database systems. Time series databases, like Apache IoTDB, employ columnar storage and encoding techniques to reduce storage footprint. However, time series data exhibits diverse characteristics (e.g., scale, delta, repeats, increases), and different encoding algorithms perform variably depending on these features. The paper aims to systematically analyze and compare these encoding techniques within a real-world time series database (Apache IoTDB) to understand their effectiveness across various data types and features, ultimately guiding users in choosing the best encoding strategy.

Methods

The authors conducted a comparative analysis of several lossless encoding algorithms suitable for time series databases. They first identified key numerical data features that influence encoding performance: scale (mean, variance, spread of values), delta (mean, variance, spread of differences between consecutive values), repeat rate (consecutive identical values), and increase rate (consecutive increasing values). They also considered text data features like exponent of Zipfian distribution, domain size, average length, and repeat rate.

To facilitate their analysis, they developed a benchmark that includes:

  1. Data Generators: Synthetic data generators for numerical and text time series, allowing control over specific data features.
  2. Real-world Datasets: A collection of publicly available and industry-partner datasets.
  3. Evaluation Metrics: Compression ratio (space cost reduction) and time costs (insert and select times).

They then implemented and evaluated six numerical encoding algorithms (TS_2DIFF, GORILLA, RAKE, RLE, RLBE, SPRINTZ) and three text encoding algorithms (DICTIONARY, HUFFMAN, RLE) within Apache IoTDB. The analysis involved both qualitative assessments based on data features and extensive quantitative experiments.

Datasets

The study utilized a combination of synthetic and real-world datasets:

Synthetic Datasets: * Numerical: Generated using a custom data generator with controllable parameters for mean, delta mean, delta variance, repeat rate, and increase rate. * Text: Generated using a custom data generator with controllable parameters for exponent of Zipfian distribution, domain size, average length, and repeat rate.

Real-world Datasets: * Numerical: MSRC-12, UCI-Gas, WC-Vehicle, TH-Climate, CW-AIOps, CS-Ship, TY-Carriage, WH-Chemistry, CR-Train, CB-Engine. * Text: CW-AIOps (log dataset), Web Server Access Logs, Incident Event Log, Web Log.

Key Insights and Ideas

  • No One-Size-Fits-All: The most striking insight is that no single encoding algorithm excels across all data types and features. The effectiveness of an encoding strategy is highly dependent on the specific characteristics of the time series data.
  • Feature-Specific Performance: Different algorithms are optimized for different data patterns. For instance, RLE-based algorithms (RLE, RLBE, SPRINTZ) perform well with high repeat rates, while differential encoding methods (TS_2DIFF, GORILLA) are better suited for data with small deltas.
  • Data Type Matters: Numerical data types (INT32, INT64, FLOAT, DOUBLE) also influence performance, with some algorithms showing better results for integer types due to their bitwise properties.
  • Trade-offs Exist: There's often a trade-off between compression ratio and encoding/decoding time. Algorithms that achieve higher compression might incur higher computational costs, and vice-versa.
  • Text Encoding Challenges: Text data presents unique challenges. HUFFMAN excels in compression ratio for skewed distributions but is slow for selection. DICTIONARY is effective for longer text values but suffers with large domains.

Key Results

  • TS_2DIFF: Consistently showed good compression ratios across various numerical data types and features, particularly for datasets with large delta means.
  • GORILLA: Performed well on data with small variance and delta mean, especially for integer types.
  • RLE-based algorithms (RLE, RLBE, SPRINTZ): Demonstrated strong performance with high repeat rates.
  • RAKE: Showed poor performance, often worse than plain storage, especially for INT32 and FLOAT data, due to its bit-level approach not effectively handling sparse '1's.
  • Text Encoding: HUFFMAN achieved the best compression ratio on real-world text data but had the worst time cost. DICTIONARY offered a good balance of compression and time cost when compression was applied.
  • Compression vs. Encoding: The study confirmed that applying general-purpose compression (SNAPPY, GZIP, LZ4) after encoding further reduces storage but adds to processing time.

Limitations and Future Work

  • Limited Scope of Algorithms: The study focused on a specific set of lossless encoding algorithms suitable for Apache IoTDB. Other advanced or specialized algorithms might offer different performance characteristics.
  • Qualitative vs. Quantitative: While qualitative analysis was performed, the quantitative evaluation is crucial for practical decision-making.
  • Recommender System: The authors suggest developing a more advanced encoding recommender system, potentially using machine learning, to automatically select the best encoding strategy for a given dataset.
  • Balancing Space and Time: Future work could focus on algorithms that better balance storage space and query processing time, especially for real-time applications.
  • Incremental and Transfer Learning: Exploring incremental and transfer learning could help adapt encoding strategies to evolving data features and generalize across unseen datasets.

Summary updated

BibTeX
@article{xiao2022time,
  author = {Jinzhao Xiao and Yuxiang Huang and Changyu Hu and Shaoxu Song and Xiangdong Huang and Jianmin Wang},
  title = {{Time Series Data Encoding for Efficient Storage: A Comparative Analysis in Apache IoTDB}},
  journal = {Proc. VLDB Endow.},
  year = {2022},
  doi = {10.14778/3547305.3547319},
}
Figure