From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: Michael Haggerty <mhagger@alum.mit.edu>,
Junio C Hamano <gitster@pobox.com>,
"git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] lock_packed_refs(): allow retries when acquiring the packed-refs lock
Date: Fri, 1 May 2015 14:22:58 -0400 [thread overview]
Message-ID: <20150501182257.GA27728@peff.net> (raw)
In-Reply-To: <CAGZ79kZnhv+aW_GW8mBDyhfv_k54ScAFsHQz=8zfHBUJ8WrVUw@mail.gmail.com>
On Fri, May 01, 2015 at 10:51:47AM -0700, Stefan Beller wrote:
> > diff --git a/refs.c b/refs.c
> > index 47e4e53..3f8ac63 100644
> > --- a/refs.c
> > +++ b/refs.c
> > @@ -2413,9 +2413,19 @@ static int write_packed_entry_fn(struct ref_entry *entry, void *cb_data)
> > /* This should return a meaningful errno on failure */
> > int lock_packed_refs(int flags)
> > {
> > + static int timeout_configured = 0;
> > + static int timeout_value = 1000;
>
> I'd personally be more happier with a default value of 100 ms or less
> The reason is found in the human nature, as humans tend to perceive
> anything faster than 100ms as "instant"[1], while a 100ms is a long time
> for computers.
>
> Now a small default time may lead to to little retries, so maybe it's worth
> checking at the very end of the time again (ignoring the computed backoff
> times). As pushes to $server usually take a while (connecting, packing packs,
> writing objects etc), this may be overcautios bikeshedding from my side.
Keep in mind that this 1s is the maximum time to wait. The
lock_file_timeout() code from patch 1 starts off at 1ms, grows
quadratically, and quits as soon as it succeeds. So in most cases, the
user will wait a much smaller amount of time.
The factors that go into this timeout length are really:
1. If there's a stale lockfile, the user will have to wait the whole
period. How long do we keep retrying before giving up?
2. How long do we typically hold the lock for? Aside from absurd
cases, writing out the packed-refs file isn't that expensive. But
while holding the packed-refs lock, we may actually be iterating
the loose refs, which can be rather slow on a cold-cache.
If we want to improve _responsiveness_ in the normal case, I think it's
not the max timeout we want to tweak but the resolution of retries.
That's set in patch 1 by the maximum backoff multiplier, which can put
us up to 1s between retries. It might make sense to drop that to 500ms
or even less.
-Peff
next prev parent reply other threads:[~2015-05-01 18:23 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 14:52 [PATCH 0/2] Retry attempts to acquire the packed-refs lock Michael Haggerty
2015-05-01 14:52 ` [PATCH 1/2] lockfile: allow file locking to be retried with a timeout Michael Haggerty
2015-05-11 18:04 ` Junio C Hamano
2015-05-01 14:52 ` [PATCH 2/2] lock_packed_refs(): allow retries when acquiring the packed-refs lock Michael Haggerty
2015-05-01 16:13 ` Johannes Sixt
2015-05-02 3:47 ` Michael Haggerty
2015-05-02 21:43 ` Johannes Sixt
2015-05-11 9:31 ` Michael Haggerty
2015-05-01 17:51 ` Stefan Beller
2015-05-01 18:22 ` Jeff King [this message]
2015-05-02 5:19 ` Michael Haggerty
2015-05-04 17:31 ` Stefan Beller
2015-05-05 19:21 ` Jeff King
2015-05-11 10:26 ` Michael Haggerty
2015-05-11 16:49 ` Jeff King
2015-05-11 17:49 ` Stefan Beller
2015-05-11 17:50 ` Stefan Beller
2015-05-03 2:12 ` [PATCH 0/2] Retry attempts to acquire " Junio C Hamano
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=20150501182257.GA27728@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mhagger@alum.mit.edu \
--cc=sbeller@google.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).