{"id":296,"date":"2010-01-18T13:50:18","date_gmt":"2010-01-18T12:50:18","guid":{"rendered":"http:\/\/vmdamentals.com\/?p=296"},"modified":"2010-11-05T12:10:14","modified_gmt":"2010-11-05T11:10:14","slug":"throughput-part-2-raid-types-and-segment-sizes-2","status":"publish","type":"post","link":"https:\/\/www.vmdamentals.com\/?p=296","title":{"rendered":"Throughput part 2: RAID types and segment sizes"},"content":{"rendered":"<blockquote><p>In part one I covered all stuff you can think of in regards to delays and latencies you encounter on physical disk drives and solid states. Now it is time to see how we can string together multiple drives in order to get the performance and storage space we actually require. I&#8217;ll discuss RAID types, number of disks in such a RAID set, segment sizes to optimize your storage for particular needs and so on.<\/p><\/blockquote>\n<p>&#8211;> For those of you who haven&#8217;t read part 1 yet: <a href=\"http:\/\/vmdamentals.com\/?p=266\">Thoughput Part1: The Basics<\/a><\/p>\n<p><BR><BR><strong>A short intro to RAID types<\/strong><\/p>\n<p>Now finally it is on to the stringing together of disks. More disks is more space, more performance, right? Yes right &#8211; sometimes. I am not zooming in too deep on the RAID types. I assume you have some knowledge on different types of RAID, mainly RAID1, RAID10 and RAID5. All that I&#8217;ll say about it:<!--more--><\/p>\n<ul>\n<li><strong>RAID1<\/strong> = putting two disks together, write the same data to both, read half of the data from each. This is an effective way to cope with disk failure, while boosting performance;<\/li>\n<li><strong>RAID10<\/strong> = Taking two or more RAID1 sets, and striping them together;<\/li>\n<li><strong>RAID5<\/strong> = Here it suffices to look at RAID5 like the almost forgotten RAID3: Simply striping two or more disks together, and add another disk to hold the parity of all other members in the stripe. (In reality in RAID5, the parity data is balanced across all disks in the RAID5 set instead of having one dedicated parity disk as in RAID3).<\/li>\n<\/ul>\n<p>So what about read and write performance? Two disks have double the performance and double the size? Well actually, no. Each RAID type has its advantages, and also its disadvantages. There are three main advantages for all these RAID types though:<\/p>\n<ol>\n<li>They increase the amount of storage;<\/li>\n<li>They increase the amount of IOPS your disk group can perform;<\/li>\n<li>They protect you from a single failing disk (for RAID10 even more than one failing disks in some cases)<\/li>\n<\/ol>\n<p>So when to choose what? Now it comes down to the (dis)advantages of each RAID type, where basically it is always between RAID10 and RAID5 (with RAID1 being a sort of 2 disk version of a RAID10 group):<\/p>\n<p><BR><BR><strong>RAID10<\/strong><\/p>\n<p>In RAID10, you basically loose 50% of your storage space, because each disk is mirrored. On the other hand you gain a lot of performance (each disk is used for performing reads; each mirror-set inside the RAID10 is used for performing writes). Especially when disk groups which need to perform a lot of writes, RAID10 is an absolute winner over RAID5 (see RAID5 below). Also, in case of a disk failure, RAID10 will rebuild quickly and, even more important perhaps, with very little impact on overall performance during rebuild. This is because all that needs to be done is to copy the data from a single disk to its (replaced or hot-standby) mirror.<\/p>\n<p><BR><BR><strong>RAID5<\/strong><\/p>\n<p>RAID5 is another beast. RAID5 gets more efficient in storage size as you use more disks in the RAID group. This is because when you put data on a RAID5 group, all disks are used for data storage (in a stripe), and only one disk is used to put a parity segment on. In RAID5, these parity segments are put on a different disk in the RAID-group for each stripe. This is because you need the parity data more often when writing, and this way the load of the parity segment is divided over all members of the RAID5 group (in RAID3, one physical disk is used for all parity which can cause writing performance limitations).<\/p>\n<p>Rebuilding a RAID5 array is somewhat difficult: If a disk fails and is replaced, the rebuild has to read data from all other members in each full stripe. This should return all data minus parity, or all data minus one plus parity. In both cases, the remaining segment can be calculated, and is then written back to the replaced disk in the RAID group. This is very disk intensive; all disks in the stripe have to read ALL their data in order to perform a rebuild. And worse, the rebuild time gets larger as the number of members in the RAID5 group grows.<\/p>\n<p><BR><BR><strong>Write penalties<\/strong><\/p>\n<p>For most RAID types (in fact all data-protecting RAID types), read performance is not equal to write performance. \u00a0In RAID10 things are relatively simple; when reading all disks in the group are used, when writing in effect half of the disks is used (this is because each write has to be written to two disks who make up a mirror set. So a write penalty of 1:2 you might say (for 1 write you need 2 IOPs).<\/p>\n<p>RAID5 write penalties are more complicated. It is basically a stripe of disks (like RAID0), but the added parity data is kind of a deal breaker. Depending on what you need to write, there is different behaviour. Lets say you want to write to only a single segment. In that case you could perform a read of that segment and read the parity of that particular stripe, then recalculate the parity data, then write both the segment and the parity. Overall this hits you for 4 IOPs for a single segment write. You can imagine this being a problem in a random IO pattern environment (where total seek time is the &#8220;killer&#8221; for your performance). The write penalty if 1:4 in\u00a0that\u00a0case (for one write you need 4 IOPS)<\/p>\n<p>It gets even stranger if you write a &#8220;partial&#8221; stripe. In this case you basically have to read the entire stripe minus the segments to write, perform a calculation of the parity, then write the changed segments and the parity. You could calculate the write penalty for this, but it is kind of complicated:<\/p>\n<p>if n = number of members in the stripe, m = number of segments to modify,<\/p>\n<p>then<\/p>\n<p>Number of IOPS needed = ( (n-m) + 1 parity ROPS) + ( (n+1) WOPS).<\/p>\n<p><BR><BR><strong><em>Example 1<\/em><\/strong>: If you have a RAID5 of (8+1) disks (8 in the stripe and one parity), and you have 2 segments to modify, you&#8217;d need 8-2+1 = 7 ROPS followed by 2+1=3 WOPS. So for 2 writes you&#8217;d need 7+3=10 IOPS, or a write penalty of 1:5.<\/p>\n<p><strong><em>Example 2<\/em><\/strong>: If you have a RAID5 of (8+1) disks again, but now you have 6 segments to modify, you&#8217;d need 8-6+1 = 3 ROPS followed by 6+1=7 WOPS. For for 6 writes you now need 10 IOPS, or a write penalty of 6:10 or 1:1,66<br \/>\n<BR><BR><br \/>\nIn the previous case, a full stripe write would require only 9 IOPS (in this case WOPS) for 8 segments, so a penalty of only 8:9, or 1:1,125 !<\/p>\n<p>So the most effective way of writing to a RAID5 array, is to write one entire stripe at once. In this case, all disks can be used to simply perform a write operation, and one (calculated)\u00a0parity segment. A lot of SAN vendors (like EMC for example), try to maintain written segments inside their write cache, and flush only when they have a full stripe to write out to disk.<\/p>\n<p><BR><BR><strong>Write penalties: what it comes down to<\/strong><\/p>\n<p>Looking at the previous calculations, you could extract the following:<\/p>\n<ul>\n<li>For random writes, RAID10 gives a static write penalty of only 1:2;<\/li>\n<li>For random writes where the cache of the SAN cannot fill up to a full stripe write, the write penalty lies somewhere at 1:4 or slightly better;<\/li>\n<li>For sequential writes, RAID10 still gives you a write penalty of 1:2, but RAID5 (when using write cache) gives you only a write penalty of 1:1,125!<\/li>\n<\/ul>\n<p>So the statement that RAID10 gives you better write performance is not always true&#8230;!<\/p>\n<p><BR><BR><strong>Sequential, Random, segment size??<\/strong><\/p>\n<p>So now we have got a clear view on segments to write, to read, RAID types, and latencies on physical disks. If we put all of this stuff together, we can actually optimize storage using RAID types and segment sizes together!<\/p>\n<p>From here on there are so many parameters, that it becomes kind of hard to write a &#8220;one for all&#8221; best practice. I think it is better to put some examples to the test, and find out what would work best:<\/p>\n<p><BR><BR><em><strong>Example one: Database doing heavy writes<\/strong><\/em><\/p>\n<p>Let&#8217;s assume we have a very busy database, and we want to put this database on a number of disks we reserve especially for \u00a0this database. Let&#8217;s say the blocksize the database writes in is 8 KBytes, and the pattern is random IO (which is almost always the case in a database environment).<\/p>\n<p>In random IO patterns, the main delay is the head seektime and the rotational latency. So in this case you&#8217;d want to use as little disks as possible for a write (because each disk that is touched by the write needs to perform the seek). So a segment size of 8Kbytes would probably be optimal in this scenario.<\/p>\n<p>When looking at the write penalty, the fully random IO pattern would mean that a RAID5 group would probably encounter a write penalty of 1:4, where a RAID10 group would only encounter a penalty of 1:2. This means you would require less disks to obtain the performance you need when comparing to RAID5.<\/p>\n<p>Finally, disksize comes to mind. If the database is relatively small, RAID10 would propably be cheaper (!!) than RAID5. Why? Well, lets assume you use 15K SAS disks, which perform about 200 IOPS each, and your database requires 600 ROPS and 600 WOPS simultaneously, and is only 500Mbytes in size. You then would need:<\/p>\n<p><em>RAID10 would need:<\/em><\/p>\n<p>For performance: 600 ROPS \/ 200 = 3 spindles for reading, and 600 WOPS \/ 200 * 2 = 6 spindles for writing. This sums up to 3+6=9 so 10 disks in RAID10 would suffice. Using 146GB disks, you would get 5*146 GB = 730 GB, so this would suffice.<\/p>\n<p><em>RAID5 would need:<\/em><\/p>\n<p>For performance, 600 ROPS \/200 = 3 spindles for reading, and 600 WOPS \/ 200 * 4 = 12 spindles for writing. This sums up to 3+12 = 15 spindles in total, so you&#8217;d require a (14+1) RAID5 set, which personally I would never do (rebuild time and impact!).<\/p>\n<p>So in this example, RAID10 would actually save you 5 disks (and gain a much better rebuild time with much less impact). RAID10 would be THE way to go here.<\/p>\n<p><BR><BR><em><strong>Example two: sequential writing video application<\/strong><\/em><\/p>\n<p>In example two, we have a video application which needs to stream a lot of data to a raid group. Again we reserve a set of disks for this application (so the stream will remain purely sequential). Lets say we need to save a stream of 100MB\/sec to 7200rpm SATA spindles, 100% writes in blocks of 1Mbyte (larger blocks help of course in a sequential write scenario)<\/p>\n<p>As we have seen, RAID5 can be very effective when writing full stripes. So if we create a RAID5 array out of (4+1) disks, and we make the segment size 1Mbyte\/4 = 256Kbytes, each WOP from the video app would exactly fill up one entire stripe. At 100MB\/sec, each disk would have to write at 25MB\/sec, and the fifth disk would perform at 25MB\/sec as well. Because we need to write 100MB every second, we would require 100 IOPS (given that the blocksize is 1MB). Write penalty of a (4+1) RAID5 is 1:(5\/4), or 1:1.25 would give us the requirement of 100 * 1.25 = 125 WOPS.<\/p>\n<p>so each disk would have to perform: 125 \/ 4 = 31,25 IOPS and 100\/4 = 25MB\/sec. This is something a 7200rpm SATA drive should be able to support. Because we are using RAID5 in this example, we would end up with 5 drives. If we used 1TB SATA drives, we would have 4TB of net storage.<\/p>\n<p><BR><BR><strong>Conclusion<\/strong><\/p>\n<p>From the previous part and this part it becomes clear, that there is never a &#8220;best&#8221; solution given all environments. Sometimes RAID5 is better because you end up with more storage space than when you&#8217;d be using RAID10, sometimes RAID10 is better for its simple and relatively low write penalty for random IO loads.<\/p>\n<p>Some things to consider in ANY case, is the segment size and the RAID type you choose for your storage. Also, never forget the impact of a rebuild in case of a disk failure. Especially the larger stripes in RAID5 can have enormous rebuild times (several days is no exception). During these rebuilds there is a significant impact on performance. Even though most SAN vendors allow you to prioritize your reguilar data flow and the rebuild priority, but this still leaves you with a problem: a short rebuild time with heavy user-impact, or a very low priority rebuild that does not impact users \u00a0too much but leaves you with a rebuild going on for days. Do not forget, that within a RAID5 group disks are often the same make and model, and they are all just as old. This creates a serious threat, when you combine it with the heavier load during a rebuild: Changes are, you loose a second disk during rebuild which will basically destroy all your data on the raid group.<\/p>\n<p>Also very important is getting to know your data. The IO pattern behaviour, as well as the read\/write ratios must be taken into account when designing your storage.<\/p>\n<p>Finally, for everyone using their storage in a VMware environment: Mostly your IO pattern will be random (unless you reserve disk groups for special functions). In this case, at least consider RAID10. It is a better overall performer for writes, and impact of a rebuild is much smaller compared to the popular RAID5.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In part one I covered all stuff you can think of in regards to delays and latencies you encounter on physical disk drives and solid states. Now it is time to see how we can string together multiple drives in order to get the performance and storage space we actually require. I&#8217;ll discuss RAID types, number of disks in such a RAID set, segment sizes to optimize your storage for particular needs and so on.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[85,72,82,87,88,90,73,89,86,81,74],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-storage","tag-disk","tag-iops","tag-raid","tag-raid10","tag-raid5","tag-random-io","tag-rops","tag-sequential-io","tag-spindle","tag-throughput","tag-wops"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296"}],"version-history":[{"count":34,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":918,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=\/wp\/v2\/posts\/296\/revisions\/918"}],"wp:attachment":[{"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vmdamentals.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}