{
 "number": 35620,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35620",
 "title": "leveldb: move unused block-cache budget to write buffers",
 "author": "l0rinc",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-06-29T17:50:54Z",
 "updated_at": "2026-07-14T18:23:16Z",
 "age_days": 79,
 "draft": true,
 "labels": [
  "UTXO Db and Indexes",
  "Resource usage",
  "Needs rebase"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "a479f8a071a6719b5ff6f389af3c3f4c0cf40c36",
 "head_ref": "l0rinc/leveldb-block-cache-write-buffer",
 "head_repo": "l0rinc/bitcoin",
 "head_history": [],
 "additions": 5,
 "deletions": 2,
 "changed_files": 1,
 "commit_count": 2,
 "size_bucket": "S",
 "mergeable_state": "dirty",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": [
    {
     "number": 35568,
     "title": "txospenderindex: disable bloom filters to optimize disk usage",
     "author": "andrewtoth"
    }
   ]
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "fanquake",
   "sedited"
  ]
 },
 "signals": {
  "needs_rebase": true,
  "ci_failed": false,
  "mergeable_state": "dirty",
  "last_author_activity": "2026-07-02T22:16:52Z",
  "last_reviewer_activity": "2026-07-01T19:21:24Z",
  "last_reviewer": "sedited",
  "author_silent_days": 76,
  "waiting_on_author_days": 0,
  "days_since_update": 64
 },
 "refs": {
  "mentioned": [
   32375,
   34636
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 34636,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-06-10",
    "title": "node: allocate index caches proportional to usage patterns"
   },
   {
    "number": 32375,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "Stop shipping ARM32 builds for releases?"
   }
  ],
  "conflicts": [
   35568
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "**Problem:** `CDBWrapper` reserves half of each DB cache budget for LevelDB's block cache, which only helps when table-block contents are cacheable.\nOn 64-bit builds LevelDB [uses mmap reads](https://github.com/bitcoin/bitcoin/blob/3c76bd435681ee2ebaa1f407ac23736d9c3b331b/src/leveldb/util/env_posix.cc#L45-L46) and, for our uncompressed table files, [marks mmap-backed contents non-cacheable](https://github.com/bitcoin/bitcoin/blob/3c76bd435681ee2ebaa1f407ac23736d9c3b331b/src/leveldb/table/format.cc#L106).\nLevelDB [only inserts cacheable blocks](https://github.com/bitcoin/bitcoin/blob/3c76bd435681ee2ebaa1f407ac23736d9c3b331b/src/leveldb/table/table.cc#L182-L185), so the normal 64-bit path does not populate it.\n\n**Discussion:** This came up in Sipa's [leveldb-subtree#63 resource-limit notes](https://github.com/bitcoin-core/leveldb-subtree/pull/63#issuecomment-4735688019), the follow-up note on [#34636](https://github.com/bitcoin/bitcoin/pull/34636#issuecomment-4742611924), and the [IRC discussion](https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2026-06-18#1229400). The IRC thread also [suggested](https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2026-06-18#1229421) moving that budget to `write_buffer_size`, where #34636 still controls useful per-DB cache budgets; the block cache still matters on 32-bit or non-mmap fallback paths.\n\n**Fix:** Use a zero-capacity LevelDB block cache on 64-bit builds (instead of `nullptr`, which defaults to 8 MiB) and move the freed half of the DB cache budget to `write_buffer_size`, following Andrew's IRC suggestion.\nKeep the existing block-cache/write-buffer split on 32-bit builds, where mmap is disabled and the block cache can still be used.\n\n**Benchmarks:** Both commits were benchmarked with `reindex-chainstate` to height 954459 and showed no meaningful runtime change.\n\nMeasurements\n\nreindex-chainstate | 954459 blocks | dbcache 1024 | ssd-ryzen | x86_64 | AMD Ryzen 7 3700X 8-Core Processor | 16 threads | 62Gi RAM | SSD\n\n```bash\nfor DBCACHE in 1024; do \\\n    COMMITS=\"3c76bd435681ee2ebaa1f407ac23736d9c3b331b ecb530c63dab1802dc756d14180730dc7e15e15b a479f8a071a6719b5ff6f389af3c3f4c0cf40c36\"; \\\n    STOP=954459; CC=gcc; CXX=g++; \\\n    BASE_DIR=\"/mnt/my_storage\"; DATA_DIR=\"$BASE_DIR/BitcoinData\"; LOG_DIR=\"$BASE_DIR/logs\"; \\\n    (echo \"\"; for c in $COMMITS; do git fetch -q origin \"$c\" 2>/dev/null || true; git log -1 --pretty='%h %s' \"$c\" || exit 1; done) && \\\n    (echo \"\" && echo \"$(date -I) | reindex-chainstate | ${STOP} blocks | dbcache ${DBCACHE} | $(hostname) | $(uname -m) | $(lscpu | grep 'Model name' | head -1 | cut -d: -f2 | xargs) | $(nproc) threads | $(free -h | awk '/^Mem:/{print $2}') RAM | $(lsblk -no ROTA $(df --output=source $BASE_DIR | tail -1) | grep -q 1 && echo HDD || echo SSD)\"; echo \"\") && \\\n    hyperfine \\\n    --sort command \\\n    --runs 1 \\\n    --export-json \"$BASE_DIR/rdx-$(sed -E 's/([a-f0-9]{8})[a-f0-9]* ?/\\1-/g;s/-$//'<<<\"$COMMITS\")-$STOP-$DBCACHE-$CC.json\" \\\n    --parameter-list COMMIT ${COMMITS// /,} \\\n    --prepare \"killall -9 bitcoind 2>/dev/null; rm -f ./build/bin/bitcoind; git clean -fxd; git reset --hard {COMMIT} && \\\n      CC=$CC CXX=$CXX cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build bitcoind -j1 && \\\n        ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -printtoconsole=0 && sleep 20 && rm -f $DATA_DIR/debug.log && rm -rfd $DATA_DIR/indexes\" \\\n      --conclude \"killall bitcoind || true; sleep 5; \\\n        grep -q 'height=0' $DATA_DIR/debug.log && \\\n        grep -q 'Disabling script verification at block #1' $DATA_DIR/debug.log && \\\n        grep -q 'height=$STOP' $DATA_DIR/debug.log && \\\n        grep 'Bitcoin Core version' $DATA_DIR/debug.log | grep -q \\\"\\$(git rev-parse --short=12 {COMMIT})\\\" && \\\n        cp $DATA_DIR/debug.log $LOG_DIR/debug-{COMMIT}-\\$(date +%s).log\" \\\n    \"COMPILER=$CC ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -dbcache=$DBCACHE -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0\"; \\\ndone\n\n3c76bd4356 Merge bitcoin/bitcoin#35603: build: QRencode cleanups\necb530c63d db: avoid unused LevelDB block cache on 64-bit\na479f8a071 db: move unused block cache to write buffer\n\n2026-06-30 | reindex-chainstate | 954459 blocks | dbcache 1024 | ssd-ryzen | x86_64 | AMD Ryzen 7 3700X 8-Core Processor | 16 threads | 62Gi RAM | SSD\n\nBenchmark 1: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n  Time (abs \u2261):        15597.417 s               [User: 28075.099 s, System: 1965.047 s]\n\nBenchmark 2: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n  Time (abs \u2261):        15573.304 s               [User: 28109.013 s, System: 1961.319 s]\n\nBenchmark 3: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n  Time (abs \u2261):        15664.809 s               [User: 28159.343 s, System: 1962.872 s]\n\nRelative speed comparison\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n        1.01          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n```\n\nreindex-chainstate | 954459 blocks | dbcache 1024 | rpi5-16-3 | aarch64 | Cortex-A76 | 4 threads | 15Gi RAM | SSD\n\n```bash\nfor DBCACHE in 1024; do \\\n    COMMITS=\"0e95e1abdb47adbc3342a2123f9f1be43d9a4f55 69a953f70dc9a4f322a6c99d0e66acb548609e3b\"; \\\n    STOP=954459; CC=gcc; CXX=g++; \\\n    BASE_DIR=\"/mnt/my_storage\"; DATA_DIR=\"$BASE_DIR/BitcoinData\"; LOG_DIR=\"$BASE_DIR/logs\"; \\\n    (echo \"\"; for c in $COMMITS; do git fetch -q origin \"$c\" 2>/dev/null || true; git log -1 --pretty='%h %s' \"$c\" || exit 1; done) && \\\n    (echo \"\" && echo \"$(date -I) | reindex-chainstate | ${STOP} blocks | dbcache ${DBCACHE} | $(hostname) | $(uname -m) | $(lscpu | grep 'Model name' | head -1 | cut -d: -f2 | xargs) | $(nproc) threads | $(free -h | awk '/^Mem:/{print $2}') RAM | $(lsblk -no ROTA $(df --output=source $BASE_DIR | tail -1) | grep -q 1 && echo HDD || echo SSD)\"; echo \"\") && \\\n    hyperfine \\\n    --sort command \\\n    --runs 1 \\\n    --export-json \"$BASE_DIR/rdx-$(sed -E 's/([a-f0-9]{8})[a-f0-9]* ?/\\1-/g;s/-$//'<<<\"$COMMITS\")-$STOP-$DBCACHE-$CC.json\" \\\n    --parameter-list COMMIT ${COMMITS// /,} \\\n    --prepare \"killall -9 bitcoind 2>/dev/null; rm -f ./build/bin/bitcoind; git clean -fxd; git reset --hard {COMMIT} && \\\n      CC=$CC CXX=$CXX cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build bitcoind -j1 && \\\n        ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -printtoconsole=0 && sleep 20 && rm -f $DATA_DIR/debug.log && rm -rfd $DATA_DIR/indexes\" \\\n      --conclude \"killall bitcoind || true; sleep 5; \\\n        grep -q 'height=0' $DATA_DIR/debug.log && \\\n        grep -q 'Disabling script verification at block #1' $DATA_DIR/debug.log && \\\n        grep -q 'height=$STOP' $DATA_DIR/debug.log && \\\n        grep 'Bitcoin Core version' $DATA_DIR/debug.log | grep -q \\\"\\$(git rev-parse --short=12 {COMMIT})\\\" && \\\n        cp $DATA_DIR/debug.log $LOG_DIR/debug-{COMMIT}-\\$(date +%s).log\" \\\n    \"COMPILER=$CC ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -dbcache=$DBCACHE -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0\"; \\\ndone\n\n0e95e1abdb Merge bitcoin/bitcoin#35437: migrate: Handle HD chains that have identical seeds but different IDs\n69a953f70d db: disable block cache on 64-bit\n\n2026-06-25 | reindex-chainstate | 954459 blocks | dbcache 1024 | rpi5-16-3 | aarch64 | Cortex-A76 | 4 threads | 15Gi RAM | SSD\n\nBenchmark 1: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 0e95e1abdb47adbc3342a2123f9f1be43d9a4f55)\n  Time (abs \u2261):        42596.443 s               [User: 62966.911 s, System: 3139.874 s]\n\nBenchmark 2: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 69a953f70dc9a4f322a6c99d0e66acb548609e3b)\n  Time (abs \u2261):        41961.797 s               [User: 61711.896 s, System: 3097.761 s]\n\nRelative speed comparison\n        1.02          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 0e95e1abdb47adbc3342a2123f9f1be43d9a4f55)\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 69a953f70dc9a4f322a6c99d0e66acb548609e3b)\n```\n\nreindex-chainstate | 954459 blocks | dbcache 1024/10000 | i9-ssd | x86_64 | Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz | 16 threads | 62Gi RAM | SSD\n\n```bash\nfor DBCACHE in 1024 10000; do \\\n    COMMITS=\"3c76bd435681ee2ebaa1f407ac23736d9c3b331b ecb530c63dab1802dc756d14180730dc7e15e15b a479f8a071a6719b5ff6f389af3c3f4c0cf40c36\"; \\\n    STOP=954459; CC=gcc; CXX=g++; \\\n    BASE_DIR=\"/mnt/my_storage\"; DATA_DIR=\"$BASE_DIR/BitcoinData\"; LOG_DIR=\"$BASE_DIR/logs\"; \\\n    (echo \"\"; for c in $COMMITS; do git fetch -q origin \"$c\" 2>/dev/null || true; git log -1 --pretty='%h %s' \"$c\" || exit 1; done) && \\\n    (echo \"\" && echo \"$(date -I) | reindex-chainstate | ${STOP} blocks | dbcache ${DBCACHE} | $(hostname) | $(uname -m) | $(lscpu | grep 'Model name' | head -1 | cut -d: -f2 | xargs) | $(nproc) threads | $(free -h | awk '/^Mem:/{print $2}') RAM | $(lsblk -no ROTA $(df --output=source $BASE_DIR | tail -1) | grep -q 1 && echo HDD || echo SSD)\"; echo \"\") && \\\n    hyperfine \\\n    --sort command \\\n    --runs 1 \\\n    --export-json \"$BASE_DIR/rdx-$(sed -E 's/([a-f0-9]{8})[a-f0-9]* ?/\\1-/g;s/-$//'<<<\"$COMMITS\")-$STOP-$DBCACHE-$CC.json\" \\\n    --parameter-list COMMIT ${COMMITS// /,} \\\n    --prepare \"killall -9 bitcoind 2>/dev/null; rm -f ./build/bin/bitcoind; git clean -fxd; git reset --hard {COMMIT} && \\\n      CC=$CC CXX=$CXX cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build bitcoind -j1 && \\\n        ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -printtoconsole=0 && sleep 20 && rm -f $DATA_DIR/debug.log && rm -rfd $DATA_DIR/indexes\" \\\n      --conclude \"killall bitcoind || true; sleep 5; \\\n        grep -q 'height=0' $DATA_DIR/debug.log && \\\n        grep -q 'Disabling script verification at block #1' $DATA_DIR/debug.log && \\\n        grep -q 'height=$STOP' $DATA_DIR/debug.log && \\\n        grep 'Bitcoin Core version' $DATA_DIR/debug.log | grep -q \\\"\\$(git rev-parse --short=12 {COMMIT})\\\" && \\\n        cp $DATA_DIR/debug.log $LOG_DIR/debug-{COMMIT}-\\$(date +%s).log\" \\\n    \"COMPILER=$CC ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -dbcache=$DBCACHE -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0\"; \\\ndone\n\n3c76bd4356 Merge bitcoin/bitcoin#35603: build: QRencode cleanups\necb530c63d db: avoid unused LevelDB block cache on 64-bit\na479f8a071 db: move unused block cache to write buffer\n\n2026-06-29 | reindex-chainstate | 954459 blocks | dbcache 1024 | i9-ssd | x86_64 | Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz | 16 threads | 62Gi RAM | SSD\n\nBenchmark 1: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n  Time (abs \u2261):        20098.397 s               [User: 34707.701 s, System: 1066.261 s]\n\nBenchmark 2: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n  Time (abs \u2261):        19834.950 s               [User: 34606.900 s, System: 1092.158 s]\n\nBenchmark 3: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n  Time (abs \u2261):        19844.219 s               [User: 34655.128 s, System: 1080.368 s]\n\nRelative speed comparison\n        1.01          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n\n3c76bd4356 Merge bitcoin/bitcoin#35603: build: QRencode cleanups\necb530c63d db: avoid unused LevelDB block cache on 64-bit\na479f8a071 db: move unused block cache to write buffer\n\n2026-06-30 | reindex-chainstate | 954459 blocks | dbcache 10000 | i9-ssd | x86_64 | Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz | 16 threads | 62Gi RAM | SSD\n\nBenchmark 1: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n  Time (abs \u2261):        17918.808 s               [User: 28933.064 s, System: 695.944 s]\n\nBenchmark 2: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n  Time (abs \u2261):        18161.775 s               [User: 29001.097 s, System: 683.110 s]\n\nBenchmark 3: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n  Time (abs \u2261):        18055.186 s               [User: 28973.671 s, System: 691.071 s]\n\nRelative speed comparison\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n        1.01          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n        1.01          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=10000 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n```",
 "commits": [
  {
   "sha": "ecb530c63dab1802dc756d14180730dc7e15e15b",
   "date": "2026-06-29T17:44:35Z",
   "message": "db: avoid unused LevelDB block cache on 64-bit\n\nWe store LevelDB table files uncompressed. On 64-bit builds, LevelDB normally serves table blocks directly from mmap-backed files and marks those blocks non-cachable, leaving the configured block cache empty in the common read path.\n\nUse a zero-capacity block cache on 64-bit builds. Keep the existing cache on 32-bit builds, where mmap is disabled. This avoids reserving cache budget for a cache that is normally unused on 64-bit systems and may save a small amount of cache bookkeeping memory.\n\nCo-authored-by: Pieter Wuille <pieter@wuille.net>"
  },
  {
   "sha": "a479f8a071a6719b5ff6f389af3c3f4c0cf40c36",
   "date": "2026-06-29T17:45:03Z",
   "message": "db: move unused block cache to write buffer\n\nOn 64-bit builds the block-cache share is normally unused because mmap-backed uncompressed table blocks bypass it.\n\nMove that half of the DB cache budget to LevelDB's write buffer on 64-bit builds. Keep 32-bit unchanged, where mmap is disabled and the block cache can still be used. Because LevelDB may keep two write buffers, this preserves the existing total DB-cache accounting: 64-bit can now use up to the whole budget for write buffers. 32-bit still keeps half for block cache and up to half for write buffers.\n\nCo-authored-by: Andrew Toth <andrewstoth@gmail.com>"
  }
 ],
 "timeline": [
  {
   "t": "2026-07-01T08:31:39Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "CONTRIBUTOR",
   "text": "Is the extra case for 32bit systems really worthwhile? Seems like a lot of infrastructure for something that only pays off on a single architecture. AFAICT for the indexes it seems sufficient to just allocate the default 8MiB of write buffer."
  },
  {
   "t": "2026-07-01T08:34:46Z",
   "kind": "comment",
   "who": "fanquake",
   "assoc": "MEMBER",
   "text": "#32375 also relevant. Not sure how much new code we should be adding for 32bit systems."
  },
  {
   "t": "2026-07-01T17:45:34Z",
   "kind": "comment",
   "who": "l0rinc",
   "assoc": "CONTRIBUTOR",
   "text": "[quoted text omitted]\n\nFully agree, but 32 bit builds don't have mmaped builds so they still need the cache.\nWould it be cleaner if I just disabled it regardless of the architecture?"
  },
  {
   "t": "2026-07-01T19:21:24Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "CONTRIBUTOR",
   "text": "[quoted text omitted]\n\nI think I would prefer if it, and with it most of the cache allocation code, were removed. Do you see any benefit to giving the indexes more than the default amount of write buffer?"
  },
  {
   "t": "2026-07-01T22:48:57Z",
   "kind": "comment",
   "who": "l0rinc",
   "assoc": "CONTRIBUTOR",
   "text": "[quoted text omitted]\n\nThat's a bigger change, but it fits here, and the end result will be a lot cleaner.\nI'll push it here and see what other reviewers think.\n\n[quoted text omitted]\nI'm still running the tests on HDD, will draft the change until they finish. Will also need to recheck every index after these changes."
  },
  {
   "t": "2026-07-02T22:16:52Z",
   "kind": "comment",
   "who": "l0rinc",
   "assoc": "CONTRIBUTOR",
   "text": "I did a few more measurements on HDD which are giving me mixed results so far:\n\nreindex-chainstate | 954459 blocks | dbcache 1024 | i7-hdd | x86_64 | Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz | 8 threads | 62Gi RAM | HDD\n\n```bash\nfor DBCACHE in 1024; do \\\n    COMMITS=\"3c76bd435681ee2ebaa1f407ac23736d9c3b331b ecb530c63dab1802dc756d14180730dc7e15e15b a479f8a071a6719b5ff6f389af3c3f4c0cf40c36\"; \\\n    STOP=954459; CC=gcc; CXX=g++; \\\n    BASE_DIR=\"/mnt/my_storage\"; DATA_DIR=\"$BASE_DIR/BitcoinData\"; LOG_DIR=\"$BASE_DIR/logs\"; \\\n    (echo \"\"; for c in $COMMITS; do git fetch -q origin \"$c\" 2>/dev/null || true; git log -1 --pretty='%h %s' \"$c\" || exit 1; done) && \\\n    (echo \"\" && echo \"$(date -I) | reindex-chainstate | ${STOP} blocks | dbcache ${DBCACHE} | $(hostname) | $(uname -m) | $(lscpu | grep 'Model name' | head -1 | cut -d: -f2 | xargs) | $(nproc) threads | $(free -h | awk '/^Mem:/{print $2}') RAM | $(lsblk -no ROTA $(df --output=source $BASE_DIR | tail -1) | grep -q 1 && echo HDD || echo SSD)\"; echo \"\") && \\\n    hyperfine \\\n    --sort command \\\n    --runs 2 \\\n    --export-json \"$BASE_DIR/rdx-$(sed -E 's/([a-f0-9]{8})[a-f0-9]* ?/\\1-/g;s/-$//'<<<\"$COMMITS\")-$STOP-$DBCACHE-$CC.json\" \\\n    --parameter-list COMMIT ${COMMITS// /,} \\\n    --prepare \"killall -9 bitcoind 2>/dev/null; rm -f ./build/bin/bitcoind; git clean -fxd; git reset --hard {COMMIT} && \\\n      CC=$CC CXX=$CXX cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build bitcoind -j1 && \\\n        ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -printtoconsole=0 && sleep 20 && rm -f $DATA_DIR/debug.log && rm -rfd $DATA_DIR/indexes\" \\\n      --conclude \"killall bitcoind || true; sleep 5; \\\n        grep -q 'height=0' $DATA_DIR/debug.log && \\\n        grep -q 'Disabling script verification at block #1' $DATA_DIR/debug.log && \\\n        grep -q 'height=$STOP' $DATA_DIR/debug.log && \\\n        grep 'Bitcoin Core version' $DATA_DIR/debug.log | grep -q \\\"\\$(git rev-parse --short=12 {COMMIT})\\\" && \\\n        cp $DATA_DIR/debug.log $LOG_DIR/debug-{COMMIT}-\\$(date +%s).log\" \\\n    \"COMPILER=$CC ./build/bin/bitcoind -datadir=$DATA_DIR -stopatheight=$STOP -dbcache=$DBCACHE -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0\"; \\\ndone\n\n3c76bd4356 Merge bitcoin/bitcoin#35603: build: QRencode cleanups\necb530c63d db: avoid unused LevelDB block cache on 64-bit\na479f8a071 db: move unused block cache to write buffer\n\n2026-06-30 | reindex-chainstate | 954459 blocks | dbcache 1024 | i7-hdd | x86_64 | Intel(R) Core(TM) i7-7700 CPU @ 3.60GHz | 8 threads | 62Gi RAM | HDD\n\nBenchmark 1: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n  Time (mean \u00b1 \u03c3):     30825.620 s \u00b1 217.655 s    [User: 36503.667 s, System: 1358.245 s]\n  Range (min \u2026 max):   30671.715 s \u2026 30979.525 s    2 runs\n\nBenchmark 2: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n  Time (mean \u00b1 \u03c3):     31831.237 s \u00b1 370.410 s    [User: 36560.906 s, System: 1349.523 s]\n  Range (min \u2026 max):   31569.318 s \u2026 32093.156 s    2 runs\n\nBenchmark 3: COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n  Time (mean \u00b1 \u03c3):     31335.954 s \u00b1 256.770 s    [User: 36564.447 s, System: 1341.683 s]\n  Range (min \u2026 max):   31154.391 s \u2026 31517.518 s    2 runs\n\nRelative speed comparison\n        1.00          COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = 3c76bd435681ee2ebaa1f407ac23736d9c3b331b)\n        1.03 \u00b1  0.01  COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = ecb530c63dab1802dc756d14180730dc7e15e15b)\n        1.02 \u00b1  0.01  COMPILER=gcc ./build/bin/bitcoind -datadir=/mnt/my_storage/BitcoinData -stopatheight=954459 -dbcache=1024 -reindex-chainstate -blocksonly -disablewallet -connect=0 -listen=0 -dnsseed=0 -printtoconsole=0 (COMMIT = a479f8a071a6719b5ff6f389af3c3f4c0cf40c36)\n```\n\nI will need to investigate if there's any path that's still affected by the block cache or the write buffers - leaving as draft in the meantime."
  }
 ],
 "labels_log": [
  {
   "t": "2026-07-08T14:17:13Z",
   "action": "labeled",
   "label": "UTXO Db and Indexes",
   "who": "willcl-ark"
  },
  {
   "t": "2026-07-08T14:17:13Z",
   "action": "labeled",
   "label": "Resource usage",
   "who": "willcl-ark"
  },
  {
   "t": "2026-07-12T11:24:10Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-06-30T17:12:21Z",
   "kind": "ready_for_review",
   "who": "l0rinc"
  },
  {
   "t": "2026-07-01T22:49:02Z",
   "kind": "convert_to_draft",
   "who": "l0rinc"
  }
 ],
 "text_chars": 23936,
 "text_tokens_estimate": 5984,
 "changed_paths": [
  "src/dbwrapper.cpp"
 ],
 "files": [
  {
   "path": "src/dbwrapper.cpp",
   "add": 5,
   "del": 2
  }
 ],
 "test_lines": 0,
 "git": {
  "head": "a479f8a071a6719b5ff6f389af3c3f4c0cf40c36",
  "head_matches_backup": true,
  "base": "3c76bd435681ee2ebaa1f407ac23736d9c3b331b",
  "commits": [
   {
    "sha": "ecb530c63d",
    "subject": "db: avoid unused LevelDB block cache on 64-bit",
    "files": 1,
    "add": 3,
    "del": 1
   },
   {
    "sha": "a479f8a071",
    "subject": "db: move unused block cache to write buffer",
    "files": 1,
    "add": 2,
    "del": 1
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "dc98de6ccf8f3e61",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}