# AHCI SATA AHCI random access performance 1.5x boost in 8.0



## zuborg (Oct 22, 2009)

benchmarked by /usr/ports/benchmarks/raidtest

FreeBSD 7.1 gmirror patched (http://www.freebsd.org/cgi/query-pr.cgi?pr=113885)
atapci1: <Intel AHCI controller> port 0x1840-0x1847,0x1814-0x1817,0x1818-0x181f,0x1810-0x1813,0x1820-0x183f mem 0xdf500000-0xdf5003ff irq 19 at device 31.2 on pci0

```
ad4:
Number of processes: 1.  Bytes per second: 8708462      Requests per second: 133
Number of processes: 2.  Bytes per second: 8698291      Requests per second: 132
Number of processes: 5.  Bytes per second: 8791501      Requests per second: 134
Number of processes: 10.  Bytes per second: 8840052     Requests per second: 135
Number of processes: 20.  Bytes per second: 8942725     Requests per second: 136
Number of processes: 50.  Bytes per second: 9021465     Requests per second: 137
Number of processes: 100.  Bytes per second: 9080795    Requests per second: 138
Number of processes: 200.  Bytes per second: 9125459    Requests per second: 139
Number of processes: 500.  Bytes per second: 9142287    Requests per second: 139

gm0 (ad4,ad6,ad8,ad10):
Number of processes: 1.  Bytes per second: 8746213      Requests per second: 133
Number of processes: 2.  Bytes per second: 16563067     Requests per second: 253
Number of processes: 5.  Bytes per second: 27960155     Requests per second: 427
Number of processes: 10. Bytes per second: 32801220     Requests per second: 501
Number of processes: 20. Bytes per second: 33826945     Requests per second: 517
Number of processes: 50. Bytes per second: 35337642     Requests per second: 540
Number of processes: 100.  Bytes per second: 35175787   Requests per second: 537
Number of processes: 200.  Bytes per second: 33281248   Requests per second: 508
Number of processes: 500.  Bytes per second: 34200148   Requests per second: 522
```

FreeBSD 8.0-RC1
ahci0: <AHCI controller> port 0x1840-0x1847,0x1814-0x1817,0x1818-0x181f,0x1810-0x1813,0x1820-0x183f mem 0xdf500000-0xdf5003ff irq 19 at device 31.2 on pci0
ahci0: [ITHREAD]
ahci0: AHCI v1.10 with 6 3Gbps ports, Port Multiplier supported


```
ada0 (ad4):
Number of processes: 1.  Bytes per second: 8452955      Requests per second: 129
Number of processes: 2.  Bytes per second: 10020275     Requests per second: 153
Number of processes: 5.  Bytes per second: 12606027     Requests per second: 192
Number of processes: 10.  Bytes per second: 14038579    Requests per second: 214
Number of processes: 20.  Bytes per second: 14600856    Requests per second: 223
Number of processes: 50.  Bytes per second: 13430015    Requests per second: 205
Number of processes: 100.  Bytes per second: 13684512   Requests per second: 209
Number of processes: 200.  Bytes per second: 14657450   Requests per second: 224
Number of processes: 500.  Bytes per second: 14443617   Requests per second: 220

gm0 (ada0, ada1, ada2, ada3):
Number of processes: 1.  Bytes per second: 8698530      Requests per second: 132
Number of processes: 2.  Bytes per second: 16796085     Requests per second: 256
Number of processes: 5.  Bytes per second: 31180404     Requests per second: 476
Number of processes: 10.  Bytes per second: 40947618    Requests per second: 625
Number of processes: 20.  Bytes per second: 48925458    Requests per second: 747
Number of processes: 50.  Bytes per second: 56929077    Requests per second: 870
Number of processes: 100.  Bytes per second: 55048140   Requests per second: 841
Number of processes: 200.  Bytes per second: 57478504   Requests per second: 878
Number of processes: 500.  Bytes per second: 58590155   Requests per second: 895
```


```
# diskinfo -t /dev/ada0
/dev/ada0
        512             # sectorsize
        1000204886016   # mediasize in bytes (932G)
        1953525168      # mediasize in sectors
        1938021         # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        5QJ0AEM8        # Disk ident.

Seek times:
        Full stroke:      250 iter in   5.135019 sec =   20.540 msec
        Half stroke:      250 iter in   3.543993 sec =   14.176 msec
        Quarter stroke:   500 iter in   5.973815 sec =   11.948 msec
        Short forward:    400 iter in   1.937594 sec =    4.844 msec
        Short backward:   400 iter in   2.199856 sec =    5.500 msec
        Seq outer:       2048 iter in   0.200447 sec =    0.098 msec
        Seq inner:       2048 iter in   0.514109 sec =    0.251 msec
Transfer rates:
        outside:       102400 kbytes in   0.910613 sec =   112452 kbytes/sec
        middle:        102400 kbytes in   1.125141 sec =    91011 kbytes/sec
        inside:        102400 kbytes in   2.033038 sec =    50368 kbytes/sec
```


----------



## aragon (Dec 4, 2009)

I tried all this new ahci(4) and gmirror(8) stuff tonight and it really does make a difference for me.  I didn't run any benchmarks, but my workstation definitely feels faster.  I guess it's only noticeable after a fresh boot (nothing cached yet), but still, it's a very welcome improvement.

Upgrade to 8.0-STABLE as of now to get recent ahci(4) code, and then apply the latest gmirror load patch from Alexander Motin in the PR linked above.  Once you're recompiled, set your gmirror volume to the "load" balance algorithm if not already set, and add this to /etc/sysctl.conf:


```
vfs.read_max=32
```

(and reboot)

Thank you Alexander Motin and others!


----------



## aragon (Dec 6, 2009)

Well I just tried the new AHCI with an eSATA device.  What a pleasure to finally have hotplug support.  If you're running 8.0-STABLE, you really need to try this.


----------



## Carpetsmoker (Dec 6, 2009)

What drives are you using zuborg?

Here are my results:
http://www.daemonforums.org/showpost.php?p=25286&postcount=37

This is on FreeBSD 7.2 -- And it's much faster than your results, even with your 1.5x improvement...


----------

