summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-08-03 15:10:27 -0700
committerJunio C Hamano <gitster@pobox.com>2016-08-03 15:10:27 -0700
commit67b3a5d4c084c3f579205a07b65169e742d39c02 (patch)
tree501242a51b6a4c92fd044dccb05aa14018a9598c
parent5569c01be855e0b1a66680bbb02ba8ee117ba7bb (diff)
parentda470981defcace6e909b74ebc4ab5a40a702728 (diff)
downloadgit-67b3a5d4c084c3f579205a07b65169e742d39c02.tar.gz
Merge branch 'jt/fetch-large-handshake-window-on-http'
"git fetch" exchanges batched have/ack messages between the sender and the receiver, initially doubling every time and then falling back to enlarge the window size linearly. The "smart http" transport, being an half-duplex protocol, outgrows the preset limit too quickly and becomes inefficient when interacting with a large repository. The internal mechanism learned to grow the window size more aggressively when working with the "smart http" transport. * jt/fetch-large-handshake-window-on-http: fetch-pack: grow stateless RPC windows exponentially
-rw-r--r--fetch-pack.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index b501d5c320..85e77af61d 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;
}