Showing posts with label hardware. Show all posts
Showing posts with label hardware. Show all posts

Tuesday, September 8, 2009

Software RAID vs. LVM: Quick Speed Test

Table of Contents


Introduction

Currently, I have a fileserver that is setup this way:

Filesystem
      ^
Logical Volume Manager
      ^
Software RAID Arrays
      ^
Physical Disks

In my case, the LVM is an extra layer and it's not useful since I only have one physical entity that belongs to a Volume Group: A single RAID5 array.
So you could put your filesystem on top of a Logical Volume, or directly on the RAID array device. It depends on how you want to manage your data and devices.

So, is this hampering performance? The tables below will do the talking, but first: the setup.

System Setup

Processor
Intel Pentium Dual CPU E2160 @ 1.80GHz
MotherboardMSI (MS-7514) P43 Neo3-F

North Bridge: Intel P43

South Bridge: Intel ICH10
SATA Controller 1
JMicron 20360/20363 AHCI Controller

AHCI Mode: Enabled

Ports: 6-7
Sata Controller 2
82801JI (ICH10 Family) SATA AHCI Controller

Ports: 0-5
RAM
1GB @ CL 5
Video Card
GeForce 7300 GS
Disk sda
WDC WD10EACS-00D6B1
Disk sdb
WDC WD10EACS-00D6B1
Disk sdc
WDC WD10EACS-00ZJB0
Disk sdd
WDC WD10EADS-65L5B1
Disk sde
WDC WD10EADS-65L5B1
Disk sdf
MAXTOR STM31000340AS
Disk sdg
WDC WD10EACS-00ZJB0
Disk sdh
WDC WD10EADS-00L5B1
Disk sdi
Hitachi HDS721680PLAT80 (OS)
Chunk size
256kB
LVM: Physical Extent Size
1GB
LVM: Read ahead sectors
Auto (set to 256)

Speed Test Methods

A quick and easy way to run a speed test is by using a tool called hdparm and another called dd.
Note that these two utilities don't take the filesystem performance into account, as they read directly from the device, not a certain file. It doesn't matter in this case, as I'm about to show comparisons to show the magnitude of difference speed only, not show very exact results ;)

hdparm

hdparm -tT /dev/xxx
-t: Perform timings of device reads for benchmark and comparison purposes.
Displays  the  speed of reading through the buffer cache to the disk without any prior caching of data.
This measurement is an indication of how fast the drive can sustain sequential data reads under Linux, without any filesystem overhead.

-T: Perform timings of cache reads for benchmark and comparison purposes.
This displays the speed of reading directly from the Linux buffer cache without disk access.
This measurement is essentially an indication of the throughput of the processor, cache, and memory of the system under test.

dd

dd if=/dev/xxx of=/dev/null bs=10M count=400
This will read from the device and dump the data to a null device (just reading). Block size=10 Megabytes (2^20).
This will read 4GB of data. I specified 4GB to make sure that it surpasses the RAM size.

Before running dd, I flushed the read cache by entering: hdparm -f /dev/sd[a-h], which flushes the cache of all RAID disks.

Speed Test #1: RAID vs. LVM

LVM
root@Adam:~/mdadm-3.0# dd if=/dev/mapper/arrays-storage of=/dev/null bs=10M count=400
2097152000 bytes (2.1 GB) copied, 41.1147 s, 43.0 MB/s


root@Adam:~/mdadm-3.0# hdparm -tT /dev/mapper/arrays-storage
 Timing cached reads:   1926 MB in  2.00 seconds = 962.65 MB/sec
 Timing buffered disk reads:  146 MB in  3.00 seconds =  48.62 MB/sec
 
 
RAID
root@Adam:~/mdadm-3.0# dd if=/dev/md0 of=/dev/null bs=10M count=400
2097152000 bytes (2.1 GB) copied, 10.9341 s, 125 MB/s


root@Adam:~/mdadm-3.0# hdparm -tT /dev/md0
Timing cached reads:   1998 MB in  2.00 seconds = 998.73 MB/sec
Timing buffered disk reads:  538 MB in  3.01 seconds = 178.98 MB/sec

The above numbers are the average of 3 runs.

Speed Test #2: Disks Separately

root@Adam:~# for i in {a,b,c,d,e,f,g,h}; do dd if=/dev/sd"$i"1 of=/dev/null bs=10M count=400; done
root@Adam:~# for i in {a,b,c,d,e,f,g,h}; do hdparm -I /dev/sd"$i" | grep Firmware; done

Disk
Model
Firmware
Speed Test Result
sda
WDC WD10EACS-00D6B101.01A0146.3106 s, 90.6 MB/s
sdb
WDC WD10EACS-00D6B101.01A0148.6391 s, 86.2 MB/s
sdc
WDC WD10EACS-00ZJB001.01B0170.8184 s, 59.2 MB/s
sdd
WDC WD10EADS-65L5B101.01A0146.9733 s, 89.3 MB/s
sde
WDC WD10EADS-65L5B101.01A0144.2861 s, 94.7 MB/s
sdf
MAXTOR STM31000340ASMX15
77.1797 s, 54.3 MB/s
sdg
WDC WD10EACS-00ZJB001.01B0150.5498 s, 83.0 MB/s
sdh
WDC WD10EADS-00L5B101.01A0146.747 s, 89.7 MB/s

