Re: [PATCH] fetch-pack: grow stateless RPC windows exponentially
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Jul 18, 2016, 21:05 UTC
- Message-ID
- <CAGf8dgJWMBbU1rbU1hTOjX9d-b-ocmYs-td9kpQ=skQFM7XcSA@mail.gmail.com>
- In-Reply-To
- <xmqqoa5uiumu.fsf@gitster.mtv.corp.google.com>
On Mon, Jul 18, 2016 at 1:00 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 68 quoted lines
> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> You have full control of the growth function. So how about aggressive
>> growth until 1024*10?
>>
>> That is:
>>
>> Current git:
>> n < 1024: aggressive exponential
>> 16, 32, 64, 128, 256, 512, 1024
>> 1024 <= n: linear
>> 2048, 3072, 4096, 5120, ...
>>
>> Initial proposal:
>> n < 1024: aggressive exponential
>> 16, 32, 64, 128, 256, 512, 1024
>> 1024 <= n < 10240: linear
>> 2048, 307, 4096, 5120, ...
>> 10240 <= n: conservative exponential
>> 11264, 12390, ...
>>
>> New proposal:
>> n < 10240: aggressive exponential
>> 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384
>> 10240 <= n: conservative exponential
>> 18022, 19824, ...
>>
>> That way, on one hand it would still never use a smaller window than
>> today and on the other hand the heuristic would be easier to
>> understand (only decelarating, instead of decelarating and then
>> accelerating again).
>
> That sounds more explainable (I do not know if that is a growth
> curve that gives us better results, though).
>
> So, the result would look something like this, perhaps?
>
> fetch-pack.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/fetch-pack.c b/fetch-pack.c
> index 3c5dfc4..97fe5f7 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -264,12 +264,17 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused)
>
> static int next_flush(struct fetch_pack_args *args, int count)
> {
> - int flush_limit = args->stateless_rpc ? LARGE_FLUSH : PIPESAFE_FLUSH;
> -
> - if (count < flush_limit)
> - count <<= 1;
> - else
> - count += flush_limit;
> + if (args->stateless_rpc) {
> + if (count < LARGE_FLUSH * 10)
> + count <<= 1;
> + else
> + count = count * 11 / 10;
> + } else {
> + if (count < PIPESAFE_FLUSH)
> + count <<= 1;
> + else
> + count += PIPESAFE_FLUSH;
> + }
> return count;
> }
>Using aggressive growth until 1024*10 seems like a good idea to me, and it would look like that patch. (I would probably redefine LARGE_FLUSH to be 10 times its current value instead of multiplying it by 10, since it is not used anywhere else.)