The every day things from Thalamus' life.

Thalamus' Blog

2 September, 2012

Prevent read-modify-write operations

Filed under: ComputerStuff_en — Thalamus @ 01:30

I’ve seen this explained in different ways all over the web, so I decided to make my own notes about the subject with references to resources that I think could shed a light on the subject.
First off – I’ve taken a comment from sammkfs man page. Not over complicating the subject in my opinion.

NOTES
Data alignment refers to matching the allocation unit of the
RAID controller with the allocation_unit of the file system.
A mismatched alignment causes a read-modify-write operation
for I/O that is less than the block size. The optimal
alignment formula is as follows:

allocation_unit = RAID_stripe_width * number_of_data_disks

For example, if a RAID-5 unit has a total of 8 disks with 1
of the 8 being the parity disk, the number of data disks is
7. If the RAID stripe width is 64 kilobytes, then the
optimal allocation_unit is 64 * 7 = 448.

… ok – got it, then now some rules that might help in desciding how YOU should setup your raid.

“RAID chunk size” is the same thing as pr. example MegaRaid “Strip Size” (also called “stride-size” – damn it )

Stripes go across disk drives. But how big are the pieces of the stripe on each disk? The pieces a stripe is broken into are called chunks. So what is a reasonable chunk size? It depends on your average I/O request size. Here’s the rule of thumb: big I/Os = small chunks; small I/Os = big chunks.

Photoshop = small chunk size (8k maybe ?), MySQL = big chunk size (64k or more). Actually, only one way to know – test.

On the MegaRaid, you also have read/write policies. ‘Write thru’ pr. example is when you want to write directly to the disks in the raid group without using the controllers cache. Writeback, another option, should be considered when you have small data transfer applications in order to fill up stripe writes.

“number of filesystem blocks”, linux will use ‘default’ 4096 for devices larger than 512 MB if not told otherwise.

Here is a calculator for linux ext2, 3 and 4.

http://busybox.net/~aldot/mkfs_stride.html

All done ? Don’t forget, you might also want to mount the filsystem itself with something other than the defaults.
… noatime,nodiratime,data=writeback,commit=15 is paramenters I currently run on one of my computers.

• • •