Prometheus use TSDB database, which is in-memory database(written in GoLang), which is temporary storage, to store time series metrics of infrastructure.
Prometheus is supposed to provide time series metrics, which needs permanent storage, to store the information. For example: CPU metrics of a Host for last month.
How prometheus handles persistency(permanent storage) of time series data? Because TSDB is in-memory database..
CodePudding user response:
The Prometheus TSDB is part in-memory, part on-disk. Recent data is kept in-memory and backed up on-disk in WAL (write ahead log) segments, as it's the most frequently accessed. If the instance is shut down the in-memory data can be restored from the WAL. After a few hours the in-memory data is formally saved to the disk in the format of Blocks. Therefore, all data is persisted until its retention period expires.
Some more good resources can be found in the TSDB READme: https://github.com/prometheus/prometheus/blob/main/tsdb/README.md.