Raid 5 - Write Through vs Write Back

Discussion in 'Storage & Backup' started by Snuffy22, Nov 10, 2009.

  1. Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    Hi Guys,

    So I've just gone and put 8x 1TB drives into a raid 5 array on my RocketRaid 2320 controller.

    Originally i put the array in Write Through mode and i was getting 15mb/s write speeds to the array, when i change the array to Write Back i get 60mb/s write speeds

    So am i assuming correctly that write through mode means it generates parity bits on the fly and write back mode means it writes the data to the drives without parity bits then generates the parity bits later on?

    Cheers
    Snuffy
     
  2. Bangers

    Bangers Member

    Joined:
    Dec 25, 2001
    Messages:
    7,254
    Location:
    Silicon Valley
    Write through guarantees writes to the Application. Nothing to do with parity bits to the OS, that's the controllers responsibility. Don't think of the parity as an additional task, it's part of the write itself.
     
  3. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    Sorry but i dont dont understand what you mean by writes to the application, i am aware the OS has no visability of the parity bits generated by the raid card
     
  4. Slyda

    Slyda Member

    Joined:
    Apr 22, 2005
    Messages:
    134
    Location:
    SYDANEE
    in terms of your RAID controller -

    write back - controller tells your OS the data has been written as soon as its in the controller cache, so once its in cache memory the controller doesnt need to write to disk straight away and can perform other tasks - this can speed up reads as well cos it will read straight from the data in cache not the disk.
    If you lose power or something and the controller doesnt have a battery backup the writes in cache will be lost, so there is a chance of stale data/corruption here.

    write through - controller tells the OS data has been written as soon as it goes from the cache to disk, this is safer but obviously you arent utilising the controller cache well..so slower.
     
    Last edited: Nov 10, 2009
  5. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    In a RAID setup there's actually multiple levels of write back caching...

    1) The OS usually caches blocks that are about to be written.
    2) A higher end hardware RAID controller will probably also have a cache (which is what you changed the setting on)
    3) Then finally, the HD also has its own small cache.

    Write-through basically writes data out as soon as it can, bypassing most or all caching.

    Do you have a UPS? If not then I strongly recommend you get one. Battery backed cache RAM on your RAID card will only protect cache #2, which means there's still the potential for data loss in the event of a power failure.
     
  6. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    BTW, writing out valid data is even more important when using parity based systems such as RAID5. If your power dies when say 2 out of 5 drives have been written out then you're going to have unrecoverable corruption of that block. (Unrecoverable because there is no way to see whether it's just the parity that is wrong, or the data itself.)

    IIRC RAID6 is able to detect this situation and figure out whether it's the parity (and which one) or the data that is corrupt.
     
    Last edited: Nov 10, 2009
  7. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    hmmmm, this doesnt seem to explain why i get 15mb/s writes to the array with write through enabled and 60mb/s to the array with write back enabled

    Im talking constent 60mb/s (im transfering over 4tb of stuff)
     
  8. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    Caching improves performance because it can reorder writes, write out multiple sequential sectors at a time, etc. With a write-through configuration the OS and controller will try to get those sectors onto the HD as promptly as they can.
     
  9. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    ahhh ok, its starting to make more sence in my brain now :) Cheers :D
     
  10. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    Imagine there's a river and the only way to cross it is with a small boat. The traffic is one way so the boat spends most of its time waiting at one side for passengers who want to be ferried across.

    Write-through: The priority is time. As soon as any passenger boards the boat leaves.

    Write-back: The priority is efficiency. The captain waits for a few minutes to allow any additional passengers to board before embarking. The first passenger has to wait a little longer, but more passengers are carried per trip, and ultimately per hour. That's why write speeds with caching enabled are more efficient (read: faster)
     
  11. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    BAM
    you've made it totally clear in my mind, thanks heaps!!!!!
     
  12. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    You're welcome. :)

    BTW 60mbytes/sec on RAID sounds very slow, even a single drive should be able to manage something close to that... how are read speeds?
     
  13. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    ahhhh, lol
    Not sure how to test that fully, when i read from the array and write it to another hdd it max's out that single hdd's write speed at around 60mb/s

    think i will need to install some sort of hdd benchmarking software
     
  14. terrastrife

    terrastrife Member

    Joined:
    Jun 2, 2006
    Messages:
    18,448
    Location:
    ADL/SA The Monopoly State
    i bet the source disk is slow :)
     
  15. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    ok i just installed sisandra soft


    SiSoftware Sandra

    Benchmark Results
    Drive Index : 156.26MB/s
    Results Interpretation : Higher index values are better.
    Random Access Time : 10ms
    Results Interpretation : Lower index values are better.

    Performance vs. Speed
    Drive Index : 16.00kB/s/rpm
    Random Access Time : 0.001ms/rpm
    Results Interpretation : Higher index values are better.

    Detailed Benchmark Results
    Speed at position 0% : 115.69MB/s (49%)
    Speed at position 3% : 143.35MB/s (61%)
    Speed at position 7% : 171.15MB/s (73%)
    Speed at position 10% : 130.79MB/s (56%)
    Speed at position 13% : 127.43MB/s (54%)
    Speed at position 17% : 113.72MB/s (49%)
    Speed at position 20% : 121.65MB/s (52%)
    Speed at position 23% : 144.98MB/s (62%)
    Speed at position 27% : 139.99MB/s (60%)
    Speed at position 30% : 170.19MB/s (73%)
    Speed at position 33% : 159.87MB/s (68%)
    Speed at position 37% : 171.64MB/s (73%)
    Speed at position 40% : 162.16MB/s (69%)
    Speed at position 43% : 167.50MB/s (71%)
    Speed at position 47% : 234.31MB/s (100%)
    Speed at position 50% : 156.74MB/s (67%)
    Speed at position 53% : 158.64MB/s (68%)
    Speed at position 57% : 171.14MB/s (73%)
    Speed at position 60% : 119.60MB/s (51%)
    Speed at position 63% : 172.04MB/s (73%)
    Speed at position 67% : 157.01MB/s (67%)
    Speed at position 70% : 171.42MB/s (73%)
    Speed at position 73% : 131.95MB/s (56%)
    Speed at position 77% : 171.73MB/s (73%)
    Speed at position 80% : 151.53MB/s (65%)
    Speed at position 83% : 151.17MB/s (65%)
    Speed at position 87% : 162.77MB/s (69%)
    Speed at position 90% : 214.22MB/s (91%)
    Speed at position 93% : 166.86MB/s (71%)
    Speed at position 97% : 170.54MB/s (73%)
    Speed at position 100% : 142.35MB/s (61%)
    Random Access Time : 10ms
    Full Stroke Access Time : 2ms

    Performance Test Status
    Run ID : HPT DISK 0_0 7TB (SCSI, NCQ)
    Platform Compliance : x64
    System Timer : 2.50GHz
    Use Overlapped I/O : Yes
    I/O Queue Depth : 4 request(s)
    Block Size : 1MB

    Volume Information
    Capacity : 6.37TB

    Physical Disk
    Manufacturer : HPT
    Model : DISK 0_0
    Version : 4.00
    Interface : SCSI
    Removable Drive : No
    Queueing On : Yes
     
  16. rowan194

    rowan194 Member

    Joined:
    Jan 5, 2009
    Messages:
    2,030
    Still seems kinda slow for an 8 disk RAID. The aggregate sustained read speed of 7 individual drives would be at least 400-500Mbytes/sec, even software based RAID should be able to get somewhere near that.

    For rough comparison, I have a 5 drive 100% software RAID3 array with read verification on (conservative mode which checks parity for every block, and consequently slows things down), and the sequential read speed is still 175Mbytes/sec...

    Just checked and the speed exceeds 210Mbytes/sec with read verification off. Remember this is a 5 drive array with RAID3 (a bit less efficient for sequential access)... so your 8 drive RAID5 should be doing a lot better.
     
  17. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    can you recommend a good hdd benchmarking tool? sisandra only seems to run about 15 seconds before giving results
     
  18. The Mafia

    The Mafia Member

    Joined:
    Mar 26, 2003
    Messages:
    1,469
    Location:
    Mackay
    Just use HD tune Pro, it has a 14 day trial.

    Disks need to be empty for write tests though.
     
  19. Omarko

    Omarko Member

    Joined:
    Nov 25, 2004
    Messages:
    4,131
    Location:
    Kellyville
    yeah, that seems slow ... do u have latest firmware?

    for comparison, my Perc 5i with 1x5tb in raid-5 , write back gives 300mb/s
     
  20. OP
    OP
    Snuffy22

    Snuffy22 Member

    Joined:
    Sep 1, 2004
    Messages:
    652
    Location:
    Brisbane
    second last firmware but the latest has no useful changes for me (according to changelog)
    i have a feeling sisandra soft wasnt the best tester, will tryout hd tune and winbench99 tonight :)
     

Share This Page

Advertisement: