GNU bug report logs - #33370
Cuirass: Trigger 'guix publish' baking

Previous Next

Package: guix;

Reported by: Clément Lassieur <clement <at> lassieur.org>

Date: Tue, 13 Nov 2018 23:49:01 UTC

Severity: normal

Done: Tobias Geerinckx-Rice <me <at> tobias.gr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33370 in the body.
You can then email your comments to 33370 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#33370; Package guix. (Tue, 13 Nov 2018 23:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Lassieur <clement <at> lassieur.org>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Tue, 13 Nov 2018 23:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Bug Guix <bug-guix <at> gnu.org>
Subject: guix publish: at least one user will have to build a given substitute
Date: Wed, 14 Nov 2018 00:48:40 +0100
Hi,

I've noticed that narinfo baking is triggered by user requests when the
'--cache' option of 'guix publish' is used.  It means that the first
user who will want it will get the 404 response and will have to build
it manually.  (See guix/scripts/publish.scm, make-request-handler.)

I was reluctant to send this email to bug-guix <at> gnu.org because it's
fairly well documented, but I don't like this behaviour...  As a matter
of fact I'm often the first user downloading substitutes on my 'guix
publish' server.

Would it be possible to trigger the baking right after the build is
done?  So that every user can be sure that they will get the substitute
once they know that Cuirass has built it.

If 'guix publish' has no way to get the notification that a build is
done, maybe Cuirass could trigger the baking?  (But that would be
hackish in my opinion.)

Cheers,
Clément

--8<---------------cut here---------------start------------->8---
‘--cache=DIRECTORY’
‘-c DIRECTORY’
     Cache archives and meta-data (‘.narinfo’ URLs) to DIRECTORY and
     only serve archives that are in cache.

     When this option is omitted, archives and meta-data are created
     on-the-fly.  This can reduce the available bandwidth, especially
     when compression is enabled, since this may become CPU-bound.
     Another drawback of the default mode is that the length of archives
     is not known in advance, so ‘guix publish’ does not add a
     ‘Content-Length’ HTTP header to its responses, which in turn
     prevents clients from knowing the amount of data being downloaded.

     Conversely, when ‘--cache’ is used, the first request for a store
     item (via a ‘.narinfo’ URL) returns 404 and triggers a background
     process to “bake” the archive—computing its ‘.narinfo’ and
     compressing the archive, if needed.  Once the archive is cached in
     DIRECTORY, subsequent requests succeed and are served directly from
     the cache, which guarantees that clients get the best possible
     bandwidth.

     The “baking” process is performed by worker threads.  By default,
     one thread per CPU core is created, but this can be customized.
     See ‘--workers’ below.

     When ‘--ttl’ is used, cached entries are automatically deleted when
     they have expired.
--8<---------------cut here---------------end--------------->8---




Information forwarded to bug-guix <at> gnu.org:
bug#33370; Package guix. (Wed, 14 Nov 2018 10:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 33370 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 33370 <at> debbugs.gnu.org
Subject: Re: bug#33370: guix publish: at least one user will have to build a
 given substitute
Date: Wed, 14 Nov 2018 11:09:57 +0100
Hello,

Clément Lassieur <clement <at> lassieur.org> skribis:

> I've noticed that narinfo baking is triggered by user requests when the
> '--cache' option of 'guix publish' is used.  It means that the first
> user who will want it will get the 404 response and will have to build
> it manually.  (See guix/scripts/publish.scm, make-request-handler.)

Note that the first request (404) returns with an expiry of 5mn instead
of the default (much longer) expiry for “normal” 404s.

We discussed this behavior at length back then and that seemed to me
like a reasonable behavior for a service with many users: the first one
gets 404 (or has to wait for 5 more minutes), but when there are enough
users, it doesn’t matter much.

For a single-user setup, I recommend not using ‘--cache’.

> Would it be possible to trigger the baking right after the build is
> done?  So that every user can be sure that they will get the substitute
> once they know that Cuirass has built it.
>
> If 'guix publish' has no way to get the notification that a build is
> done, maybe Cuirass could trigger the baking?  (But that would be
> hackish in my opinion.)

I had that in mind: adding a build completion hook on Cuirass, which
could trigger baking (I don’t think it’s particularly hackish: Cuirass
is the only place that can send a notification.)  Basically we’d run:

  cuirass --build-completion-hook=/some/program …

and that program could do a GET on the right narinfo URL(s).

This would be useful in reducing latency; the downside is that we’d bake
lots of things, even possibly things that nobody ever needs.

Thoughts?

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#33370; Package guix. (Wed, 14 Nov 2018 10:19:01 GMT) Full text and rfc822 format available.

Message #11 received at 33370 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 33370 <at> debbugs.gnu.org
Subject: Re: bug#33370: guix publish: at least one user will have to build a
 given substitute
Date: Wed, 14 Nov 2018 11:18:53 +0100
Hi Ludo,

Ludovic Courtès <ludo <at> gnu.org> writes:

> Hello,
>
> Clément Lassieur <clement <at> lassieur.org> skribis:
>
>> I've noticed that narinfo baking is triggered by user requests when the
>> '--cache' option of 'guix publish' is used.  It means that the first
>> user who will want it will get the 404 response and will have to build
>> it manually.  (See guix/scripts/publish.scm, make-request-handler.)
>
> Note that the first request (404) returns with an expiry of 5mn instead
> of the default (much longer) expiry for “normal” 404s.
>
> We discussed this behavior at length back then and that seemed to me
> like a reasonable behavior for a service with many users: the first one
> gets 404 (or has to wait for 5 more minutes), but when there are enough
> users, it doesn’t matter much.

But at least one user will complain, and if it's a small laptop building
Icecat...

