Difference between revisions of "Distcc"

From ArchWiki
Jump to: navigation, search
(Adjust log level)
(Monitoring Progress)
Line 73: Line 73:
 
22263 Compile    compat.c          192.168.0.3[2]
 
22263 Compile    compat.c          192.168.0.3[2]
 
22091 Compile    hugetlb.c        192.168.0.3[3]</pre>
 
22091 Compile    hugetlb.c        192.168.0.3[3]</pre>
 +
 +
One can have this program run continuously by using watch or by appending a space followed by interger to the command which corresponds to the number of sec to wait for a repeat query:
 +
$ watch distccmon-text
 +
 +
$ distccmon-text 2
  
 
One can also simply tail {{Filename|/var/log/messages.log}} on daemon:
 
One can also simply tail {{Filename|/var/log/messages.log}} on daemon:

Revision as of 20:24, 24 June 2011


This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی


Summary help replacing me

distcc is a program that distributes source code among a number of distcc-servers. The distcc-daemon sends parts of the source code to the distcc-servers that compile the code and send back the result to the daemon. This way you can use many machines to compile one program and thus speed up the compilation process. The cool part is you can use it together with pacman/srcpac.

Related
TORQUE

Terms

Note: The terminology used by the software can be a bit counterintuitive in that "the daemon" is the master and "the server(s)" are the slave PC(s) in a distcc cluster.
distcc daemon
The PC or server that's running distcc to distribute the source code. The daemon itself will compile parts of the source code but will also send other parts to the hosts defined in DISTCC_HOSTS.
distcc server
The PC or server compiling the source code it gets from the daemon. When it's done compiling, it sends back the object code (i.e. compiled source code) to the daemon, which in turn sends back some more source code (if there's any left to compile).

Getting started

Install the distcc package from [community] on all PCs in the cluster:

# pacman -S distcc

For other distro's or even OS'es including Windows through using Cygwin, refer to the distcc docs.

Configuration

Both Daemon and Server(s)

Edit Template:Filename and modify the only uncommented line with the correct IP address or range of your daemon or of your entire subnet:

DISTCC_ARGS="--user nobody --allow 192.168.0.0/24"

Edit Template:Filename and add a line to allow distccd traffic:

distccd: 192.168.0.

Daemon Only

Edit Template:Filename in the following three sections:

  1. BUILDENV has distcc unbanged i.e. without exclamation point.
  2. Adjust the MAKEFLAGS variable to correspond to the number of
  3. Uncomment the DISTCC_HOSTS line and add the IP addresses of the servers (slaves) then a slash and the number of threads they are to use. The subsequent IP address/threads should be separated by a white space. This list is ordered from most powerful to least powerful (processing power).

Example using relevant lines:

BUILDENV=(distcc fakeroot color !ccache !check)
MAKEFLAGS="-j13"
DISTCC_HOSTS="192.168.0.2/5 192.168.0.3/3 192.168.0.4/3"

If users wish to use distcc through SSH, add an "@" symbol in front of the IP address in this section. If key-based auth is not setup on the systems, set the DISTCC_SSH variable to ignore checking for authenticated hosts, i.e. DISTCC_SSH="ssh -i"

Compile

Start the distcc daemon on every participating machine:

# rc.d start distccd

If having distccd run at boot up, add it to the DAEMONS array in Template:Filename.

Compile via makepkg as normal.

Monitoring Progress

Progress can be monitored via several methods.

  1. distccmon-text
  2. tailing log file

Invoke distccmon-text to check on compilation status:

$ distccmon-text
22286 Preprocess  probe_64.c        192.168.0.2[0]
22276 Compile     apic_noop.c       192.168.0.2[0]
22250 Compile     kfifo.c           192.168.0.2[0]
22256 Compile     blk-core.c        192.168.0.2[1]
22195 Compile     block_dev.c       192.168.0.3[1]
22263 Compile     compat.c          192.168.0.3[2]
22091 Compile     hugetlb.c         192.168.0.3[3]

One can have this program run continuously by using watch or by appending a space followed by interger to the command which corresponds to the number of sec to wait for a repeat query:

$ watch distccmon-text
$ distccmon-text 2

One can also simply tail Template:Filename on daemon:

# tail -f /var/log/messages.log

Tips/Tricks

Limit HDD/SDD usage

Relocate ~/.distcc

By default, distcc creates a $HOME/.distcc which stores transient relevant info as it serves up work for nodes to compile. Create a directory named .distcc in RAM such as /dev/shm and soft link to it in $HOME. This will avoid needless HDD read/writes and is particularly important for SSDs.

$ mv ~/.distcc /dev/shm
$ ln -s ~/.distcc /dev/shm/.distcc

One only needs to have Template:Filename re-create this directory on a reboot (the soft link will remain until it is manually removed like any other file):

su -c "mkdir /dev/shm/.distcc" USERNAME

Adjust log level

By default, distcc will log to Template:Filename as it goes along. One trick (actually recommended in the distccd manpage) is to log to an alternative file directly. Again, one can locate this in RAM via /dev/shm. Another trick is to lower to log level of minimum severity of error that will be included in the log file. Useful if only wanting to see error messages rather than an entry for each connection. LEVEL can be any of the standard syslog levels, and in particular critical, error, warning, notice, info, or debug.

Both of these lines are to be appended to DISTCC_ARGS in Template:Filename

DISTCC_ARGS="--user nobody --allow 192.168.0.0/24 --log-level error --log-file /dev/shm/distccd.log"