Defer-Write with L1 and L2

FAQ, getting help, user experience about PrimoCache
Styx
Level 1
Level 1
Posts: 4
Joined: Mon Oct 25, 2021 4:28 am

Defer-Write with L1 and L2

Post by Styx »

Hello,

I am testing Primocache, and so far it seems great. Good performance boost from both L1 and L2 caches.

However I have 2 questions about Defer-write as I am not sure I understand 100% how it works:

Question 1: When using Defer-write on an L2 write cache (L1 read only in this case), because the L2 is persistent, does it mean that in case of system crash, no data can be lost ? Or the map that keeps track of the dirty blocks is only in memory and thus data loss will still occur ?

Question 2
: When using both L1 and L2 as write cache and defer-write is enabled. Does it apply to both ? Is there a way to control it separately for L1 and L2 so for example: L1 writes deferred and L2 writes not deferred ?

Thank you.
wave
Level 3
Level 3
Posts: 19
Joined: Sat Oct 23, 2021 7:07 pm

Re: Defer-Write with L1 and L2

Post by wave »

Styx wrote: Mon Oct 25, 2021 4:52 am Question 1: When using Defer-write on an L2 write cache (L1 read only in this case), because the L2 is persistent, does it mean that in case of system crash, no data can be lost ? Or the map that keeps track of the dirty blocks is only in memory and thus data loss will still occur ?
same question
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: Defer-Write with L1 and L2

Post by Support »

Styx wrote: Mon Oct 25, 2021 4:52 am Question 1: When using Defer-write on an L2 write cache (L1 read only in this case), because the L2 is persistent, does it mean that in case of system crash, no data can be lost ? Or the map that keeps track of the dirty blocks is only in memory and thus data loss will still occur ?
The latter. Currently same risks even you use L2 cache only for defer-write.
Styx wrote: Mon Oct 25, 2021 4:52 am Question 2: When using both L1 and L2 as write cache and defer-write is enabled. Does it apply to both ? Is there a way to control it separately for L1 and L2 so for example: L1 writes deferred and L2 writes not deferred ?
You can set L2 to 100% read in the Advanced L2 cache settings dialog, thus L2 will not enable defer-write.
Styx
Level 1
Level 1
Posts: 4
Joined: Mon Oct 25, 2021 4:28 am

Re: Defer-Write with L1 and L2

Post by Styx »

Support wrote: Mon Oct 25, 2021 2:05 pm You can set L2 to 100% read in the Advanced L2 cache settings dialog, thus L2 will not enable defer-write.
Ok, this answers question 2, but then none of the writes get cached (loosing advantage of the write cache completely then)

Could you please address question 1 ? This was by far the most important one :)
I really would like to understand if using defer-write on an L2 cache can lead to data loss in the event of a system crash or not.

Thanks
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: Defer-Write with L1 and L2

Post by Support »

Sorry, I made a mistake and put the answer inside the quote. Have edited my last post.
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: Defer-Write with L1 and L2

Post by Support »

Styx wrote: Mon Oct 25, 2021 2:23 pm but then none of the writes get cached (loosing advantage of the write cache completely then)
right. But for L2, usually there is no need to enable write cache for improving read. This is because L2 is persistent, and caching read-data only can greatly reduce write wear on L2 SSDs.
Styx
Level 1
Level 1
Posts: 4
Joined: Mon Oct 25, 2021 4:28 am

Re: Defer-Write with L1 and L2

Post by Styx »

Thank you for your prompt answers !
Support wrote: Mon Oct 25, 2021 2:05 pm
Styx wrote: Mon Oct 25, 2021 4:52 am Question 1: When using Defer-write on an L2 write cache (L1 read only in this case), because the L2 is persistent, does it mean that in case of system crash, no data can be lost ? Or the map that keeps track of the dirty blocks is only in memory and thus data loss will still occur ?
The latter. Currently same risks even you use L2 cache only for defer-write.
May I suggest an advanced option when Defer-write is enabled using an L2 cache ?
The option would be: "persist dirty block map" and when enabled, it would actually flush the dirty block map on the L2 cache (persistent) each time a time interval specified by Latency expires.
This way, it allows a user to use the defer-write with some level of protection against data loss (i.e max data loss = latency, so if you set latency to 5s, then you can lose up to 5s of data in case of a system crash).
wave
Level 3
Level 3
Posts: 19
Joined: Sat Oct 23, 2021 7:07 pm

Re: Defer-Write with L1 and L2

Post by wave »

Styx wrote: Mon Oct 25, 2021 3:25 pm May I suggest an advanced option when Defer-write is enabled using an L2 cache ?
The option would be: "persist dirty block map" and when enabled, it would actually flush the dirty block map on the L2 cache (persistent) each time a time interval specified by Latency expires.
This way, it allows a user to use the defer-write with some level of protection against data loss (i.e max data loss = latency, so if you set latency to 5s, then you can lose up to 5s of data in case of a system crash).
I agree. it would be very useful.
thc
Level 2
Level 2
Posts: 8
Joined: Sat Oct 23, 2021 9:37 pm

Re: Defer-Write with L1 and L2

Post by thc »

Like everything in life, there are always several perspectives or scenarios, everything is about 'knowing' your system perfectly. Here, one hour defer-write on system/boot and application partitions, and infinite defer-write on the rest.

Larger defer-writes:

Pros:

- max performance
- max efficiency (it is a real joy to see how your system saves between 70-85% of redundant/cyclic writes, which is perfect for the typical strategy of game installation > game ntfs compression > game defragmentation)

Cons:

- involves manually flushing the cache

Be that as it may, I think that the concept of 'data loss' is notoriously overrated for a user with a medium profile who does not obviously handle data that is too critical, that is, the vast majority. In my humble experience, in BSODs the first thing that usually gets corrupted is the MFT, nothing that the 'chkdsk' command can't fix. In system partition, if Windows is unable to restart, most of the cases it is due to the corruption of the Windows registry, more specifically the SYSTEM hive file, which is very easily recoverable as long as backups are made of said registry.
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: Defer-Write with L1 and L2

Post by Support »

Styx wrote: Mon Oct 25, 2021 3:25 pm May I suggest an advanced option when Defer-write is enabled using an L2 cache ?
The option would be: "persist dirty block map" and when enabled, it would actually flush the dirty block map on the L2 cache (persistent) each time a time interval specified by Latency expires.
This way, it allows a user to use the defer-write with some level of protection against data loss (i.e max data loss = latency, so if you set latency to 5s, then you can lose up to 5s of data in case of a system crash).
Currently, whether using L1 or L2, max data loss = latency (though it is possible that lost data is updated file system metadata by chance). What we think and other users request is to make L2 defer-write 100% no loss, able to recover data after a crash. That's complicated.
Post Reply