9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net>
To: 9front@9front.org
Subject: Re: [9front] Understanding milli-CPUs (/dev/sysstat)
Date: Fri, 07 Jan 2022 16:10:34 +0100	[thread overview]
Message-ID: <87k0fbzimt.fsf@turtle-trading.net> (raw)
In-Reply-To: <7e13be65-765d-4f6e-ad2a-e1646f01c53d@sirjofri.de> (sirjofri's message of "Fri, 7 Jan 2022 12:01:15 +0000 (UTC)")

Hi sirjofri,

sirjofri writes:
> According to cons(3), load inside /dev/sysstat is a number in
> milli-CPUs. How is this number to interpret?
>
> Looking at stats.c they compare the number with 1000 (times the number
> of cpus).

My understanding is from Linux, but I hope this translates to Plan 9:
The load is the number of threads that are waiting in the scheduler for
time on some CPU, averaged over some time span.  So threads that wait on
some I/O in the kernel or on a synchronization primitive like
rendevous() do not count.  Only those threads are counted that will
actually use the CPU right away, once the scheduler lets them.

This means that 1 (thread) per CPU is fine, but everything above that
should better be temporary or intentional.  Otherwise you probably do
not have enough CPUs for your workload.  That's just a rule rule of
thumb, your mileage may vary as they say.

Counting the load in "millis" is probably just a way to avoid floating
point in the kernel.

> However, I have the following issue:
>
> I wrote a daily script which sends me an email via a cron job. The
> mail contains this load value from /dev/sysstat.

I see that this device is described in cons(3).  I do not see from that
documentation what time span sysstat uses.  It seems that you need to
write to the file to reset it and than read from it after some time.
But it also says that the vale is "decayed over time" which sounds like
some kind of moving average.  It does not say (unless I missed it), how
fast this decay is (i.e. again over which time span).

so long, benny

  reply	other threads:[~2022-01-07 16:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 12:01 sirjofri
2022-01-07 15:10 ` Benjamin Riefenstahl [this message]
2022-01-09  8:14   ` Anthony Martin
2022-01-09 12:36     ` Benjamin Riefenstahl

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=87k0fbzimt.fsf@turtle-trading.net \
    --to=b.riefenstahl@turtle-trading.net \
    --cc=9front@9front.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.
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).