drive speed tests

From Noah.org
Jump to navigationJump to search


drive speed test results -- trivial benchmarks

Raw read and write speed may not the best benchmark, but it's a start. For USB Flash drives this is usually the benchmark that I care about the most since I usually use USB Flash drives for moving large files around.

write speed in MB/s read speed in MB/s drive name / model USB ID Notes
6.36 19.88 Pie Digital, Inc. PieKey 4GB 22a6:ffff This was from a Flash drive I worked on -- I set the PID! Pretty decent specs.
9.87 17.71 Pie Digital, Inc. PieKey 1GB early prototype 04fe:0006
98.11 189.85 SanDisk Extreme CZ80 USB 3.0 32GB 0781:5580 Super fast! test-drive-speed V2. It appears actually to be this fast. Serial Number: 03e9a18ef Firmware Revision: ER.24.00 Transport: Serial, ATA8-AST, SATA Rev 2.6, SATA Rev 3.0
38.88 81.37 Corsair Voyager Slider 32GB USB3 Model CMFSL3-32GB 1b1c:1a06
35.99 68.42 Kingston Technology 32GB USB3 0951:168e test-drive-speed V2
4.34 22.63 SanDisk Cruzer Fit 16GB 0781:5571 This USB flash drive is a tiny, little nub, hardly bigger than the USB plug itself.
4.20 22.62 SanDisk Cruzer Facet 8GB 0781:5576
4.01 18.10 SanDisk Cruzer 16GB SDCZ36-016G 0781:5530
4.32 18.67 Lexar Media 4GB 05dc:a768
4.01 15.45 Alcor Micro Corp. 2GB 058f:6387 This was from a free Jaguar car keyfob schwag. It was kind of crappy.
3.51 23.76 Transcend Information OCZ Diesel 4GB 1307:0165
5.42 23.24 SanDisk Cruzer Orbit 32GB 0781:557c
13.64 41.91 Kingston Technology 128GB 0951:1697 Tested USB3 device in a USB2 port.
16.24 152.78 Kingston Technology 128GB 0951:1697 Tested in USB3 port. Write speed was bad. At first I thought it I made a mistake, so I tested again against a USB3 drive known to be fast. The Kingston was still very slow.
10.27 17.50 OEM 2GB 13fe:1f00 Impressive write speed for a cheap USB2 drive.
6.64 15.58 Cisco Linksys Connect Easy Setup Key 1GB / NK2 13b1:002e
44.83 78.78 Seagate Momentus 7200.3 / ST9160411ASG Serial Number: 5TG0K2CB Firmware Revision: DE17
28.14 120.80 Transcend 2.5" SATA-2 SSD / TS64GSSD25S-M Serial Number: 002538030036 Firmware Revision: V090216
70.98 125.97 OCZ VERTEX-LE SATA-2 SSD Serial Number: f0409001b, Firmware Revision: 1.05
73.17 166.16 apocalypse.dreamhost.com Run on a shared hosting service. Drive specs unknown. Quite fast for a shared host.
115.82 534.99 Amazon EC2 184.72.242.0 Amazon EC2 West Coast server. Write speeds vary drastically. Average of 18 runs. Look at that read speed!
131.15 269.65 Amazon EC2 184.72.18.0 Amazon EC2 West Coast server. Write speeds vary drastically. Average of 9 runs.
53.00 106.97 Hitachi HTS545050A7E380 through SimpleTech USB3 4971:8013 Firmware Revision: GG2OA7A0
82.52 185.64 SanDisk Corp. Extreme USB 3.0 0781:5580 So this USB3 flash drive is faster than any of my main system disks in any of my laptops -- hard disk or SSD. This thing is faster than any SSD I have tested (granted, I haven't tested anything designed specifically for speed). But still, this is just a USB3 flash drive. I tested the speed on a few different machines. It seems real. Maybe I'll throw away my main SSD and just boot off this thing -- Note, that I actually suggested this as a design option for an embedded system for a company I once worked for. They all laughed at me, but it totally made sense. Speed was not a concern for us. It was all about cost. We could have reduced our BOM cost for storage by using commodity, cheap USB flash drives instead of the rather niche market, obscure micro-IDE interface at over 4 times the cost of a good USB flash drive of similar size. Plus we would have eliminated yet another costly connector on our PCB (and the board real estate it took) in exchange for another USB plug. Furthermore, this USB plug was linked to an existing USB with two ports to spare, so it didn't require any additional support hardware. Finally, those obscure micro-IDE connectors and drives were a pain in the ass. The connectors were fragile and the drives had quirky behavior. Come on, nobody bought these things, so they had no market at all and thus very little field testing and feedback from customers. I mean, I gave feedback to complain about the stupid things and the manufacturer was like, "Yeah... well, I'm sorry to hear that. That's too bad, but what are you gonna do? Performance ain't great, but they're the best in this market. Actually, you know, we might drop the entire product line next year. Do you want to buy the remaining stock?"... Meanwhile, in the development period of our product USB Flash drive prices had dropped by half and speeds and density were better than our IDE SSD -- and that was over USB2 through a shared HUB (yeah, those IDE SSDs really sucked). Next time something like this comes up I have to approach the problem differently and present it in a way my audience can understand.
WRITE READ NAME USBID COMMENTS

Do not mount with sync option

The first test run shows that write performance is over 12 times slower when the drive is mounted with the sync option versus the second test without the sync option. The other options have little effect. These tests were run on a USB flash drive.

first test

/dev/sdb1 on /media/usb0 type vfat (rw,noexec,nodev,sync,noatime,nodiratime)

Running test three times...
test 1: write:    0.34 MB/s, read:    18.67 MB/s
test 2: write:    0.34 MB/s, read:    18.61 MB/s
test 3: write:    0.34 MB/s, read:    18.29 MB/s

second test

/dev/sdb1 on /media/usb0 type vfat (rw)

Running test three times...
test 1: write:    4.32 MB/s, read:    18.51 MB/s
test 2: write:    4.32 MB/s, read:    18.51 MB/s
test 3: write:    4.31 MB/s, read:    18.46 MB/s

trivial benchmark tool

You can use `dd` to measure sustained drive throughput if you do it right. You want to bypass any cache and buffering in the I/O path. This is not hard, but it is uncommon enough that it can be difficult to find documentation on the correct options to use.

It is unclear if this will also bypass RAID controller cache. It almost certainly will not bypass the cache on the drive itself. You would need to activate additional option via `hdparm` if your drive offers them. I considered this a little too invasive and I wasn't sure if the options would be the same for every drive. Plus I figured that the drive controller cache is not really an optional component of the drive, so there is no reason to take it out of the equation; although, it does make it more difficult to interpret read-speed tests.

the most trivial drive benchmark tool

alias test-drive-speed='dd if=/dev/zero of=test_data.bin oflag=dsync conv=fdatasync  bs=8388608 count=16 2>&1 | grep "bytes" | cut -f1,6 -d" " | awk '\''{printf ("write-speed: %7.2f MB/s, ", $1 / $2 / (1024*1024))}'\'' && dd if=test_data.bin iflag=direct conv=fdatasync of=/dev/null bs=8388608 count=16 2>&1 | grep "copied" | cut -f1,6 -d" " | awk '\''{printf ("read-speed:  %7.2f MB/s\n", $1 / $2 / (1024*1024))}'\'''

slightly less trivial benchmark tool

#!/bin/bash
#
# test-drive-speed
#
# DESCRIPTION
#
#     This performs a very simple drive speed test. It measures sustained
#     write and read speed to a 256 MB file.
#
# AUTHOR
#
#     Noah Spurrier <noah@noah.org>
#
# LICENSE
#
#     This license is OSI and FSF approved as GPL-compatible.
#     This license identical to the ISC License and is registered with and
#     approved by the Open Source Initiative. For more information vist:
#         http://opensource.org/licenses/isc-license.txt
#
#     Copyright (c) 2013, Noah Spurrier <noah@noah.org>
#
#     Permission to use, copy, modify, and/or distribute this software for any
#     purpose with or without fee is hereby granted, provided that the above
#     copyright notice and this permission notice appear in all copies.
#
#     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
#     WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
#     MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#     ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
#     WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
#     ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
#     OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# VERSION
#
#     Version 2
#

# For a 128 MB file use BLOCK_COUNT=16 and BLOCK_SIZE=8388608.
# For a 256 MB file use BLOCK_COUNT=32 and BLOCK_SIZE=8388608.
BLOCK_COUNT=32
BLOCK_SIZE=8388608
OUTPUT_FILE="junk.bin"

if [ -d /dev/shm ]; then
    echo "= Create source data file in /dev/shm/random.bin ="
    SOURCE_DATA=/dev/shm/random.bin
    rm -f ${SOURCE_DATA}
    dd if=/dev/urandom of=${SOURCE_DATA} bs=${BLOCK_SIZE} count=${BLOCK_COUNT}
else
    echo "= WARNING: Using /dev/zero for data. Results may skewed fast. ="
    SOURCE_DATA=/dev/zero
fi

sync
echo "uptime: $(uptime)"
PWD=$(pwd)
echo "current directory: ${PWD}"
CURRENT_DEV=$(df -hT $(pwd) \
 | sed -n -e 's/^\(\/dev\/[^[:space:]]\+\).*/\1/p')

if [ "${CURRENT_DEV}" = "" ]; then
    echo "WARNING: Did not find device associated with current directory."
else
    echo "mount device: ${CURRENT_DEV}"
    echo "drive mount options: $(grep ${CURRENT_DEV} /etc/mtab)"
    if grep ${CURRENT_DEV} /etc/mtab | grep -iq sync; then
        echo "    WARNING: sync option will effect write speed tests."
    fi
    if echo ${CURRENT_DEV} | grep -q /dev/md; then
        echo "    This device is a sofware RAID configured as follows:"
        echo -en "        "
        egrep 'md[0-9]+' /proc/mdstat
        CURRENT_DEV=$(egrep 'md[0-9]+' /proc/mdstat \
            |sed -n -e 's/.*[[:space:]]\([a-z]*[0-9]*\)\[.\]$/\1/p')
        CURRENT_DEV="/dev/${CURRENT_DEV}"
        echo "    Drive info will be taken from last device in the array."
    fi
    # Try `hdparm` otherwise try `lsusb`.
    if ! DRIVE_INFO=$(hdparm -I ${CURRENT_DEV} | sed -n -e '/^$/d' \
        -e '0,/Standards:/p' | sed -n -e '$!p'); then
    DRIVE_INFO=$(lsusb)
fi
DRIVE_INFO=$(echo ${DRIVE_INFO})
echo "drive info: ${DRIVE_INFO}"
fi

echo
echo "Running test three times..."

for n in 1 2 3; do
    echo -n "test ${n}: "
    sync
    dd if=${SOURCE_DATA} of=${OUTPUT_FILE} oflag=dsync conv=fdatasync \
        bs=${BLOCK_SIZE} count=${BLOCK_COUNT} 2>&1|grep "copied"|cut -f1,6 -d" " \
        |awk '{printf("write: %7.2f MB/s, ",$1/$2/(1024*1024))}'
    sync
    if [ ! -e /dev/zero ]; then
        rm ${SOURCE_DATA}
    fi
    dd if=${OUTPUT_FILE} iflag=direct conv=fdatasync of=${SOURCE_DATA} \
        bs=${BLOCK_SIZE} count=${BLOCK_COUNT} 2>&1|grep "copied"|cut -f1,6 -d" " \
        |awk '{printf("read:  %7.2f MB/s\n",$1/$2/(1024*1024))}'
    rm junk.bin
done

if [ -e /dev/shm/random.bin ]; then
    rm ${SOURCE_DATA}
fi

# vim:set ft=sh sr et ts=4 sw=4: // See Vim, :help 'modeline'

Online guides

http://www.harddrivebenchmark.net/