unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 43773@debbugs.gnu.org
Subject: bug#43773: [PATCH] offload: Improve load normalization and configurability.
Date: Mon, 05 Oct 2020 13:07:19 -0400	[thread overview]
Message-ID: <87d01wk3eg.fsf@gmail.com> (raw)
In-Reply-To: <87tuv8wywe.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 05 Oct 2020 16:06:09 +0200")

Hello,

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

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> Fixes <https://issues.guix.gnu.org/43773>.
>>
>> The computed normalized load was previously obtained by dividing the load
>> average as found in /proc/loadavg by the number of parallel builds defined for
>> a build machine.
>>
>> This normalized didn't allow to compare machines with different number of
>                               ^
>
>> cores, as the load average reported by can be as high as the number of cores;
>                                         ^
> Missing words.

Good catch, fixed.

[...]

>>  (define (node-load node)
>> -  "Return the load on NODE.  Return + if NODE is misbehaving."
>> +  "Return the load on NODE, a normalized value between 0.0 and 1.0.  The value
>> +is derived from /proc/loadavg and normalized according to the number of
>> +logical cores available, to give a rough estimation of CPU usage.  Return
>> +1.0 (fully loaded) if NODE is misbehaving."
>>    (let ((line (inferior-eval '(begin
>>                                  (use-modules (ice-9 rdelim))
>>                                  (call-with-input-file "/proc/loadavg"
>>                                    read-string))
>> -                             node)))
>> -    (if (eof-object? line)
>> -        +inf.0 ;MACHINE does not respond, so assume it is infinitely loaded
>> +                             node))
>> +        (ncores (inferior-eval '(begin
>> +                                  (use-modules (ice-9 threads))
>> +                                  (current-processor-count))
>> +                               node)))
>> +    (if (or (eof-object? line) (eof-object? ncores))
>> +        1.0    ;MACHINE does not respond, so assume it is fully loaded
>
> Returning 1.0 now is akin to returning + before, meaning that the
> machine will never be picked up, is that right?

Yes, 1.0 has the same meaning as the +inf.0 value previously used (i.e.,
the machine is fully loaded).

> What if one sets overload-threshold = 1.0, the machine would still be
> picked up, no?

Currently no, the machine would never be picked up, as the maximum value
returned by node-load is now 1.0, and the comparison is using the
strictly inferior to operator (<).  Perhaps this should be made a <=
operator?

>> +         (if (and node
>> +                  (or (not threshold) (< load threshold))
>
> I think we can assume that THRESHOLD is always a number, including
> possible +inf.0.

It's no longer possible for node-load to return +inf.0; it's strictly
bound between 0.0 and 1.0.  The check for #f is done because it is
desirable (for semantic clarity) to allow the user to disable
overload-threshold altogether by setting it to #f.  This is documented.

Thanks!

Maxim




  reply	other threads:[~2020-10-05 17:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03  3:05 bug#43773: guix offload scheduler/load balancer throttles itself Maxim Cournoyer
2020-10-04  3:21 ` bug#43773: [PATCH] offload: Improve load normalization and configurability Maxim Cournoyer
2020-10-04  7:59   ` Andreas Enge
2020-10-05 14:06   ` Ludovic Courtès
2020-10-05 17:07     ` Maxim Cournoyer [this message]
2020-10-08 15:04       ` Maxim Cournoyer
2020-10-05 21:00 ` bug#43773: guix offload scheduler/load balancer throttles itself zimoun
2020-10-06  3:44   ` Maxim Cournoyer

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=87d01wk3eg.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=43773@debbugs.gnu.org \
    --cc=ludo@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).