[distcc] Suggestion about host selection

Fergus Henderson fergus at google.com
Wed Jun 18 15:32:40 GMT 2008


On Wed, Jun 18, 2008 at 7:22 AM, <thomas at schuerger.com> wrote:

> Hi,
>
> when given a list of hosts in DISTCC_HOSTS, e.g.
>
> DISTCC_HOSTS="host1/6 host2/2 host3/3"
>
> The documentation states that the hosts are given priority as specified,
> so host1 is the preferred host. I looked at the distcc code and was
> surprised to find that this "list of preference" is interpreted somewhat
> differently than I expected.


I think you have misread the code.

(Which distcc version are you using?  Though this code hasn't changed
between distcc 2.18.3 and distcc 3.0.)

The code does the following (this is in dcc_lock_one() in src/where.c):

   while (1) {
        for (i_cpu = 0; i_cpu < 50; i_cpu++) {
            for (h = hostlist; h; h = h->next) {

The middle loop is over slot number.  The inner loop is over hosts.
It tries slot 0, host 0, and then slot 0, host 1, and then slot 0, host 2,
etc.
before trying slot 1, host 1, and then slot 1, host 1, and then slot 1, host
2, etc.

(Yes, this code won't work if you have a single host with more than 50
slots!  Patches welcome :)

-- 
Fergus Henderson <fergus at google.com>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the distcc mailing list