Roland's homepage

My random knot in the Web

Writing speed on FreeBSD 8.1-RELEASE amd64

Recently the question came up how fast the write speed of a disk drive on FreeBSD should be. I decided to test the hardware that I have at my disposal, which is a desktop machine and a laptop.

The test is writing approximately 10 GB data from /dev/zero to /tmp/foo;

dd if=/dev/zero of=/tmp/foo bs=10M count=1000

The tests are done on otherwise idle machines. In both cases, the partition layout is similar.

Desktop

Characteristic Value
Operating System: FreeBSD 8.1-RELEASE amd64
CPU: Intel(R) Core(TM)2 Quad CPU Q9300 @ 2.50GHz
Chipset: ICH7
Controller: atapci0: Intel ICH7 UDMA100 controller

Partition layout:

/dev/ad4s1a        484M    102M    343M    23%    /
/dev/ad4s1g.eli    373G    140G    204G    41%    /home
/dev/ad4s1e         48G     38K     45G     0%    /tmp
/dev/ad4s1f         19G    6.4G     11G    36%    /usr
/dev/ad4s1d        1.9G    254M    1.5G    14%    /var

Write caching enabled

Output of atacontrol cap ad4:

Protocol              SATA revision 2.x
device model          WDC WD5001ABYS-01YNA0
serial number         WD-WCAS87154115
firmware revision     59.01D01
cylinders             16383
heads                 16
sectors/track         63
lba supported         268435455 sectors
lba48 supported       976773168 sectors
dma supported
overlap not supported

Feature                      Support  Enable    Value           Vendor
write cache                    yes      yes
read ahead                     yes      yes
Native Command Queuing (NCQ)   yes       -      31/0x1F
Tagged Command Queuing (TCQ)   no       no      31/0x1F
SMART                          yes      yes
microcode download             yes      yes
security                       yes      no
power management               yes      yes
advanced power management      no       no      0/0x00
automatic acoustic management  yes      yes     254/0xFE        128/0x80

Test results;

10485760000 bytes transferred in 138.304953 secs (75816229 bytes/sec)
10485760000 bytes transferred in 139.125501 secs (75369073 bytes/sec)
10485760000 bytes transferred in 136.149871 secs (77016305 bytes/sec)

Write caching disabled

The write caching was disabled by putting hw.ata.wc="0" in /boot/loader.conf and rebooting the machine.

Protocol              SATA revision 2.x
device model          WDC WD5001ABYS-01YNA0
serial number         WD-WCAS87154115
...
Feature                      Support  Enable    Value           Vendor
write cache                    yes      no

Test results;

10485760000 bytes transferred in 811.677303 secs (12918632 bytes/sec)
10485760000 bytes transferred in 811.628748 secs (12919404 bytes/sec)

Laptop

Characteristic Value
Operating System: CPU: Chipset: Controller: FreeBSD 8.1-RELEASE amd64 Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz ICH9M ahci0: Intel ICH9M AHCI SATA controller

Partition layout;

/dev/ada0s1a        496M     99M    357M    22%    /
/dev/ada0s1g.eli    240G     91G    130G    41%    /home
/dev/ada0s1e         19G     10K     18G     0%    /tmp
/dev/ada0s1f         19G    4.6G     13G    26%    /usr
/dev/ada0s1d        1.9G     35M    1.7G     2%    /var

Output of camcontrol identify ada0:

pass0: <ST9320423AS 0002SDM1> ATA-8 SATA 2.x device
pass0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 8192bytes)

protocol              ATA/ATAPI-8 SATA 2.x
device model          ST9320423AS
firmware revision     0002SDM1
serial number         5VH0322Y
WWN                   5000c50017f4f8d9
cylinders             16383
heads                 16
sectors/track         63
sector size           logical 512, physical 512, offset 0
LBA supported         268435455 sectors
LBA48 supported       625142448 sectors
PIO supported         PIO4
DMA supported         WDMA2 UDMA6
media RPM             7200

Feature                      Support  Enable    Value           Vendor
read ahead                     yes      yes
write cache                    yes      yes
flush cache                    yes      yes
overlap                        no
Tagged Command Queuing (TCQ)   no       no
Native Command Queuing (NCQ)   yes              32 tags
SMART                          yes      yes
microcode download             yes      yes
security                       yes      no
power management               yes      yes
advanced power management      yes      yes     32896/0x8080
automatic acoustic management  yes      yes     208/0xD0        208/0xD0
media status notification      no       no
power-up in Standby            no       no
write-read-verify              yes      no      0/0x0
unload                         yes      yes
free-fall                      no       no
data set management (TRIM)     no

Test results;

10485760000 bytes transferred in 122.625997 secs (85510090 bytes/sec)
10485760000 bytes transferred in 126.081170 secs (83166741 bytes/sec)
10485760000 bytes transferred in 126.101845 secs (83153105 bytes/sec)

Conclusion

The effect of disabling the write cache is quite big. Sustained writes go from 75 MiB/s to 13 MiB/s on the desktop.