public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Pandu Poluan <pandu@poluan.info>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] emerge -j, make -j and make -l
Date: Mon, 28 Nov 2011 00:56:17 +0700	[thread overview]
Message-ID: <CAA2qdGWwuHUUd7ZkbBOwJxx8Ax88xfAptASgvbFtNa0YMqe6bQ@mail.gmail.com> (raw)
In-Reply-To: <CA+czFiBAR2_j1vETXGZk6SL9XK9w=doe4orU+bLeZbXHXBUqPg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2909 bytes --]

On Nov 27, 2011 5:12 PM, "Michael Mol" <mikemol@gmail.com> wrote:
>
> I figure that the optimal number of simultaneous CPU-consuming
> processes is going to be the number of CPU cores, plus enough to keep
> the CPU occupied while others are blocked on I/O. That's the same
> reasoning that drives the selection of a -j number, really.
>
> If I read make's man page correctly, -l acts as a threshold, choosing
> not to spawn an additional child process if the system load average is
> above a certain value Since system load is a count of actively running
> and ready-to-run processes, you want it to be very close to your
> number of logical cores[1].
>
> Since it's going to be a spot decision for Make as to whether or not
> to spawn another child (if it hits its limit, it's not going to check
> again until after one of its children returns), there will be many
> race cases where the load average is high when it looks, but some
> other processes will return shortly afterward.[2] That means adding a
> process or two for a fudge factor.
>
> That's a lot of guess, though, and it still comes down to guess-and-check.
>
> emerge -j8 @world # MAKEOPTS="-j16 -l10"
>
> Was the first combination I tried. This completed in 89 minutes.
>
> emerge -j8 @world # MAKEOPT="-j16 -l8"
>
> Was the second. This took significantly longer.
>
> I haven't tried higher than -l10; I needed this box to do be able to
> do things, which meant installing more software. I've gone from 177
> packages to 466.
>
> [1] I don't have a hyperthreading system available, but I suspect that
> this is also going to be true of logical cores; It's my understanding
> that the overhead from overcommitting CPU comes primarily from context
> switching between processors, and hyperthreading adds CPU hardware
> specifically to reduce the need to context-switch in splitting
> physical CPU resources between threads/processes. So while you'd lose
> a little speed for an individual thread, you would gain it back in
> aggregate over both threads.
>
> [2] There would also be cases where the load average is low, such as
> if a Make recipe calls for a significant bit of I/O before it consumes
> a great deal of CPU, but a simple 7200rpm SATA disk appears to be
> sufficiently fast that this case is less frequent.

Here's my experience:

I always experience emerge failures on my Gentoo VMs if I use
MAKEOPTS=-j>3. Not all packages, but many. Including, IIRC, glibc and gcc.

This happens even if I make sure that there's just one emerge job being
done. And this happens even if I allocate more vCPUs than -j, on VMware and
XenServer alike.

I don't know where the 'blame' lies, but I've found myself standardizing on
MAKEOPTS=-j3, and PORTAGE_DEFAULT_OPTS="--jobs
--load-average=<1.6*num_of_vCPU>"

(Yes, no explicit number of jobs. The newer portages are smart enough to
keep starting new jobs until the load number is reached)

Rgds,

[-- Attachment #2: Type: text/html, Size: 3442 bytes --]

  reply	other threads:[~2011-11-27 17:57 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-26 15:22 [gentoo-user] emerge -j, make -j and make -l Michael Mol
2011-11-26 15:34 ` Alex Schuster
2011-11-26 15:51   ` Michael Mol
2011-11-26 16:03   ` Stefan G. Weichinger
2011-12-19 19:58     ` Stefan G. Weichinger
2011-12-19 20:05       ` Michael Mol
2011-11-26 15:35 ` Stefan G. Weichinger
2011-11-27  9:27 ` Mick
2011-11-27 10:09   ` Michael Mol
2011-11-27 17:56     ` Pandu Poluan [this message]
2011-11-27 20:16       ` Michael Mol
2011-11-27 20:42         ` Michael Mol
2011-11-27 20:51           ` Alex Schuster
2011-11-28  0:42             ` Pandu Poluan
2011-11-27 20:57         ` Alan McKinnon
2011-11-28  1:06         ` Pandu Poluan
2011-11-28  5:30           ` Michael Mol
2011-11-28  5:55             ` Pandu Poluan
2011-11-27 23:21       ` Neil Bothwick
2011-11-28  0:54         ` Pandu Poluan
2011-11-28  1:10           ` [gentoo-user] " Jack Byer
2011-11-28  1:35             ` Dale
2011-11-28  2:16               ` Pandu Poluan
2011-11-28  7:02                 ` Dale
2011-11-28  4:34           ` [gentoo-user] " Michael Mol
2011-11-28  5:13             ` Pandu Poluan
2011-11-28  5:27               ` Michael Mol
2011-11-28  9:27             ` Neil Bothwick
2011-11-28 13:36               ` Pandu Poluan
2011-11-28 16:36               ` Stefan G. Weichinger
2011-11-29 11:08                 ` Neil Bothwick
2011-11-29 13:47                   ` Stefan G. Weichinger
2011-11-29 15:39                     ` Neil Bothwick
2011-11-29 18:50                       ` Stefan G. Weichinger
2011-11-28  4:30         ` Michael Mol
2011-11-27 10:39   ` covici
2011-11-27 10:52     ` Michael Mol
2011-11-27 10:58     ` Dale
2011-11-27 14:47       ` covici
2011-11-27 15:02         ` Dale
2011-11-27 15:25           ` covici
2011-11-27 17:26 ` Michael Hampicke
2011-11-27 17:46   ` Pandu Poluan
2011-11-27 22:07 ` Mark Knecht
2011-11-27 23:13   ` Dale
2011-11-28  4:28   ` Michael Mol
2011-11-28  5:26     ` Pandu Poluan
2011-11-28  9:27       ` Neil Bothwick
2011-11-28 10:22         ` Pandu Poluan
2011-11-28 13:03           ` Jorge Martínez López
2011-11-28 13:26             ` Pandu Poluan
2011-11-28 18:51       ` Michael Mol
2011-11-28 18:54         ` Michael Mol
2011-11-28 23:53         ` Michael Mol
2011-12-10  4:35           ` Michael Mol
2011-12-27 15:16             ` Michael Mol

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=CAA2qdGWwuHUUd7ZkbBOwJxx8Ax88xfAptASgvbFtNa0YMqe6bQ@mail.gmail.com \
    --to=pandu@poluan.info \
    --cc=gentoo-user@lists.gentoo.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