PCA Prometheus Architecture & Components 3 — Questions and Answers
Question 1: What is the purpose of the Write-Ahead Log (WAL) in Prometheus's TSDB?
- To send metrics to remote storage
- To persist in-memory samples before they are compacted into blocks (Correct answer)
- To authenticate scrape requests
- To store Alertmanager configuration
Correct answer: To persist in-memory samples before they are compacted into blocks
The WAL records incoming samples so that in-memory data can be recovered after a crash before it is written to immutable TSDB blocks.
Question 2: Which Prometheus feature allows writing samples simultaneously to an external system like Thanos or Cortex?
- Remote read
- Remote write (Correct answer)
- Federation
- Pushgateway
Correct answer: Remote write
Remote write forwards scraped samples in real time to a remote storage endpoint, enabling long-term storage and multi-tenant scenarios.
Question 3: What is a Prometheus 'target' in the context of its architecture?
- An alert that has been triggered
- An HTTP endpoint Prometheus scrapes for metrics (Correct answer)
- A recording rule output
- A Grafana dashboard panel
Correct answer: An HTTP endpoint Prometheus scrapes for metrics
A target is an HTTP endpoint (typically /metrics) that Prometheus polls at each scrape interval to collect time-series samples.
Question 4: How does Prometheus handle high cardinality when scraping a target with millions of unique label combinations?
- It automatically drops high-cardinality metrics
- It stores each unique label set as a separate time series, which can exhaust memory (Correct answer)
- It hashes label values to reduce storage
- It sends cardinality warnings to Alertmanager
Correct answer: It stores each unique label set as a separate time series, which can exhaust memory
Each unique combination of metric name and label set is a distinct time series; too many unique combinations cause memory and CPU exhaustion known as a 'cardinality explosion'.
Question 5: In Prometheus architecture, what is the function of the 'notifier' component?
- It applies relabeling to scrape targets
- It sends firing alerts from the rule evaluator to Alertmanager (Correct answer)
- It compresses TSDB blocks
- It serves the web UI
Correct answer: It sends firing alerts from the rule evaluator to Alertmanager
The notifier queues and dispatches pending alert notifications to one or more Alertmanager instances over HTTP.
Question 6: Which TSDB concept represents a contiguous on-disk directory containing immutable compressed samples for a fixed time range?
- Chunk
- Block (Correct answer)
- Segment
- WAL frame
Correct answer: Block
A TSDB block is a directory (e.g., 01BX…) holding an index, chunks, and metadata for a specific time range, produced by compaction from the WAL.
Question 7: What happens to TSDB blocks when Prometheus's compaction process runs?
- Blocks are sent to Alertmanager for archival
- Smaller blocks are merged into larger blocks to improve query performance (Correct answer)
- All blocks are deleted and reloaded from WAL
- Blocks are converted to Parquet format
Correct answer: Smaller blocks are merged into larger blocks to improve query performance
Compaction merges multiple smaller time-range blocks into larger ones, reducing the number of files and improving read efficiency.
What is the purpose of the Write-Ahead Log (WAL) in Prometheus's TSDB?