> For a single-user setup, I recommend not using ‘--cache’.

Yes, that's what I did.

>> Would it be possible to trigger the baking right after the build is
>> done?  So that every user can be sure that they will get the substitute
>> once they know that Cuirass has built it.
>>
>> If 'guix publish' has no way to get the notification that a build is
>> done, maybe Cuirass could trigger the baking?  (But that would be
>> hackish in my opinion.)
>
> I had that in mind: adding a build completion hook on Cuirass, which
> could trigger baking (I don’t think it’s particularly hackish: Cuirass
> is the only place that can send a notification.)  Basically we’d run:
>
>   cuirass --build-completion-hook=/some/program …
>
> and that program could do a GET on the right narinfo URL(s).

Yeah I agree it's not that hackish.

> This would be useful in reducing latency; the downside is that we’d bake
> lots of things, even possibly things that nobody ever needs.
>
> Thoughts?

What about getting the first user to block until the baking is done?  It
will take more time for them but at least they won't have to build it
locally.

And things nobody use won't have to be baked.

Clément




Information forwarded to bug-guix <at> gnu.org:
bug#33370; Package guix. (Wed, 14 Nov 2018 14:50:01 GMT) Full text and rfc822 format available.

Message #14 received at 33370 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Clément Lassieur <clement <at> lassieur.org>
Cc: 33370 <at> debbugs.gnu.org
Subject: Re: bug#33370: guix publish: at least one user will have to build a
 given substitute
Date: Wed, 14 Nov 2018 15:49:14 +0100
Hi,

Clément Lassieur <clement <at> lassieur.org> skribis:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Hello,
>>
>> Clément Lassieur <clement <at> lassieur.org> skribis:
>>
>>> I've noticed that narinfo baking is triggered by user requests when the
>>> '--cache' option of 'guix publish' is used.  It means that the first
>>> user who will want it will get the 404 response and will have to build
>>> it manually.  (See guix/scripts/publish.scm, make-request-handler.)
>>
>> Note that the first request (404) returns with an expiry of 5mn instead
>> of the default (much longer) expiry for “normal” 404s.
>>
>> We discussed this behavior at length back then and that seemed to me
>> like a reasonable behavior for a service with many users: the first one
>> gets 404 (or has to wait for 5 more minutes), but when there are enough
>> users, it doesn’t matter much.
>
> But at least one user will complain, and if it's a small laptop building
> Icecat...

The way we’re doing things, there’s necessarily a delay (the build time
plus some additional latency) between the moment and commit is pushed
and the moment the corresponding package is built.  Baking only adds a
very small latency.

>> This would be useful in reducing latency; the downside is that we’d bake
>> lots of things, even possibly things that nobody ever needs.
>>
>> Thoughts?
>
> What about getting the first user to block until the baking is done?

That’s generally not possible because HTTP is supposedly synchronous.
Also, ‘guix publish’ has a bunch of worker threads that pick baking
tasks from a queue.  When the queue is empty and you asking for a
substitute of sed, it will take seconds to bake it; but when the queue
is already large and you’re asking for LibreOffice, it could take a few
minutes.

For the intended use case, which is a build farm with many users,
optimizing for the first user makes little sense IMO.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#33370; Package guix. (Wed, 14 Nov 2018 15:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 33370 <at> debbugs.gnu.org (full text, mbox):

From: Clément Lassieur <clement <at> lassieur.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 33370 <at> debbugs.gnu.org
Subject: bug#33370: Cuirass: Trigger 'guix publish' baking
Date: Wed, 14 Nov 2018 16:34:09 +0100
Ludovic Courtès <ludo <at> gnu.org> writes:

>>> This would be useful in reducing latency; the downside is that we’d bake
>>> lots of things, even possibly things that nobody ever needs.
>>>
>>> Thoughts?
>>
>> What about getting the first user to block until the baking is done?
>
> That’s generally not possible because HTTP is supposedly synchronous.
> Also, ‘guix publish’ has a bunch of worker threads that pick baking
> tasks from a queue.  When the queue is empty and you asking for a
> substitute of sed, it will take seconds to bake it; but when the queue
> is already large and you’re asking for LibreOffice, it could take a few
> minutes.
>
> For the intended use case, which is a build farm with many users,
> optimizing for the first user makes little sense IMO.

I don't agree, because I find it stressful when you build something and
you're not 100% sure you'll get the substitute.  If someone is the only
user of several Guix packages (and I think it's the case for many of our
users), they'll have to re-build them locally every time one of their
dependencies is updated.

So if I understand well, the Cuirass solution seems the best...  I leave
the bug open but I change the name :-)

Thank you,
Clément




Changed bug title to 'Cuirass: Trigger 'guix publish' baking' from 'guix publish: at least one user will have to build a given substitute' Request was from clement <at> lassieur.org (Clément Lassieur) to control <at> debbugs.gnu.org. (Wed, 14 Nov 2018 15:36:02 GMT) Full text and rfc822 format available.

Reply sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
You have taken responsibility. (Mon, 30 Nov 2020 22:16:01 GMT) Full text and rfc822 format available.

Notification sent to Clément Lassieur <clement <at> lassieur.org>:
bug acknowledged by developer. (Mon, 30 Nov 2020 22:16:01 GMT) Full text and rfc822 format available.

Message #24 received at 33370-done <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: 33370-done <at> debbugs.gnu.org
Subject: Cuirass: Trigger 'guix publish' baking
Date: Mon, 30 Nov 2020 23:15:01 +0100
[Message part 1 (text/plain, inline)]
This was (‘mostly’ --Ludo') addressed by adding 
‘--cache-bypass-threshold’.

Closing,

T G-R
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 29 Dec 2020 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 90 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.