doc: clarify swapping impact on IBD performance #34606

pull l0rinc wants to merge 1 commits into bitcoin:master from l0rinc:l0rinc/common-warn-high-swap-usage changing 1 files +9 −0
  1. l0rinc commented at 1:24 pm on February 17, 2026: contributor

    Problem

    Sustained heavy swapping can grind execution to a halt, but today users get no direct warning from the node when this happens, and this caveat is not documented.

    Fix

    We can’t easily detect heavy swap pressure in a reliable, cross-platform way, but we can document what swapping is and why it can severely degrade IBD performance.


    Note: An earlier version of this PR attempted to detect and warn on heavy swapping (Linux-only), but it was changed to documentation based on review feedback.

  2. DrahtBot commented at 1:24 pm on February 17, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    No conflicts as of last run.

  3. andrewtoth commented at 12:53 pm on February 18, 2026: contributor
    Instead of warning how about just flushing the dbcache? a la https://github.com/bitcoin/bitcoin/pull/19873
  4. l0rinc commented at 1:20 pm on February 18, 2026: contributor

    Instead of warning how about just flushing the dbcache?

    We could do both, thanks for the idea. Anything else?

  5. andrewtoth commented at 1:22 pm on February 18, 2026: contributor

    Anything else?

    dbcache is the main memory hog. We could also reduce mempool space on the fly and have bitcoind evict low paying txs. Not sure that’s feasible in the current code though. Dropping peers would be next I think.

  6. l0rinc commented at 1:35 pm on February 18, 2026: contributor
    As a first step, we should at least warn without taking any action, as there are countless ways to resolve it, but they all depend on the user realizing that there’s a problem.
  7. fanquake commented at 1:38 pm on February 18, 2026: member

    but they all depend on the user realizing that there’s a problem.

    I don’t think a one-time log in debug.log is going to solve that problem though (especially not during any period of large logging activity)?

  8. l0rinc commented at 1:40 pm on February 18, 2026: contributor
    It could help us at least when they’re sending us the logs like in https://github.com/bitcoin/bitcoin/issues/34601
  9. andrewtoth commented at 2:41 pm on February 18, 2026: contributor
    I think as a first step flush the cache. That would probably fix the issue in almost all cases.
  10. l0rinc commented at 6:08 pm on February 18, 2026: contributor

    I think as a first step flush the cache. That would probably fix the issue in almost all cases.

    In the reproducer above, that’s not the case, but in reality I would expect that, yes.

    Currently, this is only triggered a single time, so that likely would not be enough to “fix the issue in almost all cases”. And flushing every time there’s swapping pressure could cause more problems if they end up triggering or worsening each other somehow.

  11. luke-jr commented at 10:27 pm on February 18, 2026: member

    Probably want to flush before we get into swap territory, so that’s independent from this PR IMO.

    But also, using swap does not mean the system is struggling. Linux, at least, can move inactive pages into swap just to improve I/O caching, and I wouldn’t be surprised if reindexing triggered this behaviour.

  12. ajtowns commented at 9:36 am on March 2, 2026: contributor
    This seems like a feature for your OS or VPS provider to offer, not every application? Better to just install monit or use the provider’s cPanel or similar.
  13. l0rinc commented at 10:13 am on March 2, 2026: contributor
    If we detect swapping ourselves, we can react to it - as mentioned by other reviewers. We can also just document that users should monitor swapping themselves; that’s definitely simpler for us, but I doubt it will be effective. What I had in mind is to have the simplest heuristic to help users who are complaining of IBD taking months.
  14. ajtowns commented at 11:03 am on March 2, 2026: contributor

    What I had in mind is to have the simplest heuristic to help users who are complaining of IBD taking months.

    That seems like something much better solved by documentation (“minimum node requirements”). Swapping isn’t, in general, something we can react to – it can be normal/desirable behaviour (some other process on the system has loaded 1GB of information into memory that it isn’t accessing frequently, so 700MB of it swapped out, eg).

  15. doc: explain swapping in `reduce-memory.md`
    Document what swapping is and why it can severely degrade `bitcoind` performance.
    a61907e5d9
  16. l0rinc renamed this:
    [RFC] common: warn on high swap usage
    doc: explain how to address high swap pressure
    on Mar 2, 2026
  17. DrahtBot added the label Docs on Mar 2, 2026
  18. l0rinc renamed this:
    doc: explain how to address high swap pressure
    doc: explain swapping in `reduce-memory.md`
    on Mar 2, 2026
  19. l0rinc renamed this:
    doc: explain swapping in `reduce-memory.md`
    doc: clarify swapping impact on IBD performance
    on Mar 2, 2026
  20. l0rinc force-pushed on Mar 2, 2026
  21. l0rinc marked this as ready for review on Mar 2, 2026
  22. l0rinc commented at 12:28 pm on March 2, 2026: contributor
    Thank you for the feedback, changed the PR to just document thrashing instead of attempting to detect it.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-04 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me