Two hour blocks, log files and a second cluster

video locked
Enroll to watch

8 mins

Chapters
About
Discussion0
Notes
Be the first to start a conversation!

Gorilla keeps its compressed data in blocks of at most two hours, because a query on compressed data decompresses a block from its first value.

Decompression is a linear pass. Compression needs less memory and adds latency, so the blocks are kept short.

A query finds a series in three steps, all in memory:

  1. The key is hashed to a shard. The shard manager knows which node holds that shard.
  2. The shard map points to a time series map, and the series there points to its blocks.
  3. Each block leads to the block two hours later. These blocks are immutable.

Points are appended to a log file, and every 64 KB is flushed to GlusterFS. A flush that fails loses data, and that is accepted.

Every two hours the compressed block is persisted. A restarted instance rebuilds its current block from the log files and loads the older blocks.

A second cluster runs with no consistency guarantee. When one fails, reads go to the other. After 26 hours without a problem both hold the same data.