there I'm Bill um I've been working in storage development for 28 years um I've spent the last six months uh looking at Seth and um I want to share with you today uh my kind of thoughts and Visions on uh how we can improve eraser coding um and so today with Seth if you're storing objects then you're probably using a Razer coded pools if you're using block or file then you're probably using uh replicated pools um and the reason for this is performance when you're doing small random access to a rer coded pools um you
don't get the kind of performance you want and so you end up using using replicated storage pools instead um that's great for the performance but obviously having a replica 3 pool means you've got a lot of storage overheads you got three times as much physical storage as the amount of data that you're storing on your cluster so you know the attraction of a raser coding is a lower total cost of ownership you need less physical storage for the amount of data you're storing so my vision is how can we make a Razer code coding give
similar performance to replicated pools so that we can use it for Block storage and file storage now you're never going to get as good a performance as with replicated storage you know the objective here is to make it nearly as good good enough so that you can use it and you know the very slight difference in performance you can trade that off for the lower cost you get from being able to exploit aaser coded pools um one of the performance bottlenecks we we need to look at here um so bandwidth um typically these days that's
limited by the network connections uh between your SEF nodes uh iOS per second iops um with HDD storage you might be limited by uh the performance of the hdds if you got modern mvme drives you've seen the performance figures that have been shown today um SEF cluster probably isn't able to drive a large number of mvme Drive devices flat out what's actually going to limit your performance is the amount of CPU uh Power you've got and so you're going to run out of CPU uh before you uh actually manage to uh you know saturate the
mvme drives the other thing and you know this is what end users probably really care about uh when you talk about performance is latency and so this is is you know how much delay is there in reading and writing the data and you know that's uh the performance measurement that applications are sensitive to you know when the latency creeps up that's when the applications become sluggish you know that's when your end users start complaining and shouting and saying you know what's the storage doing why is my application so slow um okay so let's start by
looking at reads um so here's what happens today uh with a read um so the radar client issues a read uh to the primary OSD it actually goes and reads data from all of the uh data osds in the Eraser coded pool um you know even if you're just reading 4K it'll still go and read from all of them discards all of the data it doesn't need and then sends the data that is actually requested back to the client so you know we don't need to be a rocket scientist here to say how how could
we improve this um looking at this chart um at the top there uh you know the transfer to the rados client that's obviously using network bandwidth so you know we're interested in how much data is being sent there uh the osds storing the data those are probably in different servers for uh reliability reasons and so you're consuming Network bandwidth as you transfer data between the rsds and so the more arrows we see at the bottom here uh the more uh Network bandwidth we're consuming you know the more that's going to have impact on bandwidth the
number of accesses uh to the osds that's the other thing we need to consider if you're using hdds then you know the more accesses you have there the more that's going to limit your performance if you got all mvme storage then the more accesses you have there the more CPU time you're essentially using up and so the more arrows we see on these diagrams uh the more that's going to be affecting your performance so less arrows is better um so I said don't need to be a rocket scientist to say how can we optimize this
um and so a partial read is where uh the client issues the read and rather than going reading all of the data drives we only have to go and read the one that's got the data that we need on on it and then we send that data back to the client so we can see lot less hours so saves lot of network bandwidth less CPU overheads um less number of iOS um this has actually uh just been delivered Upstream uh into main uh so this will be coming uh to a SE release soon I'm not
sure whether it's going to be backbed to squid or not but um you know certainly we'll we we'll come out in the T release so you know this is the first optimization um clearly going to help read performance uh we should look at some of the error paths as well um so you know what happens if the initial read fails so you get an eio IO failure reading from drive three uh so what will happen then uh is we'll then have to go and read the other data drives and uh one of the coding parities
to actually be able to go and reconstruct and recover the data and so that's a second set of reads so we do one read that fails we then go and do a second set of reads to get the other data needed to reconstruct and recover it um that's actually no worse than the current implementation so the current implementation would have read data one 2 three and four all together to begin with if data three failed it would still have to think go and issue a second read uh to read the coding par so the partial
read optimization you know a lower reading less initially might have to read more in an eror recovery scenario but it's still only two batches of reads and so latency how long does it take for the read to be served you know that uh is going to be based on uh how many uh sets of reads we issue uh in series and so so one read of data 3 then a second set of reads of the others in parallel that's two sets of reads no worse than it is today um I should point out that we
only do two sets of reads like this when uh the read failure is unexpected so if data 3 was missing then even with the partial reads we'll straight away go and read all of the other datas and a coding par to be able to recover the data so if there's a know failure then just one set of reads to to recover the data there um how can we optimize it further so you saw read being a zigzag line um and that's because the client issues all of the read and WR iOS to an arer coded
pool to the primary OSD and that might not actually be the one that stores the data for an eraser coded pool and so that then means the primary RSD had to issue the read iio to to the OSD that actually had the data on it with a replicated poll you don't have that problem if you issue the io to the primary OSD it's got a copy of the data it can go and read its local copy uh so we a range of coded pools what we want to do is change it so that the client
understands which OSD has got the data on it and it can send the read directly to the RSD that's got the data and it can then return the data directly to the client and so this avoids a hop between the osds so it's saving Network bandwith it's saving CPU time because you know sending that data across a hop like that is got uh overheads CPU overheads sending and receiving the data so it's actually going to reduce the CPU overheads and it's going to improve the latency as well so actually just transferring data once across the
network as opposed to two hops across the network is going to help lower latency um with this optimization you should get the same read performance with aror coding that you get today with replicated pools um and so that would say you know just those two optimizations if you only had a read only workload or mainly read work load this would make uh aaser coding viable for for block and file I ask yeah does does that is that not affecting the performance of the client um the clients hav to choose which OSD to send the iio
to so there's a tiny bit of extra computation there in saying which one do I have to send it to um you got to remember that um you have many placement groups and so the client is already sending different iOS for different objects to to to different osds anyway um so uh so the client's already you know sending and and different iOS to different osds now saying that you send iOS directly to the OSD that's got the data how is the Cent the C the client's got a little bit of extra computation so is a
tiny amount of extra CPU overhead in the client to actually calculate which OSD it's got to send the data to I mean it's already running the crush rules to do the calculation it's kind of a tiny extra overhead there it's probably you know sub 1% CPU usage so uh small overheads um what happens for larger reads uh so for a large read it may be that uh the data is not stored on just one OSD uh so the client could split a larger read and issue reads to directly to multiple rsds and they could then
return the data um that is certainly the most efficient um there is a caveat here though so if we issue two reads to uh two different osds like that they're now separate iio operations um and so they're no longer Atomic and so if you are issue the read to the primary RSD and it then then issues the reads to the uh other osds it can actually block right iOS from happening whilst those two reads occur if we issue them directly like this we're now saying a right IO could actually sneak in between uh the two
reads and so you might actually be able to observe half a right uh when you read the data back so some clients don't have a problem with that and can kind of cope with that and so they could use this type of optimization some clients and you know for specific uh tasks they're doing they can't cope with that they expect the atomicity that a read you know can't can't observe half a right um and so this optimization is going to have to be selective um for some of the uh kind of block use cases uh
I I think we can get this optimization to to to work at least uh for for the kind of main uh stream cases for for for the kind of 90 95% of the io there might still be exception cases where we we we can't apply this optimization okay um so that was read iOS now let's uh have a look at write iOS um so uh what happens with a right um so this this is the initial right o of an object uh so the data gets sent uh to the primary OSD um it actually calculates
the uh coding parities so that's a bit of CPU time to do that calculation it splits the data up uh and IT issues um rights to each of the rsds to store the data uh and also uh to store the parity codings uh this is actually pretty efficient uh there's not very much we can do to to optimize this um and this is why when you're using aaser coding with object storage you actually get good performance so S3 objects are immutable they get written once like this they then don't see any overwrites typically when you're
reading uh S3 objects that's long sequential reads of of large objects um and so uh you know the fact that you're reading all of the data drives doesn't matter because you're doing that large sequential read when you've got block and file um the problem is that you need to deal uh with overwrites and so data doesn't just get written and you know a block device isn't immutable a file isn't immutable it gets written and and then you get kind of random overwrites occurring to the block device or to to the middle of the file uh
the current implementation of uh overwrites is not particularly uh sophisticated what it does is it reads all of the old data um it merges the new data that being overwritten into what it's read calculates the new parties and then writes all of the data and the parties back out again um and so if you're just modifying 4K of data it goes and reads everything does the update merges it recalculates writes everything back out again um so very inefficient lots of arrows there so you know we're burning lots of network bandwidth uh we're burning a lot
of CPU that that's essentially why short random overwrites to a RoR coded pools today gives you such terrible performance uh there's some fairly simple optimizations we can do to this um so the first thing is it really does go and read all of the data so if I was actually overwriting 95% of that data it would still go and read all 100% of it and then it would merge the 95% that we're overwriting with with the 5% that it needed calculate the new parities and then it writes everything back if I'm only modifying 5% of
it it reads the 100% merges the 5% and then it writes all 100% back I've only changed 5% so you know why am I writing all of the unmodified stuff back again so very simple optimization only read the data that's not being modified merge in the new data so now I've got all of the data I calculate the new parities and then only write the modified data and the modified parities um and so you can see you know with this optimization I've essentially halfed the amount of iio I'm doing um all of these examples I'm
I'm showing here are with a 4 plus two rasor coding I mean obviously I've chosen a fairly small uh size erasor coding just just for the diagrams um the same technique applies uh for all of the Eraser coding configs um if I had something like a 8 plus 2 config um you know yes I've reduced the number of hours here but you know that's still 10 drives that's you know 10 IOS I've done uh to to to perform say a 4K update so you know this is better it's still not good enough um so the
next tech we technique we're going to use is uh called apparity Delta right optimization um and this is very commonly implemented um in storage controllers that have raid five and raid six um but the same technique does actually work with eraser coding uh and can be generalized to work uh with any eraser coding so how it works is we read the old data and the old coding parties you X air together uh the old data and the new data to perform a Delta uh and you then apply that Delta to the coding parties and that
applying the Delta to the coding parties is actually using exactly the same maths and the same algorithms that are used to generate the coding parties from scratch and and that actually you know produces the new coding parties for you um and so that says you can do a short update uh just by reading the old data and the old parities and then writing the new data and the new parities so that for plus two config is six iio operations now the nice thing here is it doesn't matter about my raor coding config if it was
a 10 plus two or a 20 plus two raser coding it's still six I operations um if I have a four plus two six I operations there if we actually went back uh to this simple optimization you can see we've only got six iio operations there so actually with a four plus two uh there's very little benefit in the par Delta right the fact that it's doing the read and WR to the same OSD there will be a little bit of caching of metadata and so it's probably fractionally uh more effective with 4 plus2 if
I went to a 3+ 2 then uh the simple overwrite would actually be better so you know we need to be a bit smart about apparity Delta right optimization um and we can actually calculate up front how many iOS is it going to involve is it better to try this technique or is it better to just use the the simple overwrite optimizations um and so simple calculation lets us choose what to do here um so we see you know we're still sending uh the uh right iio to the primary OSD and we still got those
kind of horizontal arrows and so you know we're still consuming Network bandwidth uh between the osds one of the nice things with the parity Delta right is uh we can actually start to distribute this process um so we can actually read the old data ex with a new data on on the uh primary RSD that gives us the Delta we can send the Delta across to the osds that have the coding parties and then they can do a read of their parity apply the Delta and write it back um and so still same number of
ios's um but we're doing the read and write uh for the parities on the par osds themselves so the amount of network bandwidth we're using has been reduced um one issue with this is latency um because we have to read the old data XR to generate the delta then we send that across to the coding par osds and only then can they start doing uh the read of the old parity and so this actually increases latency um the way to fix that is as soon as you receive the right IO you kind of send a
hint message to the uh coding powerty osds saying start reading the data we going to you know send you a Delta to apply in a moment that then means that the reads of the coding parties going to happen in parallel with the read of the data and so that way we won't increase latency but we are reducing Network bandwidth um so we're still sending the right to the primary OSD and so we still got that kind of zigzag there obviously we can improve things further by having the client you know work out which OSD it
needs to update and send the right directly uh to the OSD that that needs to do the update um and so that's a kind of further reduction in network bandwidth at this point um we're getting pretty close uh to the performance you'll get with a replicated pull um in terms of network bandwidth uh comes in two copies being sent across to the coding parties that's you know same amount of network bandwidth as if you're using a replicated pool uh we are doing three reads and three writes in comparison a replica three pool would just be
doing the three wres but those three wres still actually involve doing metadata reads um so you know it's not twice as bad um that's probably getting to the point where your performance is going to be good enough one of the challenges of sending rights directly to the OSD is um kind of coordinating things so with reads it's fairly easy you can send reads the OSD has got the data all it's got to do is read it and send it back with rights things get more complicated in particular if there's multiple rights happening or if we
have to do recovery or backfill or something like that to the object before we can process the right at the moment by sending it to the primary OSD it's a kind of centralized uh point in processing all of the rights all to that object it can kind of make sure that all of those housekeeping activities occur if there's you know multiple rights happening the primary can do the serialization and make sure that they're applied in a consistent order uh cuz you know what we don't want to do is have two rights occur and for um
the updates to the coding parities to uh occur in different orders for the two rights because you know that that could end up causing inconsistencies between the parody codings and the data so so we need something to put a bit of ordering um so this is possible but uh we probably need some extra control path messages to the primary OSD to still have a centralized point of control uh to do some of the ordering at least in some of the you know uh more unusual scenarios maybe for some of the uh you know good path
normal cases we can get away with without some of those control path messages um choice of Chunk size so uh currently uh when you use eraser coding the default chunk size is 4K um and so that means um even with all of these optimizations if I do a 16k read not a particularly large read in the grand scheme of things uh then it gets split up into four 4K chunks and I have to go and read it from four different osds and so if I use the default chunk size all of these optimizations will help
for really short iOS such as 4K and less than 4K maybe provide slight benefits for 8K but anything larger than an 8K iio you're probably not going to see uh the benefits so what do we want to do we want to increase the chunk size so you know we're an example here if I used the 16k chunk size then you know at least iOS up to 16k would all be served by just reading from a single OSD how big a chunk size should I choose um so um our thoughts here is that we probably want
to choose a chunk size somewhere between 64k and probably higher probably closer to 256k um what's the kind of rationale for choosing 256k uh so firstly let's look at hdds if I do Ros to an HDD I get maybe 200 random iOS a second to a hard disk if I'm doing 4K ios's if I'm doing 8K io's how many iOS a second do I get I I get about 200 if I do 256k iio how many did I get pretty much close to 200 why is that so with an HDD the kind of time it
takes to process an IO request is mainly the time it's taking the head to seek and then the time you spend waiting for the platter to revolve round so that the portion of the disc that you actually want to read or write is underneath the head the density of modern hard diss is so great that 256k versus 4K is a tiny fraction of a revolution of the platter and so slightly larger IO sizes makes no difference to to the performance what about ssds so ssds don't have rotation uh so they don't have that problem um
an 8K iio to an SSD will actually consume twice the amount of res our Es as a 4K IO so if you Benchmark mvme ssds you might get a million iops at 4K if you go to 8K you'll get half a million iops if you go to 16k you'll get quarter of a million so as the io size increases the number of iops you get decreases so that would say maybe I don't want such a large uh chunk size for ssds but but then let's think how much performance can seph actually get out of an
nbme Drive um so if you have 10 mvme drives in a server and they can each you know manage 10 million iOS a second um you know you're not going to get 100 million iOS a second when you run Seth you probably won't get 10 million iOS a second when running Seth so what's happening is you know the CPU and the network are becoming the bottlenecks the SSD is sitting there you know idling away if we gave it 256k iOS instead of 4K ios's we're just making the SSD a little busier consuming some of that
idle time so a bigger default chunk size isn't going to affect ssds either so to make these optimizations work we're looking at a bigger chunk size there does come a point um you know the chunk size gets big enough there is a benefit to splitting a really large iio up and you know issuing two halves of the io to different devices and parallel um that in particular we um you know might help reduce latency you know it spreads load out so you know 256k probably a reasonable place you know 10 Meg probably wouldn't be a
good choice for a default chunk size so there's a limit to how big we can get but at 256k you know that says most short random iOS are going to only involve 1 OSD being updated there's another problem with chunks size however and you know this is probably why the default chunk size is currently 4K um and that's what happened uh with small sized objects um so with have a default 4K chunk size if I do a 16k right then I get four 4K chunks of data stored on different osds I get the two parities
written if I do an 8K right um what the code actually does today is it will write 4K to the first two data devices it will put padding uh so it actually writes data it actually creates zeros sends them across the network writes them to the drive consuming capacity on your uh drives uh so you get padding on data three and data four and you get uh the coding parties and so that says if you create small sized objects so you know let's say I just created a 4K object then that would actually consume 24K
of capacity on a uh 4 plus two raser coding that's a 500% overhead um if I had a 10 plus two erasor coding then the overheads are going to be even worse and so you know this is a problem with a razor coding today those of you using object storage with really small object sizes you know might be aware of this effect and uh the fact that uh you know the capacity overheads for storing those small objects can become quite large if we increase the default chunk size so here we go with our 16k chunk
size um a 16k right has now got 16k of padding on three data drives and the two um AR raor coding parties and so you can see you know for just a small 4K R uh we're up to 2 300% overheads uh for storing that 4K object um I don't think anyone thinks that's um an acceptable uh overhead um if I chose a 256k default chunk size obviously the problem's going to be 16 times worse uh so what can we do to fix this um well uh it's really quite simple the answer is don't bother
right in the padding um and you know essentially we can use the fact that the object doesn't exist to deduce that um there's no data there and that we can treat that area as zeros as far as calculating uh the coding parities um and so that then says um you know with my 16k chunk size uh a 4K right now only got 3 200% overhead um 8K and 16k right same 300% overheads as I get better than bigger than 16k you know now my overheads start going down so you know that's bringing the overheads into
a more acceptable range um another Advantage here here is with really small objects so let's say I wrote a one bite object um so uh with the current scheme it would take the one bite it would pad it out to the 4K chunk size and so it be 4k on each of the datas and each of the coding parities if we don't write the padding we can actually write just one bite uh on the Data Drive and one bite on the coding parties now okay the object store is going to probably pad those out to
to to 4K um but uh modifications and overwrites to that are then much more efficient in the object store um so another possible thought is could we be even clever than than um just not doing the padding you know what happened if we automatically choose a chunk size based on the object size so if you're writing small sized objects you know let's use a small chunk size like 4K um if you're writing larger objects so you know let's say greater than a megabyte use a 256k chunk size uh so here you know we're now getting
our cake and eating it um you know when we're storing small objects we're getting uh the efficiency of uh not consuming a lot of capacity overheads and for larger objects I'm getting the benefits uh that you know random access to to those objects is going to give uh fast uh performance if I look at something like uh lib RBD uh then it's using a default 4 megabyte object size and so it's always going to be uh choosing the the larger object size anyway and so for Block use cases we would always be uh doing that
and getting the performance case for files you know for a file system case if youve got lots of very small files then you're getting the capacity optimizations if you got larger files you're getting the performance optimizations uh the challenge of choosing the chunk size based on the object size is of course you know objects can grow and Shrink uh and uh if an object grows you really want to convert the chunk size and if it shrinks again you want to convert it um you can do this just by reading the object and rewriting it with
with with the new coding um you know if the transition point is one megabyte then that says um you know the worst case is we got to read a megabyte and and write it back again uh with with a different encoding format uh the hints uh when objects are created uh giving you an idea what size the object is going to be um and so that way we can avoid kind of an object being created and just the initial bit of it being written and you know we don't want to choose a small uh encoding
size if you know the rest of the data is going to follow uh almost immediately uh so we can use that hint uh to say okay we might only have 4K of data to store but this object is expect expected to be a four meeg object so we'll use the larger chunk size straight away and so that will reduce the number of cases where we have to convert the chunk size um so that kind of concludes the uh set of optimizations we're looking at um as I said the partial read uh optimization has been done
it wasn't wasn't done by me it was done by radic um but uh you know I'm looking to get these other optimizations done and hopefully delivered um into the main release o over the course of this year um and so hopefully you know by by the time we get to the T release um you know we'll be in a much better place for uh being able to use aaser coded pools uh for block and file as well as for object [Applause] any questions as always uh sorry um just um coming back to the initial idea
just updating or just write doing the right from the client side M um how we um make sure that the data is really there and we understand which chunks have been written just even if the client goes down because actually um the primary OSD will tell us uh what really happened and just we have a good understanding what what the data redundancy is actually um yeah so so the the the right optimizations are certainly more complicated and you know there's a lot more detail than is shown in these slides uh there's a design document um
that I've written up and uh posted onto the uh mailing list uh it's also as a poll request um and you know you can find me on uh on slack on the SEF slack channels or you know you can find me on the mailing list as well I can point you that and uh give you more detail as to how it works um essentially if a right hasn't been completely applied and so we haven't managed to update all of the uh data and coding parties um and haven't got to the point of uh giving the
completion back to the client and there's a problem occurs then the peering recovery process will actually roll back the the whole right operation uh so that none of it uh is applied and yeah that's what happens with the existing rer coding implementation with uh these optimizations uh we'll still need to do that uh there is a bit more work in the peering and recovery process to actually you know be able to work out what has to be undone uh so yeah that's where a little bit of the complexity is in some of these changes okay
thanks okay so as you described the the padding uh goes on at the moment all those all those zeros U what what's the pitfall of not doing that um well you can see none there shouldn't be a pit full of of not writing it um so so why why why is it done I mean obiously a lot of writing going on yeah so so it's probably a code Simplicity um so uh you know the overall today because they're kind of reading everything and then regenerating the coding parties um the the code PA today only has
the use case of I've got data for every single strip and I'm creating the coding parties from it um it hasn't got you know special case code saying I don't need to include this strip because there's no data for it so it's you know a few extra lines of code to put that optimization in is not a huge change and there's no kind of drawback to to having you know the objects not exist