unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: 50040@debbugs.gnu.org
Subject: [bug#50040] [PATCH 0/2] publish: Always render nar/narinfo during backing.
Date: Tue, 31 Aug 2021 00:31:49 +0200	[thread overview]
Message-ID: <87sfyqa7je.fsf_-_@gnu.org> (raw)
In-Reply-To: <20210813103030.1017-1-othacehe@gnu.org> (Mathieu Othacehe's message of "Fri, 13 Aug 2021 12:30:29 +0200")

Mathieu Othacehe <othacehe@gnu.org> skribis:

> The "narinfo-string" procedure is expensive in term of IO operations and can
> take a while under IO pressure, such a GC collecting. Defer its call to a new
> thread created in the http-write procedure.

I don’t fully understand where the performance problem comes from.

‘narinfo-string’ makes RPCs, formats a string, and computes a signature
over a few hundred bytes at most.  It does almost no I/O per se (it gets
the nar hash and size via an RPC), and does little computation.

I get this:

--8<---------------cut here---------------start------------->8---
scheme@(guix scripts publish)> (%public-key (read-file-sexp "tests/signing-key.pub"))
$8 = #f
scheme@(guix scripts publish)> (%private-key (read-file-sexp "tests/signing-key.sec"))
$9 = #f
scheme@(guix scripts publish)> ,t (narinfo-string s "/gnu/store/0ff19dxsjvhf4hjnw9ixlqpwdmwfpbyp-libreoffice-7.1.4.2")
$11 = "StorePath: /gnu/store/0ff19dxsjvhf4hjnw9ixlqpwdmwfpbyp-libreoffice-7.1.4.2\nURL: nar/0ff19dxsjvhf4hjnw9ixlqpwdmwfpbyp-libreoffice-7.1.4.2\nCompression: none\nFileSize: 441389400\n[…]"
;; 0.006714s real time, 0.006460s run time.  0.000000s spent in GC.
--8<---------------cut here---------------end--------------->8---

Off the top of my head, scenarios that can make ‘narinfo-string’ slow:

  0. The store’s big GC lock is taken so RPCs don’t complete until it’s
     over.

     GC runs at most twice a day on berlin.  Do you have logs showing at
     what time those timeouts occur?  We could see if there’s a
     correlation.

  1. Contention on the daemon database (“database is locked”) that makes
     RPCs take seconds to complete.  Right now,

       sudo guix processes|grep ^Session|wc -l

     returns 6, which is not a lot, and I suspect that’s typical.  There
     could still be contention, but that doesn’t sound very likely.

  2. It does I/O when it calls ‘read-derivation-from-file’.  Under high
     I/O load, that could be relatively expensive, though I’d expect it
     to be measured in tenths of a second at worst?

     But look, ‘read-derivation-from-file’ is called just to fill in the
     “System” field, which is not used anywhere (not a single caller of
     ‘narinfo-system’), so we could just as well remove it and see how
     it behaves.

Did you manage to come up with a way to synthetically reproduce the
problem?

Anyway, that the main thread is blocking while this happens is certainly
a problem, so this patch looks like an improvement.  That we have to use
the ‘http-write’ hack isn’t great, but I think it’s OK, unless we want
to switch to Fibers.

Ludo’.




  parent reply	other threads:[~2021-08-30 22:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 10:28 [bug#50040] [PATCH 0/2] publish: Always render nar/narinfo during backing Mathieu Othacehe
2021-08-13 10:30 ` [bug#50040] [PATCH 1/2] publish: Defer narinfo string creation to the http-write Mathieu Othacehe
2021-08-13 10:30   ` [bug#50040] [PATCH 2/2] publish: Remove cache bypass support Mathieu Othacehe
2021-08-30 22:31   ` Ludovic Courtès [this message]
2021-08-31  9:08     ` [bug#50040] [PATCH 0/2] publish: Always render nar/narinfo during backing Mathieu Othacehe
2021-09-01 20:48       ` Ludovic Courtès
2021-10-06  8:58   ` Mathieu Othacehe
2021-10-08  7:04     ` Mathieu Othacehe
2021-08-22  7:33 ` Mathieu Othacehe
2021-08-30 22:33   ` Ludovic Courtès
2021-09-06 13:54     ` Ludovic Courtès
2021-09-17 15:27       ` Mathieu Othacehe
2021-10-05 10:07         ` Mathieu Othacehe

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfyqa7je.fsf_-_@gnu.org \
    --to=ludo@gnu.org \
    --cc=50040@debbugs.gnu.org \
    --cc=othacehe@gnu.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).