Risk of Data Loss with Defer-Write on SSD cache?

FAQ, getting help, user experience about PrimoCache
Post Reply
HolyFire
Posts: 2
Joined: Sat Feb 15, 2020 11:51 pm

Risk of Data Loss with Defer-Write on SSD cache?

Post by HolyFire »

Hi.

The documentation describes defer-write as a feature to accelerate writes, but warns that there is a risk of data loss if there is an outage before writing to the main disk is complete.

This is perfectly clear in the case of RAM cache. But if the cache is an SSD, it's not so clear - SSD is nonvolatile, so even if there is an outage before the data is written to the main HDD, the data should be safe as long as it has finished being written to the SSD cache.

I expected the documentation to specify this - that the L2 SSD cache is exempt from the data loss risk - but could not find such a provision.

So my primary question is - if defer-write is used, and there is an outage between the time the data finished being written to SSD, but before being written to HDD, can PrimoCache seamlessly recover the data (and finish the task of writing to HDD when the system is back up again)?

More concretely - assuming that I have a main HDD, an SSD I'm using as L2 cache, and optionally also L1 RAM cache. I want the data to be safe once written to SSD, and I don't want to wait for HDD speeds to complete the write.

Ideally, what I'd like is the following:

1. When there is a write task, writing to the SSD begins immediately.
2. The write will not be considered complete by the OS until the data is written to SSD.
3. Writing to HDD will be done at leisure.
4. If there is an outage before writing to HDD, the data will be safe and be recovered seamlessly, as it has already been written to SSD.

Is the above arrangement possible?

Slightly less ideal but also satisfactory is the following:

1. When there is a write, it is first written to L1 RAM cache.
2. The write is considered complete once written to RAM.
3. Quickly afterwards (~1 second), the data starts being written to SSD. (Writing to HDD will either be concurrent, or deferred to a future leisure time).
4. If there is an outage, the data will be lost if it was not yet written to SSD, even though the OS considered the write complete. However, if the write to SSD happened to be finished already, the data will be safe, regardless of whether writing to the HDD is complete.

Is this possible?

In both cases, how should I configure PrimoCache to achieve the desired effect?

Note - I have not yet installed PrimoCache. I'm considering using it as part of the setup for my next system. I'm trying to figure out whether it's suitable for my needs.

Thanks.

User avatar
support
Posts: 2668
Joined: Sun Dec 21, 2008 2:42 am

Re: Risk of Data Loss with Defer-Write on SSD cache?

Post by support »

So far the risk of data loss exists whether using RAM or SSD cache when defer-write is enabled. The cache index database might not be correctly updated during an ungraceful shutdown, so even using SSD cache PrimoCache still cannot recover data. But we are working on this feature and we do hope we can find a solution for this. Thanks.
Primo Ramdisk | PrimoCache
Romex Software Support

HolyFire
Posts: 2
Joined: Sat Feb 15, 2020 11:51 pm

Re: Risk of Data Loss with Defer-Write on SSD cache?

Post by HolyFire »

Ok, thanks for the answer. I hope you work this out soon.

User avatar
Jaga
Posts: 467
Joined: Sat Jan 25, 2014 1:11 am

Re: Risk of Data Loss with Defer-Write on SSD cache?

Post by Jaga »

The easy way to avoid this currently is to have a UPS unit on the machine using deferred writes. There are still cases of ungraceful shutdown (though rare), but for power loss situations, you can avoid them with the additional hardware.

Post Reply