# New FreeBSD install unexpectedly slow



## rodarmor (Nov 7, 2012)

Hi everyone,

Slowly but steadily, the number of boxes I own with FreeBSD installed on them is going up 

I have an HP Mini 110-1020LA with FreeBSD that I've been using for a home server for about a year or so. Recently, I bought a Fit-PC2i as a fanless, more portable replacement. Strangely enough though, performance on the new box has been much worse, which is especially surprising considering they have very similar specs, with the HP even being slightly worse. I've been using the compile times the latest version of tarsnap (http://www.tarsnap.com) as a sort of impromptu benchmark. The time results are here, and they are consistent across runs:

Fit-PC: make  105.39s user 13.45s system 99% cpu 1:59.34 total
HP: make  55.95s user 5.76s system 99% cpu 1:01.93 total

As you can see, the Fit-PC takes about twice as long to compile the same thing. Kind of annoying. The system is also markedly slower just launching things like vim.

The only significant differences between the systems are that the Fit-PC has twice as much RAM (2G vs 1G), a much faster CPU (2GHZ vs 1.6GHZ), and is running ZFS as the root filesystem.

In an effort to control for possible effect of ZFS on root, I booted the Fit-PC with the livecd, fetched the tarsnap tarball into tmp, and built there, the time was almost exactly the same. I also tried with swap off (on zfs on the Fit-PC), with swap back on but without checksumming, and with copies=1 on the FitPC, just for paranoia's sake, but no dice.

Here are some details about the systems:


```
Both:
 running FreeBSD 9.0-RELEASE-p3
 intel atom CPUs, very similar specs, 32bit, 533mhz memory
 hosting a zfs filesystem (root on the Fit-PC)
 show < 2-3% cpu load on top while idle
```


```
-= HP Mini 110-1020LA =-

# cpu frequency via sysctl dev.cpu
dev.cpu.0.freq: 1600 (maximum)

# Memory statistics from top:
Mem: 53M Active, 540M Inact, 255M Wired, 20M Cache, 110M Buf, 112M Free
Swap: 4096M Total, 4096M Free

# transfer rate of sudo dd if=/dev/zero of=/zero count=1000 bs=1m
63 megabytes/s
```


```
-= Fit-PC2i =-

# cpu frequency via sysctl dev.cpu
dev.cpu.0.freq: 1995 (maximum)

# Memory statistics from top:
Mem: 24M Active, 3540K Inact, 73M Wired, 792K Cache, 1880M Free
Swap: 4096M Total, 4096M Free

# transfer rate of sudo dd if=/dev/zero of=/zero count=1000 bs=1m
54 megabytes/s
```

(I include the cpu frequencies because I actually had an issue with the FitPC being stuck at less than its maximum. Enabling powerd fixed that, but had a minimal impact on the compile. It was actually a bit worse before enabling powerd.)

Are there any issues that I might not have thought of that would account for the difference? Things like bios settings, weird hardware differences, ZFS tunables, driver versions, etc.

Thanks for reading, and any help is greatly appreciated!

Best,
Casey


----------



## rodarmor (Nov 7, 2012)

Also, just because it seemed to help in another similar case:

https://forums.freebsd.org/showthread.php?t=32475

I added my own hostname to the localhost line in /etc/hosts, and also changed to different nameservers, as the Fit-PC was resolving against google dns, which made no difference.


----------



## wblock@ (Nov 7, 2012)

What CPU does the FitPC have?  It can come with either a Z530 that is about the same as the HP's N270, or a Z510, which is about 33% slower.  Actually, the frequency would seem to indicate a Z550.


----------



## rodarmor (Nov 7, 2012)

That's correct, the Fit-PC has a Z550. Here's the listing for the revision I bought:
http://www.amazon.com/dp/B004KV2IB4/ref=pe_175190_21431760_M3T1_SC_dp_2

Are there any FreeBSD side CPU settings that might be off, aside from CPU frequency? Here is the full output of sysctl dev.cpu:


```
FIT-PC $ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 1995
dev.cpu.0.freq_levels: 1995/-1 1745/-1 1496/-1 1246/-1 997/-1 748/-1 498/-1 249/-1
dev.cpu.0.cx_supported: C1/0
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% last 302us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/0
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% last 3039us
```


```
HP $ sysctl dev.cpu
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.P001
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 1600
dev.cpu.0.freq_levels: 1600/25000 1400/21875 1333/18000 1166/15750 1067/11000 933/9625 800/5000 700/4375 600/3750 500/3125 400/2500 300/1875 200/1250 100/625
dev.cpu.0.cx_supported: C1/1 C2/1 C3/17 C4/57
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% 0.00% last 180us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.P002
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/1 C3/17 C4/57
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% 0.00% last 347us
```


----------



## wblock@ (Nov 7, 2012)

The freq_levels values on the Fit look wrong, note the -1 and "C1/0".  That could be buggy ACPI.


----------



## rodarmor (Nov 8, 2012)

It looks like that was it. I had disabled C-states in the BIOS for some reason, so I guess powerd wasn't able to properly scale the cpu speed, and it was stuck on something less than idea. After the fix, "sysctl dev.cpu" shows:


```
dev.cpu.0.%desc: ACPI CPU
dev.cpu.0.%driver: cpu
dev.cpu.0.%location: handle=\_PR_.CPU0
dev.cpu.0.%pnpinfo: _HID=none _UID=0
dev.cpu.0.%parent: acpi0
dev.cpu.0.freq: 600
dev.cpu.0.freq_levels: 2000/35000 1750/30625 1600/28000 1400/24500 1333/24000 1166/21000 1067/20000 933/17500 800/16000 700/14000 600/12000 500/10000 400/8000 300/6000 200/4000 100/2000
dev.cpu.0.cx_supported: C1/1 C2/20 C3/100 C4/140
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% 0.00% last 308us
dev.cpu.1.%desc: ACPI CPU
dev.cpu.1.%driver: cpu
dev.cpu.1.%location: handle=\_PR_.CPU1
dev.cpu.1.%pnpinfo: _HID=none _UID=0
dev.cpu.1.%parent: acpi0
dev.cpu.1.cx_supported: C1/1 C2/20 C3/100 C4/140
dev.cpu.1.cx_lowest: C1
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% 0.00% last 4162us
```

And the make ran at 44s, half the time that it took before.

Awesome! Thanks for pointing me in the right direction


----------



## wblock@ (Nov 8, 2012)

And that's 20% faster than the HP, right where the relative processor speeds predict.  Good deal!


----------



## rodarmor (Nov 8, 2012)

It's magic when reality meets expectations  And just in case someone eventually has the same problem, the BIOS setting you want, under CPU SETTINGS, is:

Processor full speed: Enabled

Seems kind of obvious in retrospect, but I was thinking it might be some kind of proprietary cpu scaling thing that could potentially not be supported under FreeBSD.


----------

