Merge branch 'jt/fetch-large-handshake-window-on-http'
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Aug 2016 22:10:27 +0000 (15:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Aug 2016 22:10:27 +0000 (15:10 -0700)
"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

fetch-pack.c
index b501d5c320a5117020a934a50fce2a356b0c2f0e..85e77af61d05b492d6448fd4ad33abc2c348eaf1 100644 (file)
@@ -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;
 }