Subject: Re: [PATCH v3 6/6] core.fsyncobjectfiles: enable batch mode for testing

From: Junio C Hamano <[email-masked]>
Date: Wed, 15 Sep 2021 09:21:19 -0700

"Neeraj Singh via GitGitGadget" <[email-masked]> writes:

> From: Neeraj Singh <[email-masked]>
>
> Signed-off-by: Neeraj Singh <[email-masked]>
> ---
>  environment.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/environment.c b/environment.c
> index 3e23eafff80..27d5e11267e 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -43,7 +43,7 @@ const char *git_hooks_path;
>  int zlib_compression_level = Z_BEST_SPEED;
>  int core_compression_level;
>  int pack_compression_level = Z_DEFAULT_COMPRESSION;
> -enum FSYNC_OBJECT_FILES_MODE fsync_object_files;
> +enum FSYNC_OBJECT_FILES_MODE fsync_object_files = FSYNC_OBJECT_FILES_BATCH;
>  size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
>  size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
>  size_t delta_base_cache_limit = 96 * 1024 * 1024;

Despite what the title of the change claims, this is not "enable for
testing", but "enable for everybody even in production", isn't it?

I'd prefer we do not do this, certainly not for "testing".

If setting the variable to "batch" were meant to eventually improve
performance for all different flavours of workload, I do not think
we would mind if we set it to "batch" for those who opt into the
"experimental" set of features by setting the feature.experimental
configuration variable to true.  And after a few development cycles
when the feature proves to be useful for everybody, we may want to
apply this patch under a justification that is different from "for
testing".

On the other hand, if this is meant to help 85% of people while
degrading the remainder of workflow, I do not think we would want to
see this change without a warning that says something along the
lines of "under rare circumstances (e.g. if you employ such and such
workflow), the new default value used for the core.fsyncObjectFiles
configuration variable will hurt performance."

Since this is about answering the question "between performance and
crash resilience, where do you as an end user strike the balance for
your needs?", I do not think it falls into either of the above two
categories.  

The only plausible justification I can think of to apply a "we
default to 'batch' for everybody" patch with is something like:

    Now with the 'batch' setting for core.fsyncObjectFiles, unlike
    'true' that paid very high overhead, the overhead to ensure our
    writes hit the disk platters has so greatly been reduced that it
    hurts the performance only negligibly.  Let's switch the default
    from the unsafe value of 'false' to safer and performant value
    of 'batch'.

I however doubt with the current round of patches, we are there yet.