Gorilla is an in-memory time series database that Facebook uses for monitoring.
It has four requirements:
- Fault tolerance. If one of the servers of Gorilla fails, writes continue.
- High availability. All writes go to multiple regions, so some data is eventually consistent.
- Anomaly detection, for a network outage, a config change or a deployment.
- A write heavy load. Writes are 100 times more than reads. In Memcached, reads are a thousand times more than writes.
Memory is expensive, so Facebook stores only the last 26 hours in memory. 85% of all queries fall in that range. Older data stays in the archive, in a cheaper file system.
Small amounts of data may be lost. High availability does not mean durability, and that is not okay for a trading system.
Data points are expensive, so each one is compressed 12 times from its 16 bytes.
Gorilla stores 2 billion unique time series at a 15 second granularity. Read latency is less than 1 millisecond, because other systems read a monitoring system to fix a failure automatically.