dm-writeboost: Progress Report
Hi, DM Guys,
This is the latest progress report of dm-writeboost.
I will send you the patch in the following post. Please merge it for 3.14.
To get broad interests to Writeboost I presented in two workshops in Japan. Writeboost has now potential users waiting for it to merge in the main tree. I heard some companies discuss about Writeboost in their R&D team.
Writeboost is now involving other third party developers now.
A Ph.D candidate in Seoul university has a great interest in the log-structured nature and we discussed privately. He forked Writeboost and is working on his branch. Writeboost has a potential to gain interest even from the academic researchers.
I also discussed with the developer of WalB (http://lkml.org/lkml/2013/6/3/115).
WalB also has the log-structured nature but the difference from Writeboost is that it focuses on incremental backup. I don't know what will be the consequence of our on-going discussion but there is a possibility that the functionality of WalB will be merged into Writeboost. However, without this, Writeboost is worthy as a pure caching module like dm-cache.
The code is improved much better.
Please merge my code for 3.14 after reviewing the patch.
The major code-level changes are described below
1. Improved the log replay algorithm to gain robustness
-------------------------------------------------------
The paper "Understanding the Robustness of SSDs under Power Fault (FAST13)" made me re-think the log replay algorithm and I improved it. Now, the algorithm is even robust for failure due to power fault such as partial write of the log.
Each log now has the checksum of the log except the first 1 sector and exploits it to check the validity of the log.
See struct segment_header_device changed.
2. Enabled flushing the logs execute in parallel
------------------------------------------------
Since we have multiple RAM buffers in Writeboost we can writes them to the cache device in parallel to exploits the maximum parallelism in the SSD.
Changing the log replay algorithm enabled this.
Now Writeboost uses workqueue instead of single kthread for the parallel execution. The workqueue exhibits the sysfs to control the parallelism. Thanks to Tejun (https://lkml.org/lkml/2013/3/1/629). Changing the max_active parameter can change the number of executors.
3. Fully refactored (please read the code)
------------------------------------------
The code is much refactored and split into piece of small well-named functions. I believe the code itself is production-ready. please check it.
4. Add some codes to Joe's device-mapper-test-suite
---------------------------------------------------
Joe maintains a testing framework in his Github repo.
I merged some test codes for Writeboost but I don't work on this project recently. I will add more code later.
5. Add regression tests under testing/ of my Github tree
--------------------------------------------------------
Joe's test-suite is really well-designed but it has too many things before stand-by. Instead, I prepare simple regression tests (written in shell) in Github repo.
https://github.com/akiradeveloper/dm-writeboost/tree/develop/testing
I want contributors to pass this tests before submitting their patch.
Thank you for reading,
Akira
Quoted 3 lines · Akira Hayakawa
Hi, DM Guys,
This is the latest progress report of dm-writeboost.
Do you have any benchmarks yet? Which situations does it out perform bcache and dm-cache?
Quoted 5 lines
4. Add some codes to Joe's device-mapper-test-suite
---------------------------------------------------
Joe maintains a testing framework in his Github repo.
I merged some test codes for Writeboost but I don't work on this project recently. I will add more code later.
Thanks for adding to dmtest, you also did a couple of little tidy ups that were useful to me.
Quoted 3 lines
5. Add regression tests under testing/ of my Github tree
--------------------------------------------------------
Joe's test-suite is really well-designed but it has too many things before stand-by.
I'm not sure what you mean here?
- Joe
Hi, Joe,
Quoted 2 lines
Do you have any benchmarks yet? Which situations does it out perform bcache and dm-cache?
Yes, I do.
Writeboost outperforms other cache softwares in case of bursty random writes. With the fio script below, dm-writeboost recorded a throughput as high as the sequential write throughput of the cache device (259MB/266MB. only 3% loss). This is because Writeboost makes a log on the RAM and writes it out to the cache device in sequential manner. I don't think other cache softwares can achieve this high level of throughput.
[global]
filename=/dev/mapper/perflv
randrepeat=1
ioengine=libaio
bs=4k
ba=4k
size=16GB
direct=1
gtod_reduce=1
norandommap
iodepth=64
stonewall
[perf]
rw=randwrite
Unfortunately, I don't have any results with synthetic workload emulates databases or file servers. But, it is easy to imagine Writeboost can improve them if they are backed by RAID-ed storage whose writes are really slow compared to read with typical RAID mode like RAID-5.
Since our softwares are just providing "caching" choosing one as the silver bullet is just a fantasy. Since Writeboost provides really a peculiar caching there must be some situations that Writeboost is the best.
To tell the truth, I don't have any more equipments to have benchmark more. Why I need my software in the tree is not only to have the "many eyes" on my code to improve the quality but also to have Writeboost participate in public benchmark
(like this http://www.accelcloud.com/2012/04/18/linux-flashcache-and-bcache-performance-testing/).
Beside the performance, please consider the compact codebase of Writeboost. As a writeback caching it should be as simple as possible to reduce potential bugs.
By the way, Writeboost improves only writes so if you need more improvement on reads you can stack dm-cache (write-through) under dm-writeboost. They are orthogonal. dm-cache seems to be good for read caching.
For read caching, I have an another plan to develop separate cache module that, on the other hand, purely focuses on improving reads. I have a name "dm-readboost" in my mind.
Since write cache and read cache require different data structures and controls they should be separated. So, if dm-cache can be simpler and optimized by deleting the support for writeback mode I really prefer it.
Quoted 5 lines
Quoted 3 lines
5. Add regression tests under testing/ of my Github tree
--------------------------------------------------------
Joe's test-suite is really well-designed but it has too many things before stand-by.I'm not sure what you mean here?
device-mapper-test-suite is a flexible framework but it has too many dependencies outside Ruby.
Akira
Quoted 11 lines · Akira Hayakawa
Hi, Joe,
Quoted 2 lines
Do you have any benchmarks yet? Which situations does it out perform bcache and dm-cache?
Yes, I do.
Writeboost outperforms other cache softwares in case of bursty random writes. With the fio script below, dm-writeboost recorded a throughput as high as the sequential write throughput of the cache device (259MB/266MB. only 3% loss). This is because Writeboost makes a log on the RAM and writes it out to the cache device in sequential manner. I don't think other cache softwares can achieve this high level of throughput.
Meaning you haven't actually tested dm-cache or bcache with the same fio script?
I'd imagine bcache would do fairly well with 4K IOs. But not as well as a log-based approach like you have. But _knowing_ the difference is significant is important.
Quoted 3 lines
By the way, Writeboost improves only writes so if you need more improvement on reads you can stack dm-cache (write-through) under dm-writeboost. They are orthogonal. dm-cache seems to be good for read caching.
OK. But it is still unclear to me that such stacking can provide completely complementary caching. Needing to maintain multiple codebases for caching is far from ideal too.
Quoted 4 lines
For read caching, I have an another plan to develop separate cache module that, on the other hand, purely focuses on improving reads. I have a name "dm-readboost" in my mind.
Since write cache and read cache require different data structures and controls they should be separated. So, if dm-cache can be simpler and optimized by deleting the support for writeback mode I really prefer it.
This idea that a single target cannot provide meaningful caching for both reads and writes is really unwelcome. Conceptually stacking is simple, but in practice the management layers that need to configure these stacks is fairly cumbersome. Not only that but piercing through one "orthogonal" cache layer to get to the other's cached data could be awkward. When paired together they may not make efficient use of the SSD (fast storage) because they _could_ be caching the same data. Care needs to be taken to ensure that these stacks are trully complementary. And seeing as that'd coordination would cross code maintainer
boundaries: I'm skeptical.
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines
5. Add regression tests under testing/ of my Github tree
--------------------------------------------------------
Joe's test-suite is really well-designed but it has too many things before stand-by.I'm not sure what you mean here?
device-mapper-test-suite is a flexible framework but it has too many dependencies outside Ruby.
So that is your reason to not use it? Pretty sure the deps you don't care about could be made more fine-grained (so that the test checks for the specific dep rather than a global check for all deps).
Quoted 6 lines
Akira Hayakawa
Sent: Monday, January 13, 2014 3:47 AMThis is because Writeboost makes a log on the RAM and writes it out to the cache device in sequential manner. I don't think other cache softwares can achieve this high level of throughput.
Would I be incorrect in assuming that this increased write performance comes with the trade-off of a greater risk of losing data in the case of power failure or crash?
Quoted 8 lines · Akira Hayakawa
Hi, Joe,
Quoted 2 lines
Do you have any benchmarks yet? Which situations does it out perform bcache and dm-cache?
Yes, I do.
Writeboost outperforms other cache softwares in case of bursty random writes. With the fio script below, dm-writeboost recorded a throughput as high as the sequential write throughput of the cache device (259MB/266MB. only 3% loss).
That certainly sounds faster than dm-cache. However bcache is very good at this sort of thing.
Quoted 1 line
To tell the truth, I don't have any more equipments to have benchmark more.
Let's get all your tests into dmtest then. This will make it much easier for other people to test who do have the hardware. Heinz has got some up to date hardware, so you should talk nicely to him (once the tests are in dmtest).
Quoted 4 lines
Why I
need my software in the tree is not only to have the "many eyes" on my code to improve the quality but also to have Writeboost participate in public benchmark
(like this http://www.accelcloud.com/2012/04/18/linux-flashcache-and-bcache-performance-testing/).
In accepting a piece of software into the kernel the community is promising to maintain it for the forseeable future (even if you lose interest). They wont take it unless there's a compelling reason; your own personal reason of wanting to improve the code quality and see how it performs, wont do. Sorry. It sounds like writeboost is performing v. well, so let's just finish the benchmarking and make a proper argument.
Quoted 4 lines
For read caching, I have an another plan to develop separate cache module that, on the other hand, purely focuses on improving reads. I have a name "dm-readboost" in my mind.
Since write cache and read cache require different data structures and controls they should be separated. So, if dm-cache can be simpler and optimized by deleting the support for writeback mode I really prefer it.
As you say dm-cache covers this area.
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
Joe's test-suite is really well-designed but it has too many things before stand-by.
I'm not sure what you mean here?
device-mapper-test-suite is a flexible framework but it has too many dependencies outside Ruby.
You mean third party tools like 'dt' etc. How about if I make the dependency checking 'suite' dependent? That way your dm-writeboost suite will not need tools that are used by thinp or dm-cache?
- Joe
Hi, Paul,
Quoted 3 lines
Would I be incorrect in assuming that this increased write performance comes with the trade-off of a greater risk of losing data in the case of power failure or crash?
Incorrect. Performance and Robustness are irrelevant if it's designed correctly. Writeboost's log contains both data blocks (4KB * N) and corresponding metablock (16B for each). After crash, it can replay the log on the cache device and it guarantees no data lost. Like the usual block device, those data acked to write barrier (REQ_FUA or REQ_FLUSH) are guaranteed not to be lost.
FYI,
The worst thing in using writeboost or even other cache softwares is that the cache device
gone out of order (which means it can neither read nor write anymore).
The filesystem doesn't go inconsistent (need not fsck) in that worst situation is writeboost's another characteristic. Writeboost writes back the dirty data on the cache device in the same order they were written. Therefore, if the cache device is gone we can at least obtain the filesystem of the moment the last write-back was done.
Read this article for SSD failure (http://lkcl.net/reports/ssd_analysis.html)
SSDs are very likely to go insane. Use trustworthy SSD is my advice.
Considering these characteristics,
Maybe, we can call dm-writeboost "log-structured write buffer" rather than "log-structured caching".
Thanks for your interest,
Akira