Skip to content

db-analyser: Ability to turn off caching for --lsm - #2156

Merged
jasagredo merged 3 commits into
mainfrom
mkarg/db-analyser-lsmnocache
Aug 3, 2026
Merged

db-analyser: Ability to turn off caching for --lsm#2156
jasagredo merged 3 commits into
mainfrom
mkarg/db-analyser-lsmnocache

Conversation

@mgmeier

@mgmeier mgmeier commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Description

  • ouroboros-consensus-lsm: expose LSM.DiskCachePolicy as a parameter
  • db-analyser: allow disabling the disk cache for --lsm via additional flag --lsm-no-cache

Summary

The LSM ledger DB backend previously always used LSM.newTable/LSM.openTableFromSnapshot with their default disk cache policy, so the UTxO table's disk cache behavior was hardcoded and not observable/tunable from outside the library.

This PR:

  • Threads a LSM.DiskCachePolicy through LSMArgs, Resources LSM, mkLSMArgsIO, tableFromValuesMK, and loadSnapshot, using LSM.newTableWith/LSM.openTableFromSnapshotWith variants, which allow for overriding the disk cache policy. LSM.DiskCachePolicy is now re-exported from the LSM module.
  • Adds a --lsm-no-cache switch to db-analyser, which, when combined with --lsm, sets the policy to LSM.DiskCacheNone (bypassing the OS page cache / using O_DIRECT for UTxO table reads and writes) instead of the default LSM.DiskCacheAll. This has no effect on other backends and is intended primarily for benchmarking disk I/O behavior in isolation from page-cache effects.
  • Updates the LSMArgs call sites in the state-machine and ledger-snapshot test suites to pass an explicit cache policy (DiskCacheAll, preserving existing behavior).
  • Does not create any code path for propagating some cache policy from a Node config into consensus.

Motivation

For benchmarking the LSM backend's actual disk performance (e.g. comparing read/write throughput or measuring the true cost of table operations), the OS page cache can mask I/O costs by serving repeated reads from memory. Making the disk cache policy configurable lets db-analyser runs isolate on-disk performance from cache effects.

For a full rationale see input-output-hk/ouroboros-consensus-tools#12 and the beacon/docs/METHODOLOGY.md document it adds.

@mgmeier
mgmeier marked this pull request as ready for review July 28, 2026 17:18
Comment thread changelog.d/20260728_190611_michael.karg_lsm_disk_cache_policy.md Outdated
, analysis :: AnalysisName
, confLimit :: Limit
, ldbBackend :: LedgerDBBackend
, lsmNoDiskCache :: Bool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be included in LedgerDBBackend above to only parse it if we are using lsm?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed 👍

@mgmeier
mgmeier force-pushed the mkarg/db-analyser-lsmnocache branch from 3ed9138 to 48fce84 Compare July 29, 2026 16:20
@Russoul
Russoul force-pushed the mkarg/db-analyser-lsmnocache branch 2 times, most recently from 7a5071d to e49b37b Compare July 31, 2026 20:54
mgmeier and others added 3 commits August 1, 2026 00:55
…analyser: ability to turn off caching for --lsm
Move the no-disk-cache flag into the V2LSM constructor of LedgerDBBackend
so it can only be parsed together with --lsm, instead of being a
free-standing switch accepted (and silently ignored) regardless of the
chosen backend.
@Russoul
Russoul force-pushed the mkarg/db-analyser-lsmnocache branch from e49b37b to a2a2607 Compare July 31, 2026 20:57
@jasagredo
jasagredo merged commit 3f8e035 into main Aug 3, 2026
19 checks passed
@jasagredo
jasagredo deleted the mkarg/db-analyser-lsmnocache branch August 3, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants