From: Stefan Beller <sbeller@google.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Jonathan Nieder <jrnieder@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] fetch-pack: grow stateless RPC windows exponentially
Date: Tue, 19 Jul 2016 09:46:10 -0700 [thread overview]
Message-ID: <CAGZ79kY+2PYx9oz9tvi0zG-oE6qS-Za7D3ocY1XtqcSsDchz0Q@mail.gmail.com> (raw)
In-Reply-To: <1468880498-30235-1-git-send-email-jonathantanmy@google.com>
On Mon, Jul 18, 2016 at 3:21 PM, Jonathan Tan <jonathantanmy@google.com> wrote:
> When updating large repositories, the LARGE_FLUSH limit (that is, the
> limit at which the window growth strategy switches from exponential to
> linear) is reached quite quickly. Use a conservative exponential growth
> strategy when that limit is reached instead (and increase LARGE_FLUSH so
> that there is no regression in window size).
Care to elaborate on why you choose 11/10 as growth factor?
(As someone who has a tick in micro optimizing:
9/8 is roughly the same exponent, but the division
by 8 is easier as it is just a shift by 3. Similar 17/16)
I guess one design criterion was 10 being a round number?
Does it make sense to experiment with the factor at all?
Digging into that, LARGE_FLUSH originates from 6afca450c3f,
(2011-03-20, fetch-pack: progressively use larger handshake windows),
and before we only had a linear growth.
So I guess what I do not understand is why we need to slow down the
exponential growth at all?
Thanks,
Stefan
>
> This optimization is only applied during stateless RPCs to avoid the
> issue raised and fixed in commit
> 44d8dc54e73e8010c4bdf57a422fc8d5ce709029.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> fetch-pack.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/fetch-pack.c b/fetch-pack.c
> index b501d5c..85e77af 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -243,16 +243,21 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused)
>
> #define INITIAL_FLUSH 16
> #define PIPESAFE_FLUSH 32
> -#define LARGE_FLUSH 1024
> +#define LARGE_FLUSH 16384
>
> 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)
> + count <<= 1;
> + else
> + count = count * 11 / 10;
> + } else {
> + if (count < PIPESAFE_FLUSH)
> + count <<= 1;
> + else
> + count += PIPESAFE_FLUSH;
> + }
> return count;
> }
>
> --
> 2.8.0.rc3.226.g39d4020
>
next prev parent reply other threads:[~2016-07-19 16:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 18:36 [PATCH] fetch-pack: grow stateless RPC windows exponentially Jonathan Tan
2016-07-18 18:55 ` Jonathan Nieder
2016-07-18 19:10 ` Junio C Hamano
2016-07-18 19:16 ` Jonathan Tan
2016-07-18 19:31 ` Jonathan Nieder
2016-07-18 20:00 ` Junio C Hamano
2016-07-18 21:05 ` Jonathan Tan
2016-07-18 21:36 ` Junio C Hamano
2016-07-18 22:21 ` [PATCH v2] " Jonathan Tan
2016-07-18 22:40 ` Jonathan Nieder
2016-07-19 16:46 ` Stefan Beller [this message]
2016-07-19 19:03 ` Jonathan Tan
2016-07-19 19:17 ` Stefan Beller
2016-07-19 19:23 ` Junio C Hamano
2016-07-19 19:53 ` Jonathan Nieder
2016-07-19 20:20 ` Junio C Hamano
2016-07-20 13:40 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGZ79kY+2PYx9oz9tvi0zG-oE6qS-Za7D3ocY1XtqcSsDchz0Q@mail.gmail.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).