doc: Speed up functional test runs using ramdisk #24707

pull willcl-ark wants to merge 1 commits into bitcoin:master from willcl-ark:tmpfs-test changing 1 files +28 −0
  1. willcl-ark commented at 1:24 PM on March 29, 2022: member

    Using a ramdisk for the functional tests can give noticable speedups for developers and reviewers.

    Local testing with an 8GB ramdisk saw a full test run using test/functional/test_runner.py --jobs=100 --cachedir=/mnt/tmp/cache --tmpdir=/mnt/tmp reduced from ~280 seconds to ~99 seconds.

    Possible bikeshedding opportunity to be had over whether this might best fit into doc/productivity.md, but IMO more people will likely see it (and it will therefore be more useful) if it is here.

    It seems best to select tmpfs over ramfs as ramfs can grow dynamically (good) but cannot be limited in size and might cause the system to hang if you run out of ram (bad), whereas tmpfs is size-limited and will overflow into swap.

  2. fanquake added the label Docs on Mar 29, 2022
  3. laanwj commented at 2:49 PM on March 29, 2022: member

    Concept ACK, I've also noticed considerable speedups with tmpfs as temp dir for the functional tests. Even on systems with fast SSD.

    Are you sure about the 8GB disk usage though? Edit: oh, with --no-cleanup, right; normally only the running tests take up space so the peak is much lower.

  4. willcl-ark commented at 3:26 PM on March 29, 2022: member

    Concept ACK, I've also noticed considerable speedups with tmpfs as temp dir for the functional tests. Even on systems with fast SSD.

    Are you sure about the 8GB disk usage though? Edit: oh, with --no-cleanup, right; normally only the running tests take up space so the peak is much lower.

    Right. Just checked without --no-cleanup and the max I saw the directory increase to was 3.5GB. So I think the 3.5GB recommendation in the commit itself should be pretty solid :)

  5. in test/README.md:123 in 55ec083c8b outdated
     118 | +sudo mkdir -p /mnt/tmp
     119 | +sudo mount -t tmpfs -o size=4g tmpfs /mnt/tmp/
     120 | +```
     121 | +
     122 | +Configure the size of the ramdisk using the `size=` option.
     123 | +A full test suite run with `--no-cleanup` takes slightly over 8GB of disk space in total, so configuring above this seems unnecessary, however even smaller ramdisks have a great impact on test suite speed.
    


    josibake commented at 4:11 PM on March 29, 2022:

    This should be --nocleanup

    A full test suite run with `--nocleanup` takes slightly over 8GB of disk space in total, so configuring above this seems unnecessary, however even smaller ramdisks have a great impact on test suite speed.
    

    willcl-ark commented at 9:41 PM on March 29, 2022:

    Updated (removed) as kind of irrelevant to the normal usage.

  6. josibake commented at 4:12 PM on March 29, 2022: member

    Concept ACK

    Been using this myself and usually see around a 2x speedup. I also ran with 4g of space reserved without issues. Ran it with --nocleanup and observed the tmp directory was 9.5g when finished

  7. pk-b2 commented at 8:32 PM on March 29, 2022: none

    Concept ACK

    Same applies to macos in case we want to add this as well

    diskutil erasevolume HFS+ 'ramdisk' `hdiutil attach -nomount ram://8388608`
    test/functional/test_runner.py  --cachedir=/Volumes/ramdisk/cache --tmpdir=/Volumes/ramdisk
    
  8. willcl-ark force-pushed on Mar 29, 2022
  9. doc: Speed up functional test runs using ramdisk
    Using a ramdisk for the functional tests can give worthwhile speed-ups
    for developers and reviewers.
    
    Add notes to test/README.md on how to setup, use and erase a ramdisk on
    Linux.
    17648493df
  10. willcl-ark force-pushed on Mar 29, 2022
  11. willcl-ark commented at 8:15 AM on March 30, 2022: member

    Thoughts on adding MacOS-specific commands too? I feel that might make it more cluttered, but we do have Linux and MacOS commands in other areas of the guides...

  12. josibake commented at 11:49 AM on March 30, 2022: member

    Thoughts on adding MacOS-specific commands too? I feel that might make it more cluttered, but we do have Linux and MacOS commands in other areas of the guides...

    in general, i think it's fine to add something like "The following commands are for Linux, but you can accomplish the same thing on MacOS/Windows by using the appropriate commands for your system"

  13. theStack commented at 3:32 PM on March 30, 2022: member

    Concept ACK

  14. jamesob commented at 3:39 PM on March 30, 2022: member
  15. brunoerg commented at 4:43 PM on March 30, 2022: member

    Concept ACK

  16. MarcoFalke merged this on Mar 31, 2022
  17. MarcoFalke closed this on Mar 31, 2022

  18. sidhujag referenced this in commit 931f26aac1 on Apr 3, 2022
  19. DrahtBot locked this on Mar 31, 2023

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-04-22 18:13 UTC

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