Linux; What is stripe_cache_size and what does it do

cachelinuxmdadm

I am currently building a software RAID under Linux using mdadm utility and I've read a few articles that describe how to increase the stripe_cache_size value for that RAID and how to calculate an appropriate value for stripe_cache_size.

I have increased mine to 16384 and my current sync rate on a new RAID5 in /proc/mdstat has jumped from from 71065K/sec to 143690K/sec (doubled!) which is good news. I also see the matching and expected increase in RAM usage however I can't find any documentation on what this setting does and how it works.

It seems to be a cache of some sort for the RAID that exists in RAM. That is all I can tell from its name and the effects seen by changing it. Is there any official "Linux" documentation for this setting and description of it?

Best Answer

from my understanding the stipe_cache_size is the number of stripe entries in the stripe cache. The stripe entries varies from systems to system but it is mostly controlled by the page size(default of 4096 bytes on linux systems)(https://github.com/torvalds/linux/blob/master/drivers/md/raid5.c#L73 , this file have all the logic of the stripe cache if you'd like to dig deeper) so in a 4 disk RAID5, a stripe_cache_size of 32768 will cost you 512MB of RAM. as far as I know it affect only raid5.

here are 2 documentation references: - https://github.com/torvalds/linux/blob/master/Documentation/md.txt#L603 - https://raid.wiki.kernel.org/index.php/Performance#Some_problem_solving_for_benchmarking