Tag Archive for 'hard drive'

Optimize hard disk performance in Linux; benchmarks on Slicehost

A three-pronged attack on performance” is a good read on improving performance in Linux. One performance enhancing setting is the hard disk’s readahead value. Unfortunately, there is no magical readahead value that will optimize your hard disk’s performance; you must run your own benchmarks. I used the following code to benchmark disk performance (12 times) at each readahead value on my 256MB Slicehost VPS.

for ((i=0;i<12;i++)); do sudo hdparm -t /dev/sda1; done

The average disk read speeds at each readahead value are as follows:

“hdparm -a128 /dev/sda1″ - 65.69 mb/sec
“hdparm -a256 /dev/sda1″ - 104.44 mb/sec
“hdparm -a512 /dev/sda1″ - 114.54 mb/sec
“hdparm -a1024 /dev/sda1″ - 119.39 mb/sec
“hdparm -a2048 /dev/sda1″ - 122.82 mb/sec

It appears that on my Slicehost VPS, “hdparm -a2048” yields the best performance. To ensure that this readahead value is used at all times, I instruct hdparm to set it on every bootup by adding the following line to /etc/conf.d/local.start

hdparm -a2048 /dev/sda1

More details and documentation on Slicehost’s Wiki.

If you liked this post, please subscribe to my feed. Thanks for visiting!