From: Jeff King <peff@peff.net>
To: Jacob Vosmaer <jacob@gitlab.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/1] Make upload-pack pack write size configurable
Date: Tue, 14 Dec 2021 10:12:53 -0500 [thread overview]
Message-ID: <Ybi0dSddal2DKmXQ@coredump.intra.peff.net> (raw)
In-Reply-To: <20211213132345.26310-1-jacob@gitlab.com>
On Mon, Dec 13, 2021 at 02:23:44PM +0100, Jacob Vosmaer wrote:
> When transfering packfile data, upload-pack.c uses an 8KB buffer.
> This is a reasonable size but when you transfer a lot of packfile
> data, like we do on GitLab.com, we find it is beneficial to use a
> larger buffer size.
>
> Below you will find a commit where we make the size of this 8KB
> buffer configurable at compile time. It appears pack-objects always
> does 8KB writes so I don't think we should change the default. But
> for GitLab, where we have a cache for the output of pack-objects,
> it is beneficial to use a larger IO size because the cache does
> 64KB writes.
I suspect the big reason that it matters for the cache is that for
pack-objects, we're typically CPU bound computing the sha1 of the
outgoing pack (for its trailer).
I do suspect we could just always move to something closer to
LARGE_PACKET_DATA_MAX (probably minus 1 for the sideband marker). Even
if pack-objects only writes in 8k chunks, we may be able to pull several
in one read(), especially if the network is a bottleneck (because we'd
block writing to the client, and pack-objects would fill up the pipe
buffer).
I.e., it doesn't seem like there's any real downside to doing so.
> I have also considered converting the packfile copying code to use
> stdio when writing to stdout, but that would be a bigger change
> because we have to be careful not to interleave stdio and stdlib
> writes. And we would have to make the stdout output buffer size
> configurable, because the default stdio buffer size is 4KB which
> is no better than the status quo. A final argument against the stdio
> approach is that it only reduces the number of writes from upload-pack,
> while a larger buffer size reduces both the number of reads and
> writes.
Yeah, I don't think that would help all that much. We really want to
size this based on pkt-line limits. That reduces syscalls, but also
shrinks the overall size a little (since larger packets minimizes the
framing overhead of the pkt-line headers).
-Peff
prev parent reply other threads:[~2021-12-14 15:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-13 13:23 [PATCH 0/1] Make upload-pack pack write size configurable Jacob Vosmaer
2021-12-13 13:23 ` [PATCH 1/1] upload-pack.c: make output buffer " Jacob Vosmaer
2021-12-14 12:08 ` Ævar Arnfjörð Bjarmason
2021-12-14 15:08 ` Jeff King
2021-12-14 19:46 ` [PATCH v2 0/1] upload-pack.c: increase output buffer size Jacob Vosmaer
2021-12-14 19:46 ` [PATCH v2 1/1] " Jacob Vosmaer
2021-12-14 20:41 ` Ævar Arnfjörð Bjarmason
2021-12-15 16:30 ` Jeff King
2021-12-15 19:50 ` Junio C Hamano
2021-12-15 19:59 ` rsbecker
2021-12-15 20:24 ` Jacob Vosmaer
2021-12-15 20:38 ` rsbecker
2021-12-15 20:45 ` Jacob Vosmaer
2021-12-15 21:34 ` rsbecker
2021-12-14 15:37 ` [PATCH 1/1] upload-pack.c: make output buffer size configurable Jeff King
2021-12-14 20:04 ` Jacob Vosmaer
2021-12-14 15:12 ` Jeff King [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ybi0dSddal2DKmXQ@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=jacob@gitlab.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.
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 NNTP newsgroup(s).