On Sun, 4 Dec 2011 15:31:30 -0800 Borg Onion <borg.onion@xxxxxxxxx> wrote: > Hello, > > Is it possible to implement round-robin read support for raid1.c in > md? I sure would appreciate the extra speed given my RAID1x3SSD > setup. A possible algorithm might go like this: > > 1) Given the RAID1 drives are enumerated 0,1,2 > 2) For each read request, call an atomic increment > 3) mod the returned value with # of drives (3) > 4) Use the modulus result as the drive # to read from for this operation > > Part of implementation might look like this: > > uint32_t get_next_read_drive(uint32_t num_drives) > { > static uint32_t op_count; > > return __sync_fetch_and_add(&op_count, 1) % num_drives; > } > > I'm making the assumption that the md code is multi-threaded. This > implementation won't work on all platforms, others might have to do > some locking. The num_drives and drive list enumeration is assumed to > exclude write-mostly devices. Temporary balancing fairness errors > from the num_drives variable changing value (adding or removing of > drives) should be innocuous given these are just read ops on mirrored > data. > > Thoughts? I would suggest using RAID10 if 'far' mode instead. Then reads are distributed across all your drives just like with RAID0, and you get to choose the chunk size for distribution. NeilBrown
Attachment:
signature.asc
Description: PGP signature