Skip to content

Commit 7479e9e

Browse files
committed
prometheus fsync
1 parent 6301406 commit 7479e9e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

prometheus/tips.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [When does CPU matter?](#when-does-cpu-matter)
1212
- [By/Without and Ignoring/On](#bywithout-and-ignoringon)
1313
- [Authentication and encryption for Prometheus and its exporters](#authentication-and-encryption-for-prometheus-and-its-exporters)
14+
- [Prometheus and fsync](#prometheus-and-fsync)
1415

1516
## `avg_over_time`
1617

@@ -159,3 +160,15 @@ To avoid recalculating the same thing over and over, you can use `recording rule
159160
## Authentication and encryption for Prometheus and its exporters
160161

161162
Source: <https://0x63.me/tls-between-prometheus-and-its-exporters/>
163+
164+
## Prometheus and fsync
165+
166+
Prometheus `fsync` refers to the crucial disk synchronization operations, especially within its Time Series Database (TSDB) and its Write-Ahead Log (WAL), ensuring recently ingested metrics data is safely written to durable storage to prevent loss during crashes, often manifesting as performance metrics like `prometheus_tsdb_wal_fsync_duration_seconds` which can indicate I/O bottlenecks if too slow.
167+
168+
What fsync means in Prometheus:
169+
170+
- Data Durability: Prometheus uses a Write-Ahead Log (WAL) to buffer incoming metrics before committing them to the main database files.
171+
- fsync() System Call: To guarantee data isn't lost on power failure, Prometheus periodically calls fsync() to force this buffered data from the operating system's cache to the physical disk.
172+
- Performance Impact: This disk write is a critical operation, and if the underlying storage is slow, fsync calls take longer, impacting Prometheus's ingestion rate and overall performance.
173+
174+
I found a link: <https://groups.google.com/g/prometheus-users/c/Oy1qI3Og9ww> but the logic seems to be changed in the current source code (v3.8.0).

0 commit comments

Comments
 (0)