Skip to content

Commit 67b3a5d

Browse files
committed
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
2 parents 5569c01 + da47098 commit 67b3a5d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

fetch-pack.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,21 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused)
243243

244244
#define INITIAL_FLUSH 16
245245
#define PIPESAFE_FLUSH 32
246-
#define LARGE_FLUSH 1024
246+
#define LARGE_FLUSH 16384
247247

248248
static int next_flush(struct fetch_pack_args *args, int count)
249249
{
250-
int flush_limit = args->stateless_rpc ? LARGE_FLUSH : PIPESAFE_FLUSH;
251-
252-
if (count < flush_limit)
253-
count <<= 1;
254-
else
255-
count += flush_limit;
250+
if (args->stateless_rpc) {
251+
if (count < LARGE_FLUSH)
252+
count <<= 1;
253+
else
254+
count = count * 11 / 10;
255+
} else {
256+
if (count < PIPESAFE_FLUSH)
257+
count <<= 1;
258+
else
259+
count += PIPESAFE_FLUSH;
260+
}
256261
return count;
257262
}
258263

0 commit comments

Comments
 (0)