unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#45018] [PATCH 0/6] Process and connection reuse for substitutions
@ 2020-12-03 10:13 Ludovic Courtès
  2020-12-03 10:19 ` [bug#45018] [PATCH 1/6] daemon: 'Agent' constructor takes a list of environment variables Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Ludovic Courtès @ 2020-12-03 10:13 UTC (permalink / raw)
  To: 45018; +Cc: Ludovic Courtès

Hi Guix!

The attached patches optimize substitute downloads by: (1) keeping
a single ‘guix substitute’ process for all the substitutes (instead
of respawning a new one each time a store item is substituted), and
(2) reusing connections to substitute servers in between substitutions.

(Note that ‘guix publish’ does not keep connections alive, but
on ci.guix.gnu.org we run nginx in front of ‘guix publish’, and nginx
keeps them alive.)

Anecdotally, the effect is a 10% improvement on the wall-clock time
of ‘guix build --sources=transitive vim’ on my laptop, from 29s to 26s.
Of course it cannot be much better since the rest of the time is spent
actually retrieving bits over the network.

Overall the impact depends on a number of factors.  My laptop has
an SSD and I have fiber-to-the-home (FFTH) with low latency: forking
and initiating a TLS connection to ci.guix.gnu.org are both quite cheap,
so I probably don’t benefit that much.  The impact may be more acute
on a low-end device.

In the ‘guix build --sources=transitive vim’ case, there are a few
large tarballs and several small ones.  The gain is in the lack of
a pause time in between small tarballs.  Also this case is quite
advantageous: there’s no decompression and no unpacking happening.

Anyway, I think it’s a welcome improvement, especially when
downloading lots of stuff such as during the initial system installation.
Plus, there are more deletions than insertions.  :-)

Thoughts?

Ludo’.

Ludovic Courtès (6):
  daemon: 'Agent' constructor takes a list of environment variables.
  daemon: Use 'Agent' to spawn 'guix substitute --query'.
  daemon: Factorize substituter agent spawning.
  daemon: Run 'guix substitute --substitute' as an agent.
  substitute: Cache and reuse connections while substituting.
  daemon: Raise an error if substituter doesn't send the expected hash.

 guix/http-client.scm        |  12 +-
 guix/progress.scm           |   8 +-
 guix/scripts/substitute.scm | 215 +++++++++++++++++++++++-------------
 nix/libstore/build.cc       | 166 ++++++++++++++--------------
 nix/libstore/local-store.cc | 170 +++++++---------------------
 nix/libstore/local-store.hh |  25 +----
 nix/libutil/util.cc         |   6 +-
 nix/libutil/util.hh         |   7 +-
 tests/substitute.scm        |  98 +++++++++-------
 9 files changed, 350 insertions(+), 357 deletions(-)

-- 
2.29.2





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-12-08 22:42 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-03 10:13 [bug#45018] [PATCH 0/6] Process and connection reuse for substitutions Ludovic Courtès
2020-12-03 10:19 ` [bug#45018] [PATCH 1/6] daemon: 'Agent' constructor takes a list of environment variables Ludovic Courtès
2020-12-03 10:19   ` [bug#45018] [PATCH 2/6] daemon: Use 'Agent' to spawn 'guix substitute --query' Ludovic Courtès
2020-12-04  8:23     ` Mathieu Othacehe
2020-12-06 21:51       ` Ludovic Courtès
2020-12-03 10:19   ` [bug#45018] [PATCH 3/6] daemon: Factorize substituter agent spawning Ludovic Courtès
2020-12-04  8:19     ` Mathieu Othacehe
2020-12-03 10:19   ` [bug#45018] [PATCH 4/6] daemon: Run 'guix substitute --substitute' as an agent Ludovic Courtès
2020-12-04  8:27     ` Mathieu Othacehe
2020-12-06 21:53       ` Ludovic Courtès
2020-12-03 10:19   ` [bug#45018] [PATCH 5/6] substitute: Cache and reuse connections while substituting Ludovic Courtès
2020-12-03 10:19   ` [bug#45018] [PATCH 6/6] daemon: Raise an error if substituter doesn't send the expected hash Ludovic Courtès
2020-12-03 11:48 ` [bug#45018] [PATCH 0/6] Process and connection reuse for substitutions 宋文武
2020-12-03 20:52 ` Ludovic Courtès
2020-12-04  8:34   ` Mathieu Othacehe
2020-12-06 22:04     ` [bug#45018] [PATCH v2 " Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 1/6] daemon: 'Agent' constructor takes a list of environment variables Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 2/6] daemon: Use 'Agent' to spawn 'guix substitute --query' Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 3/6] daemon: Factorize substituter agent spawning Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 4/6] daemon: Run 'guix substitute --substitute' as an agent Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 5/6] substitute: Cache and reuse connections while substituting Ludovic Courtès
2020-12-06 22:04       ` [bug#45018] [PATCH v2 6/6] daemon: Raise an error if substituter doesn't send the expected hash Ludovic Courtès
2020-12-08 22:39       ` bug#45018: [PATCH v2 0/6] Process and connection reuse for substitutions Ludovic Courtès

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).