<!-- llms-explorer concept facts · https://llms-explorer.com/tree/lock-free-diagnostic-sampling-engine/ · pack 2026-10-15 · ~1179 tokens -->

# Lock-Free Diagnostic Sampling Engine

> Depth-first rabbithole dossier for Lock-Free Diagnostic Sampling Engine; source-anchored research pack.

Parent: [Diagnostic Tool Design](https://llms-explorer.com/tree/diagnostic-tool-design/) · 3 facets · 8 facts · page: https://llms-explorer.com/tree/lock-free-diagnostic-sampling-engine/

## Measurements and reference values

- [low] In MongoDB 9.0, `$queryStats` collects statistics for a sample of 1% of read and write operations by default, with the sampling rate adjustable via `internalQueryStatsSampleRate` and `internalQueryStatsWriteCmdSampleRate` parameters accepting values between 0.0 and 1.0. (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/reference/operator/aggregation/queryStats.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#core`
- The default `diagnostic.data` folder size is reported as 500 MB in one source and 200 MB in another, with the 500 MB value noted as twice the 200 MB default. Sources: https://www.mongodb.com/docs/manual/administration/full-time-diagnostic-data-capture.md, https://www.percona.com/blog/the-diagnostic-data-mongodb-atlas-doesnt-hand-you — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#disagreements`

## Problems, failure modes and limitations

- [low] The default maximum size for the `diagnostic.data` folder is 500 MB; starting in MongoDB 8.3 the default was increased from 250 MB (500 MB for sharded clusters). MongoDB overwrites older data as the folder approaches this limit. (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/administration/full-time-diagnostic-data-capture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#core`
- [low] FTDC data forwarded by OTel or other log shipping pipelines cannot be used for diagnostic purposes. Sources: https://www.mongodb.com/docs/manual/administration/full-time-diagnostic-data-capture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#core`
- [low] Slow operation log messages include a `queryFramework` field indicating the query engine (`classic` for the classic engine) and a `cpuNanos` field specifying total CPU time in nanoseconds, which is only available on Linux systems. (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/reference/log-messages.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#core`

## Facts and statements

- [high] FTDC (Full Time Diagnostic Data Capture) is enabled by default in MongoDB and writes approximately 5,700 metrics every second into the `diagnostic.data` folder. (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/administration/full-time-diagnostic-data-capture.md, https://www.percona.com/blog/the-diagnostic-data-mongodb-atlas-doesnt-hand-you — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#core`
- [low] The `WriterReaderPhaser` writer operations (`writerCriticalSectionEnter`/`Exit`) are wait-free on architectures supporting wait-free atomic increment and lock-free on others. The reader's `flipPhase()` is lock-free with respect to writer calls and may spin-wait for active writer critical sections to complete. Sources: https://raw.githubusercontent.com/HdrHistogram/HdrHistogram/master/src/main/java/org/HdrHistogram/WriterReaderPhaser.java — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#patterns`
- [low] The `flipPhase()` operation is fast (a single atomic op) and lock-free with respect to writer critical section enter/exit calls, requiring no actual writer critical section activity to succeed. Sources: https://raw.githubusercontent.com/HdrHistogram/HdrHistogram/master/src/main/java/org/HdrHistogram/WriterReaderPhaser.java — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/lock-free-diagnostic-sampling-engine-e7903588c9/rabbithole-synthesis.md#patterns`

## Related concepts

- Diagnostic — is a part of Lock-Free Diagnostic Sampling Engine
- Lock-Free — is a part of Lock-Free Diagnostic Sampling Engine
- Sampling — is a part of Lock-Free Diagnostic Sampling Engine
- Engine — is a part of Lock-Free Diagnostic Sampling Engine
