Fedora

Comparing different Unix distributions performance

Introduction

This is an ongoing set of benchmarks against various Unix (Linux, Solaris, MacoSX etc.) distributions, trying to get a feel for how they compare on CPU performance. This is by no means a complete test, I'm only running a few benchmarks on each distribution, and I'm primarily only looking at raw CPU performance. Also, in order to make this reasonably easy for me to handle, all tests are done inside a VirtualBox virtual machine, and only one CPU is ever used (meaning, the tests don't show how well the Unix flavor manages SMP.


Setup

The test system is a Linux FC9 box, with a Core2 6600 CPU running at 2.40GHz, with 4MB of cache. Each Unix distribution is installed in a VirtualBox (v2.10) virtual host, with 512MB of RAM (plenty for all tests). All Linux distributions were updated with all the latest patches available at the time of the test, running whatever kernel, compilers and libraries available at the time.


Benchmarks

Each benchmark is run three times on each distribution, and the best result is picked from each test. Currently the only benchmark I run is the ByteMark, called nbench. The source for this is available at http://www.tux.org/~mayer/linux/bmark.html . As mentioned before, this not only benchmarks the kernel, it also exercises the compiler suite, and supporting libraries (e.g. glibc). But then again, someone picking a distribution probably wants to see the "whole picture", right?


Next steps (and caveats)

I'm planning on running lmbench on these machines as soon as possible, to see if those numbers shows any more significant differences. I'm also planning on adding benchmark results for SUSE, which is a popular Linux distribution. Unfortunately I can't test MacOSX on this hardware, since I can't install it under VirtualBox. In particular, lmbench would probably be more useful without Virtualization, for testing how well the system behaves on things like disk I/O, network and SMP scalability.

With time permitting, and if/when I can free up the hardware, I think it'd be useful to do these benchmarks without virtualization involved. It's unclear today what impact VirtualBox has on these benchmarks (but, I'm hoping it's relatively fair across all the distributions). When Michelle lets me upgrade my desktop, I'll use the old system for rerunning these tests.

Fedora and debuginfo

A while ago, I wrote about installing System Tap on my Fedora box, which requires some debuginfo packages. I mumbled something about what yum commands to use, here. As it turns out, this is a common enough task to do that there's a special Python Yum application for it, debuginfo-install. For example:

# debuginfo-install gcc.i386 glibc.i686

Neat!

Fedora Core and SystemTap

I wanted to get SystemTap to run on my Fedora Core 6 box, and had problems getting it running. The README says to install the kernel-debuginfo, which I had problems getting going. It turns out I was just being stupid, and didn't run yum properly. All I really had to do was:

% sudo yum install systemtap
% sudo yum --enablerepo=core-debuginfo --enablerepo=updates-debuginfo  install kernel-debuginfo

More information about System Tap is available here.

Fedora Core, X11 and TCP port 6000

So, at some point, my X11 server in FC stopped accepting connection on the "default" TCP port, 6000. This wasn't a big deal until I started running another Linux distro in a VMWare VM (thanks VMWare for giving out free "enthusiasts" licenses a while ago!). Anywho, I did some poking around, and realized that gdm has changed it's default setting for listening on the TCP port.

I quickly edited /etc/gdm/custom.conf, and changed

DisallowTCP=false

After restarting gdm (and X11 obviously), everything is working fine again.

Fedora development and yum-utils

On my system at home, I run the latest Fedora development packages, which has both pros and cons. For instance, I'm pretty always up to date with all the tools I use, all automatically. However, it can be a pain sometimes to get yum to update properly, and a few times major breakage happens :-).

A while ago, I realized that there's a package availabe, called yum-utils, which provides quite a few useful tools, in particular, there's now a new repoquery tool. This can be used similar to the old rpm --fedoraprovides syntax, as well as many other uses. For instance

root@thor 426/0 # repoquery --whatprovides python
python-0:2.4.2-2.i386
root@thor 427/0 # repoquery --whatrequires python
plone-0:2.1.1-1.fc5.i386
mach-0:0.4.8-1.fc5.i386
system-config-lvm-0:1.0.8-1.0.noarch
rhn-applet-0:2.1.17-4.i386
plone-0:2.0.5-3.noarch
.
.
.

To install yum-utils (if not already installed, and you have yum properly configured for the development repo), all you do is

root@thor 428/0 # yum install yum-utils

Oh, and while I remember it, the old rpmdb-fedora DB package shouldn't be needed any more, I simply uninstalled it with

root@thor 329/0 # rpm -e rpmdb-fedora

Fedora Core "devel" packages and yum

I try to keep my system up to date using the Fedora "devel" packages, using the yum updater. Sometimes I would get errors like

unsigned package //var/cache/yum/development/packages/glibc-2.3.4-3.i686.rpm
unsigned package //var/cache/yum/development/packages/eog-2.8.1-1.i386.rpm
unsigned package //var/cache/yum/development/packages/pango-1.8.0-1.i386.rpm

The problem here is that not all development packages are signed, for whatever reason. Assuming you still trust Fedora, simply modify your yum configuration file (/etc/yum.repos.d/fedora-devel.repo in my case) to add a line like
gpgcheck=0

Not all (Fedora) kernels are created equal

Introduction

While working on some completely unrelated piece of code, I discovered what seemed to be the impossible: FreeBSD was much faster than my 2.6 Linux system on certain system calls. And it was quite noticeable, a magnitude or more. This clearly couldn't be right, so I ended up doing some tests and I wrote a blog entry on it. Well, this continue being an issue, so I decided to expand on the topic.


Test setup

The primary test system is a Pentium 4 2.8GHz with HT, so all kernels are built with SMP support. For comparison, I've run the same tests on a few other platforms, including FreeBSD. I don't claim any of these tests to be scientifically correct in any way, but something is definitely wrong here.


Benchmarks

I checked the same code on my older system, running a 2.4 kernel on an old Celeron CPU. To my satisfaction, it was indeed very fast, even faster than FreeBSD. I double checked my PIII machine running a 2.6.6 kernel, it was also reasonably fast.

So, why was my main Linux system so damn slow? Well, as it turns out, not all kernels are created (i.e. built) equal/ I did a number of benchmarks on my system, and discovered that pretty much all my pre-built kernels (from Fedora Core 2 "rawhide") were slow, but only on a Pentium-4 system. My custom built kernel was fast

The numbers below are clock cycles per system call (smaller is better):

Kernel gettimeofday() uname() chdir() open()
FreeBSD 4.x on P4
1591
29446
8977
2583
RedHat 2.4 on Celeron
461
592
1198
864
FC2 2.6.6 on PIII
1076
1286
2547
1425
FC2 2.6.3 i686 8k stack on P4
8373
1681
33115
29725
FC2 2.6.7 i686 4k stack on P4
8453
8680
41695
37885
FC3 2.6.9 i686 on P4
8720
9058
14154
9887
custom 2.6.7 8k stack on P4
890
1031
4601
1396
custom 2.6.7 4k stack on P4
828
1002
4295
1377
custom 2.6.9 on P4
814
990
4514
1315

My custom kernel configuration is "optimized" for my particular system, the configs are available here. The simple program that I used to benchmark this is available here. This code only works on x86 platforms.


Observations


First of all, this is obviously only a problem with P4 systems, so I did a bit research (but not a lot). Apperently P4 CPUs have a new instructions for handling system calls, SYSENTER, while older Pentium systems uses the 0x80 interupt. As far as I can tell, there's a new virtual system call layer that is supposed to handle this, called vsyscall. There's some info on this in this Kerneltrap.org article. I guess I assumed that vsyscall would handle all combinations of CPUs and builds, but maybe it's not?

"Solution"

The solution for me was to recompile the "stock" Linux kernel, based on the FC3 kernel configuration file. I did quite a few changes to the config, and I also didn't apply any of the RedHat/Fedora patches to the kernel source.

The latter is the key to the solution, after trying numerous configurations and options, I narrowed it down to the set of patches Fedora applies. Dave Jones kindly confirmed this, and pointed to the exact set of patches: exec-shield. If you kernel applies the same or a similar patch, you should definitely be aware of this problem.

I haven't yet found an easy way to build the Fedora kernel without just the exec-shield patches, but I'm still working on that. Unfortunately the patches co-depend on each other a bit, so it's not as simple as just leaving out the patch.

I've filed a bug against Fedora Core for this, see Bugzilla bug #139318.


Effects

Obviously system call performance isn't a huge factor on overall system performance, although I can see certain applications suffering more than others due to this problem. To get a somewhat interesting comparison, I did a compile of the kernel source on a "slow" kernel vs my custom built one. Here are the results, output is from the time command:

"Slow" kernel:

# time gmake
real    21m10.495s
user    19m0.013s
sys     3m6.801s

"Fast" kernel:
# time gmake
real    19m17.596s
user    17m55.808s
sys     1m51.115s

Upgrading RH9 to Fedora

I've been playing around with Fedora "development" packages on my RedHat 9 system lately. These packages are obviously unstable, but I've had pretty good results so far. I simply mirror the latest "devel" packages from the FTP mirrors, see the official Fedora site for more info.

I initially just installed a few core packages, to get the 2.6.1 kernel from Fedora/devel to run on my RH9 system. This was pretty easy, and worked very well. I don't remember exactly which packages I had to install, but at least:

  • kernel-smp-2.6.1, make sure you "rpm -i" this package to not lose your old kernel(s)
  • initscripts-7.44
  • nfs-utils-1.0.6
  • filesystem-2.2.3-1

(Pick the appropriate kernel for your system, SMP, architecture etc.)

I use the nVIDIA driveres on my machine, which now support 2.6.x kernels directly. However, since the Fedora/devel kernel was compiled with gcc-3.3, the nVidia installer failed during build. So, I also upgrade to new gcc builds, and then the graphic card drivers built fine.

I've since upgrade a majority of my old RH9 packages to Fedora/devel, with only minor problems. One problem that took me a while to figure out (since my gdm wouldn't start) was that somehow the file /etc/gtk-2.0/gdk-pixbuf.loaders was missing. In my previous installation, this was part of the gdk2 RPM (from Ximian). As it turns out, this file can easily be recreated with a simple command:

root@thor 301/0 # gdk-pixbuf-query-loaders  > /etc/gtk-2.0/gdk-pixbuf.loaders

Without this file, pretty much every Gnome application (including GDM) will fail, with errors like:

Can not open pixbuf loader module file '/etc/gtk-2.0/gdk-pixbuf.loaders'

Error loading PNG image loader: Image type 'png' is not supported