Distcc, A Program You Should Know About

As someone who is always looking to maximize performance and efficiency from my computers, I was delighted to have stumbled upon a program named Distcc a while back. According to their website distcc is a “fast, free distributed c/c++ compiler.”Distcc is brought to you by the same people who created and maintain Samba, the open-source program that allows Unix-like operating systems to act as Windows file and print servers. Distcc is small, simple to use, and works on a variety of Operating Systems. Distcc can speed up compilations in a near linear fashion. For example, tripling the number of computers in the build will nearly triple the speed of the build. It even includes a Gnome-based graphical monitor that will show you which file is being compiled on which machine. I will take the remainder of this article to cover installation and some basic uses of this amazing free software.

DistCC


Installation and Configuration

Distcc provides binaries as well as source code for many available versions of Unix and Linux. Binaries are provide in RPM and DEB format for easy installation for both Redhat and Debian based systems. Installation from source code is simple as well with the traditional ./configure, make, and make install commands. Each server machine will need to run the distcc daemon. Typing the command distccd is all that needs to be done. Each client machine will need to know the names of the servers. This is done by exporting the environment variable DISTCC_HOSTS. This can be done by typing export DISTCC_HOSTS=”localhost server1 server2 server3′ at a terminal prompt. This can be made permanent by placing the same line in a file that is read at startup (/etc/profile or .bashrc for example).

Performance

To test the performance of distcc, I decided to compile two of the most popular open-source projects. The first and most important is the Linux kernel itself. The second is Wine, the open-source project that allows some windows applications to be run on Linux. All compilations were done in run level 3 (network services running without a graphical user interface). I timed all the results by preceding the compilation commands with the time command. The number reported is the real time between invocation and termination of the compile. The test machines were both running RedHat Linux 9.0. One machine was a 900MHz AMD Duron with a 5400RPM hard drive and 256Mb RAM. The other was a 1.2GHz Duron with a 7200RPM hard drive and 256Mb of RAM.

To test the compilation of the Linux kernel, I first downloaded kernel 2.4.22 from kernel.org. I then unpacked the archived and ran through a standard configuration for my system. I then ran make BzImage without using distcc and timed the results:

9 minutes, 29.110 seconds

Next, I removed the kernel directory and rebooted the system. I then unpacked the archive once again and configured the kernel with the same options. This time I compiled the kernel with make -j8 bzImage CC=distcc. The results were impressive:

3 minutes 44.11 seconds

Using distcc gave a 61% performance increase. Let’s see what it can do for Wine.

I downloaded Wine-20031016.tar.gz from the download section of winehq.org. I unpacked the archive, ran the configure script, and then the make command. The results without distcc:

32 minutes 15.580 seconds

I once again removed the archive and rebooted the system. I unpacked the archive and issued the command make -j8 CC=distcc. Once again the results were impressive:

11 minutes 57.344 seconds

This time we see 63% improvement in performance.

Conclusion

Distcc is one of those little useful programs that you may have never heard about or explored. As you can see, it is a breeze to set up and can save a tremendous amount of time if you have a LAN and need to compile a program from source. With the emergence of source based distributions such as Gentoo, there has never been a better time to have a tool like Distcc at your disposal. More information can be found at distcc.samba.org.

About the Author
Paul Virijevich has been studying and learning open-source technologies including GNU/Linux since 1996.

34 Comments

  1. 2003-11-26 2:26 am
  2. 2003-11-26 2:56 am
  3. 2003-11-26 3:04 am
  4. 2003-11-26 3:09 am
  5. 2003-11-26 3:20 am
  6. 2003-11-26 3:43 am
  7. 2003-11-26 4:14 am
  8. 2003-11-26 5:43 am
  9. 2003-11-26 5:57 am
  10. 2003-11-26 6:13 am
  11. 2003-11-26 6:59 am
  12. 2003-11-26 7:54 am
  13. 2003-11-26 9:05 am
  14. 2003-11-26 9:25 am
  15. 2003-11-26 10:33 am
  16. 2003-11-26 10:51 am
  17. 2003-11-26 10:55 am
  18. 2003-11-26 11:06 am
  19. 2003-11-26 11:11 am
  20. 2003-11-26 12:02 pm
  21. 2003-11-26 1:43 pm
  22. 2003-11-26 2:03 pm
  23. 2003-11-26 2:15 pm
  24. 2003-11-26 2:25 pm
  25. 2003-11-26 2:34 pm
  26. 2003-11-26 2:53 pm
  27. 2003-11-26 3:08 pm
  28. 2003-11-26 3:36 pm
  29. 2003-11-26 5:00 pm
  30. 2003-11-26 7:49 pm
  31. 2003-11-27 12:43 am
  32. 2003-11-27 8:13 pm
  33. 2003-11-28 6:53 am
  34. 2003-12-03 7:47 pm