Company
Date Published
Author
Coralogix Team
Word count
2770
Language
English
Hacker News points
None

Summary

Kafka Streams offers a feature called windowing that provides statistical insights into data over a specific timeframe by utilizing tumbling time windows and storing data in a local database known as a state store. The article explains the usage of different types of timestamps, such as clock time, record timestamp, stream time, and event time, in the context of Kafka Streams. It describes the process of implementing tumbling time windows in Scala and tuning RocksDB, a database used to manage local state stores in Kafka Streams, to optimize memory usage. The text illustrates how data records with keys and timestamps are consumed, accumulated, and presented in a windowed topic, showing how records are counted over a given window. It further discusses the importance of a grace period and tuning parameters in RocksDB to balance memory and CPU usage, reducing memory consumption from 10 GB to 3 GB while maintaining efficient CPU usage. The fine-tuning process involves adjusting configurations such as the LRU cache size, write buffer manager size, and the ratio of read/write cache to optimize resource use without causing excessive CPU demand.