# AHCI vs IDE performance

## SeaTiger

I recently build a new gentoo machine with a ASUS P5E motherboard and wanted to take advantage of the high speed sata2. However, I got worse result using AHCI than IDE configuration(BIOS configuration). following is my test result:

With BIOS setting SATA drive as IDE:

```
#hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   9000 MB in  2.00 seconds = 4504.91 MB/sec

 Timing buffered disk reads:  320 MB in  3.00 seconds = 106.52 MB/sec

```

With BIOS setting SATA drive as AHCI:

```
#hdparm -tT /dev/sda

/dev/sda:

 Timing cached reads:   7676 MB in  2.00 seconds = 3841.70 MB/sec

 Timing buffered disk reads:  140 MB in  3.02 seconds =  46.43 MB/sec
```

HD Parameter:

```
#hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media

   Model Number:       ST3500820AS                             

   Serial Number:      9QM04NB0

   Firmware Revision:  SD04    

Standards:

   Supported: 7 6 5 4 

   Likely used: 8

Configuration:

   Logical      max   current

   cylinders   16383   16383

   heads      16   16

   sectors/track   63   63

   --

   CHS current addressable sectors:   16514064

   LBA    user addressable sectors:  268435455

   LBA48  user addressable sectors:  976771055

   device size with M = 1024*1024:      476938 MBytes

   device size with M = 1000*1000:      500106 MBytes (500 GB)

Capabilities:

   LBA, IORDY(can be disabled)

   Queue depth: 32

   Standby timer values: spec'd by Standard, no device specific minimum

   R/W multiple sector transfer: Max = 16   Current = 16

   Recommended acoustic management value: 254, current value: 0

   DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 

        Cycle time: min=120ns recommended=120ns

   PIO: pio0 pio1 pio2 pio3 pio4 

        Cycle time: no flow control=120ns  IORDY flow control=120ns

Commands/features:

   Enabled   Supported:

      *   SMART feature set

          Security Mode feature set

      *   Power Management feature set

      *   Write cache

      *   Look-ahead

      *   Host Protected Area feature set

      *   WRITE_BUFFER command

      *   READ_BUFFER command

      *   DOWNLOAD_MICROCODE

          SET_MAX security extension

      *   48-bit Address feature set

      *   Device Configuration Overlay feature set

      *   Mandatory FLUSH_CACHE

      *   FLUSH_CACHE_EXT

      *   SMART error logging

      *   SMART self-test

          General Purpose Logging feature set

      *   64-bit World wide name

      *   Write-Read-Verify feature set

      *   WRITE_UNCORRECTABLE_EXT command

      *   SATA-I signaling speed (1.5Gb/s)

      *   SATA-II signaling speed (3.0Gb/s)

      *   Native Command Queueing (NCQ)

      *   Phy event counters

      *   Software settings preservation

      *   SMART Command Transport (SCT) feature set

      *   SCT Long Sector Access (AC1)

      *   SCT Error Recovery Control (AC3)

      *   SCT Features Control (AC4)

      *   SCT Data Tables (AC5)

Security: 

   Master password revision code = 65534

      supported

   not   enabled

   not   locked

      frozen

   not   expired: security count

      supported: enhanced erase

Logical Unit WWN Device Identifier: 5000c50027fad50

   NAA      : 5

   IEEE OUI   : c50

   Unique ID   : 027fad50

Checksum: correct

```

Anyone has any idea why is this happening?

----------

## NeddySeagoon

junksiu,

I don't believe either set of numbers.

The cached read speed is down to the DMA engine and bus bandwidth, which is not changed by changing from emulated IDE to AHCI mode.

The buffered disk reads is a measure of how fast you can get data from the drive platter. 106.52 MB/sec is very high for a single drive unless its something with a 15,000 RPM spindle speed and 46.43 MB/sec is low.

I suspect your 106.52 MB/sec figure was generated by some caching going on in main RAM somewhere and the 46.43 MB/sec is low because some other activity was in progress when you tested.

hdparm -tT is a pretty poor drive speed test - try bonnie.

----------

## SeaTiger

Both set of number is from hdparm, if any caching is going on, then it is done by kernel or on drive cache.

The drive is SATA2 which suppose to do 3Gb/s (burst, I guess)

I will try bonnie tonight again and see the number.

----------

## SeaTiger

Following is the result of bonnie. I combined the the 2 test result and aligned the spacing for easy comparison.

```
              -------Sequential Output--------     ---Sequential Input--     --Random--

              -Per Char-   --Block---  -Rewrite-- -Per Char-    --Block---   --Seeks---

Machine    MB K/sec  %CPU  K/sec %CPU  K/sec %CPU K/sec  %CPU   K/sec  %CPU     /sec  %CPU

AHCI      100 63379 100.1 223568 37.1 115113 15.4 69816 100.0 2484170  97.0  89102.7 118.8

IDE       100 62395  99.9 146730 26.3 106936 13.6 69943  99.9 2559104 100.0 177572.6 162.8
```

I am not sure if they are normal or not.

----------

## NeddySeagoon

junksiu,

Your tests show that there is little to choose between the two BIOS interface setups which surprises me. In Linux at least, operating in IDE mode often causes the system to drop back to PIO modes, thats not happening here.

The oddball test result, Random Seeks, make well be caused by Native Command Queuing (NCQ) being used in AHCI mode, which an IDE driver will not attempt. This reorders seeks to minimise head movement, which has the effect of slowing down some an speeding up others. Bonnie cannot control, nor measure the effects of NCQ but it improves latency. You would see the effects in random reads and random writes.

I judge that AHCI is slightly ahead overall.

----------