As you can see, though sdc & sdg have the same model and firmware, their speed differs! I have no clue why and I searched in Western Digital's website for firmwares to download, but their site leads no where to any firmware download link.

The Maxtor disk has a newer firmware released. I'll checkout its changelog before installing it. Also, as a precaution, I'll clone the Maxtor disk to sdg since it's not being used now; just in case the new firmware doesn't play nice!

Conclusion

From the above numbers, it's clear that LVM, in my setup, has crippled the performance by a huge margin (~66%). So for my next setup, I'm going to skip LVM and slap the filesystem directly on top of the RAID5 array.

On one of my PCs (Adrenalin), I already have XFS filesystem running on top of the RAID array and LVM is not being used. I get double the speed of hard disks out of the array (140 MB/s) when tested it last year with hdparm.

I don't claim that this is a typical problem of LVM. I did a quick search and didn't find numbers. I'm too lazy right now to find anything really. But I have the numbers on that MSI crap board (caused me so many problems with the SATA ports), and I'll skip LVM on that board. If I keep the board & not smash it to smithereens.

Irrelevant note: I'm loving posting to my blog through Google Docs.

Friday, December 19, 2008

Winter and Computer Hardware

As the cold sneaks under our blouses and trousers, we keep stocking ourselves with more clothes, and the more we put on, the more charged we get. Static Electricity is NOT your friend!

In case you didn't know, handling computer hardware while being charged with electricity will discharge the electricity into the piece you hold and most likely rendering it a paperweight. Be it RAM, CPU, Graphics Card, or Hard disk drive, unless you hold a piece of metal before touching the piece, you're dooming it!

You should also do the same before touching the fuel hose at the gas station. As much as it's fun to see an awkwardly dancing flaming show, the after-show smell is just obnoxious...

Thursday, March 13, 2008

RAM and BIOS Upgrade

I've been contemplating buying new RAMs for months and been looking for the proper brand, price, capacity & speed.

My machine, code name: Adrenalin, has 2x 1GB of Kingston RAM; they're beautiful, fast & do the job, but they're just not quite enough for my kind of [ab]usage.

I tried buying from NewEgg.com and TigerDirect.com, and as newegg was clear that they won't accept VISA, AFTER registering & reaching the payment page, TigerDirect.com failed at it, and not only that, my questions via email went unanswered for days and when got a response, it was totally irrelevant to my questions!!! The only quick response I got from them, is when I emailed them to cancel my order, in which they did within 2 hours!

Luckily, I found the same piece I was looking for on Amazon, at the same price of TigerDirect; In fact, Amazon gets the item from TigerDirect themselves!

I was after Corsair XMS2 DHX 2x 2GB kit RAM, and though the CAS latency is higher than the Kingston that I had, it wouldn't make much of a difference to me.
This piece of RAM is absolutely amazing: Not only do you get high-grade RAMs, you also get an amazing heat-sink design and a life-time warranty!

I ordered 2 kits, totalling in 8GB of RAM to fill all my 4 DIMMs, and have been waiting for them to arrive for 2 weeks, and today I got them, went back home and started the upgrade ritual.

0) Open a shell and write down the uptime: "up 42 days, 10:52"
1) Download memtest+ ISO file & burnt it
2) Shutdown machine & keep power cord connected
3) Clean dust & wash fan filter
4) Open case and touch internal metal body to discharge static electricity
5) Remove old RAMs & grab a pocket-knife & start cutting the cover of new RAMs before checking if it can be opened by hand
6) Open RAM cover by hand
7) Enjoy the beauty & smell the fresh scent of the hardware pieces
8) Anxiously & carefully install new RAMs
9) Power up & enter BIOS to make sure correct values for RAM are detected
A) insert memtest+ media to thoroughly test all RAMs -- passed

After that, I booted into Windows (XP 64-bit) to check for BIOS updates, which I found, and downloaded manually after the ASUSupdate program failed to download the needed file.
It was straight forward: Open AsusUpdate & choose "Update From File" then select the BIOS .BIN file and click away. Almost.

There was an option to reset the BIOS settings to the factory default after flashing the new BIOS version, and since I didn't want to go through the whole configuration process, I unselected it and flashed the new BIOS. After rebooting, the machine wouldn't start. PANIC ATTACK!
I thought the BIOS is being flashed after a reboot, which is not what used to happen before, and waited for 2 minutes, yet nothing happened, so I shutdown & powered up again, and nothing happened.

I run to my sister's room to find that she's not there, but her laptop is; PERFECT! I snag it and surf away to Asus's website and grab the manual, then I find that I'm downloading the Chinese manual, so I cancel & hunt for the English manual.
After the manual downloaded & unpacked, the BIOS has a recovery mode for cases where flashing the BIOS goes wrong (EXCELLENT!) -- the problem is that the screenshots assume that the machine would boot and I'd be able to see text on the monitor, which I didn't. Failure.

I go back to my room, calculating the cost of sending the motherboard to Asus and the time I'd have to spend without my baby -- then I remembered the option which I unselected.
I remove the BIOS battery & unplug the power for a minute, then put the battery back & hook the power. Power up. IT'S ALIVE!
Seems like the nwe BIOS wasn't fond of the old BIOS's settings! Anyway, I configure my stuff again and all goes smooth.

Lessons learned: None.

-> Pictures.