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
This commit is contained in:
Junio C Hamano 2016-08-03 15:10:27 -07:00
commit 67b3a5d4c0

View File

@ -243,16 +243,21 @@ static void insert_one_alternate_ref(const struct ref *ref, void *unused)
#define INITIAL_FLUSH 16 #define INITIAL_FLUSH 16
#define PIPESAFE_FLUSH 32 #define PIPESAFE_FLUSH 32
#define LARGE_FLUSH 1024 #define LARGE_FLUSH 16384
static int next_flush(struct fetch_pack_args *args, int count) static int next_flush(struct fetch_pack_args *args, int count)
{ {
int flush_limit = args->stateless_rpc ? LARGE_FLUSH : PIPESAFE_FLUSH; if (args->stateless_rpc) {
if (count < LARGE_FLUSH)
if (count < flush_limit) count <<= 1;
count <<= 1; else
else count = count * 11 / 10;
count += flush_limit; } else {
if (count < PIPESAFE_FLUSH)
count <<= 1;
else
count += PIPESAFE_FLUSH;
}
return count; return count;
} }