git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] tests: disable fsync everywhere

From
Jeff King <peff@peff.net>
Date
Oct 29, 2021, 20:34 UTC
Message-ID
<YXxa3i3gXsutG4Cx@coredump.intra.peff.net>
In-Reply-To
<20211029001552.GA29647@dcvr>
On Fri, Oct 29, 2021 at 12:15:52AM +0000, Eric Wong wrote:
Show 14 quoted lines
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index a291a5d4a2..21f5fab999 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -489,6 +489,13 @@ then
>  	export GIT_PERL_FATAL_WARNINGS
>  fi
>  
> +case $GIT_TEST_FSYNC in
> +'')
> +	GIT_TEST_FSYNC=0
> +	export GIT_TEST_FSYNC
> +	;;
> +esac

I don't really have a problem with doing this by default, as it might help and shouldn't hurt. But I didn't find it actually changed much for me. Here are timings running the test suite on my machine:

  Benchmark 1: GIT_TEST_FSYNC=1 make
    Time (mean ± σ):     60.973 s ±  0.158 s    [User: 575.914 s, System: 333.243 s]
    Range (min … max):   60.731 s … 61.228 s    10 runs
  Benchmark 2: GIT_TEST_FSYNC=0 make
    Time (mean ± σ):     59.800 s ±  0.094 s    [User: 575.151 s, System: 337.111 s]
    Range (min … max):   59.643 s … 59.996 s    10 runs
  Benchmark 3: GIT_TEST_FSYNC=1 make GIT_TEST_OPTS=--root=/var/ram
    Time (mean ± σ):     56.966 s ±  0.066 s    [User: 572.353 s, System: 300.808 s]
    Range (min … max):   56.874 s … 57.063 s    10 runs
  Summary
    'GIT_TEST_FSYNC=1 make GIT_TEST_OPTS=--root=/var/ram' ran
      1.05 ± 0.00 times faster than 'GIT_TEST_FSYNC=0 make'
      1.07 ± 0.00 times faster than 'GIT_TEST_FSYNC=1 make'

So using an actual ram disk provided a much bigger edge for me than just disabling fsync. This may be because the system is using a decent SSD for its actual disk. But it may also be because I'm running 32 tests simultaneously. So fsync introducing latency in tests isn't a big deal; the bottleneck is CPU and there's always another script ready to run. Though it is also interesting that the system CPU time is so much lower in the tmpfs case.

Again, not really an objection, but I don't think this replaces the "you're better off running the test suite on a RAM disk" wisdom.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 17 in “allow disabling fsync everywhere”
  1. allow disabling fsync everywhereEric Wong, Oct 28, 2021
  2. Eric SunshineOct 28, 2021
  3. Jeff KingOct 28, 2021
  4. Eric WongOct 28, 2021
  5. Junio C HamanoOct 28, 2021
  6. tests: disable fsync everywhereEric Wong, Oct 29, 2021
  7. Junio C HamanoOct 29, 2021
  8. Eric WongOct 29, 2021
  9. Junio C HamanoOct 29, 2021
  10. Junio C HamanoOct 29, 2021
  11. Eric WongOct 29, 2021
  12. Junio C HamanoOct 29, 2021
  13. Jeff KingOct 29, 2021
  14. Junio C HamanoOct 29, 2021
  15. brian m. carlsonOct 28, 2021
  16. Ævar Arnfjörð BjarmasonOct 29, 2021
  17. Eric WongOct 30, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.