caching behavior with windows built-in cache; and other generic questions Topic is solved

FAQ, getting help, user experience about PrimoCache
SnowReborn
Level 4
Level 4
Posts: 34
Joined: Sun Dec 02, 2012 3:13 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by SnowReborn »

Support wrote: Sun May 14, 2023 6:32 am
SnowReborn wrote: Thu May 11, 2023 9:11 pm From my observation correct me if i am wrong, primocache will save anything regarding disk activity that it can record(excluding read activity served by windowsd builtin cache since it doesn't see it), into L1 as long as it has space, but things I would like some explanation is that, once L1 is full, how 's the L2 cache going to store any data and cache, what's the behavior(it seems different from L1), and how does primocache decide which cache to kick out first for both L1, and L2? is it FIFO? LIFO? or LFU? under what condition?(L1 L2 full? or there is a timer to kick it out dependent frequency of being used?) If I am not mistaken, I have also seen behavior that despite my L2 is not full(200GB space left) I see primocache releases some of the cached content(is it because the cached target file was physically deleted from the disk? or is because the algorithm has decided it hasn't seen any read request for that cache for a long time, and is never being used, so it gets deleted?) because if target(original file on disk) were deleted, then the cache probably serves no purpose and should be deleted, that's fine; However, if the cache was deleted because it was not being used, while there are still plenty space on the L1 or L2, then that's not a behavior I want to see. I am again tempted to use ISLC to clear windows memory cache to ensure primocache to read all the data and store them properly so I don't have to deal with reading from hard disk when my RAM utilization is very high and windows clears all it's cache.
L2 caches data differently than L1. L2 caches data asynchronously. Even data has already been cached in L1, it still can be cached in L2. For reading cache, we use a dedicated LFU-based algorithm for both L1 and L2. If a file is deleted, its corresponding cached data will also be removed from the cache.
Thanks for the info support. Can you please elaborate a little more details? if it's Least Frequently used-based algorithm, then that means the least used cache data will be kicked out first, but under what condition? Is there a timer, say 10 hours, to kick the least used cache out? Or is it only going to kick out the cache when the cache storage is full, or when target source file has been deleted?

Are there ways for primocache to monitor and "register counts" for the cache served by windows cache so it is not "least used" in primocache's perspective? Under my circustances, should I start to use ISLC to clear out windows cache so primocache can properly track of cache usage pattern?

I have another separate question: I use defer write on L1 alot. However, a lot of circumstances has been defer write with indefinite flush timer; This is due to the large dataset in nature, and most of the write operation are temporary, and the data is deleted afterwards, so there is no reason for the data to be flushed to the disk. However, there are some cases where the data needs to be flushed, and due to the nature primocache defer write puts data as sequential as possible, this is a really nice feature to "defragment small files" before small files are scattered around hard disks. I understand when defer write is set to infinite, flush only happens when you manually flush, or when cache is full / outspace. My question would be: 1, let's say we have 20 GB defer write cache(write cache ONLY), and it's full now (20/20GB used with 32mb left). If i click manual flush, it will make a copy of cache to the target disk(flush), while preserving the write cache(still full with 20/20GB and 32mb space left). In this case, does that mean if a new 5GB file write request is issued, primocache in this case will instantly free 5GB space for least used, and already flushed space for the new write request? if it is true, does this also happen on interval timer? say instead of defer write of infinite time, we set to 10 seconds. So every 10 seconds it should flush all "unflushed" cache to disk, so all "flushed" cache should be ready to instantly be released for up coming new cache?
SnowReborn
Level 4
Level 4
Posts: 34
Joined: Sun Dec 02, 2012 3:13 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by SnowReborn »

also if be nice if you can answer my original question about upgrading the license as well "Another question is, I understand standard license can be upgraded to pro license, but can standard / pro license be able to upgrade to server license? or is sever license separate and has to be bought separately? Thanks!"
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by Support »

SnowReborn wrote: Sun May 14, 2023 6:37 pm also if be nice if you can answer my original question about upgrading the license as well "Another question is, I understand standard license can be upgraded to pro license, but can standard / pro license be able to upgrade to server license? or is sever license separate and has to be bought separately? Thanks!"
viewtopic.php?p=17823#p17823
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by Support »

SnowReborn wrote: Sun May 14, 2023 6:17 pm Thanks Support, It seems like I only encountered BSOD under very long flush, that is probably more than 10+ minutes. I am not sure under such extreme condition would have unexpected behavior even with the mechanism implemented, I don't know if I would want to try to reproduce the issue, but maybe I was thinking, it would be probably better implementation if primocache can detect a restart / shutdown command has been issued, and give a pop up or intercept the command before user gets locked in blue "restarting" or "shutting down" phase where nothing can be done.
In general, "INFINITE" + Native mode is strongly discouraged. Because the size of the cache space is limited, it is extremely easy to trigger Urgent Writes which have bad performance. See https://www.romexsoftware.com/en-us/pri ... write.html

PrimoCache is designed to run with only drivers and no user applications. We will consider whether the design should be changed to monitor shutdown events. Thanks for your advice.
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by Support »

SnowReborn wrote: Sun May 14, 2023 6:36 pm Thanks for the info support. Can you please elaborate a little more details? if it's Least Frequently used-based algorithm, then that means the least used cache data will be kicked out first, but under what condition? Is there a timer, say 10 hours, to kick the least used cache out? Or is it only going to kick out the cache when the cache storage is full, or when target source file has been deleted?
Only when cache space is full or source files have been deleted.
SnowReborn wrote: Sun May 14, 2023 6:36 pm Are there ways for primocache to monitor and "register counts" for the cache served by windows cache so it is not "least used" in primocache's perspective? Under my circustances, should I start to use ISLC to clear out windows cache so primocache can properly track of cache usage pattern?
Sorry, currently no. I don't think you need to use ISLC to clear out Windows cache. Windows cache is layered above PrimoCache. It's a file-level caching program while PrimoCache is a disk-block-level caching program. Windows looks for file cache first, if not found, it will check file data location in the disk and send read/write requests to PrimoCache (volume/disk). If Windows file cache hits, no need to look for the file system to find file data info and read/write data, saving process time and making read/write faster.
SnowReborn wrote: Sun May 14, 2023 6:36 pm In this case, does that mean if a new 5GB file write request is issued, primocache in this case will instantly free 5GB space for least used, and already flushed space for the new write request? if it is true, does this also happen on interval timer? say instead of defer write of infinite time, we set to 10 seconds. So every 10 seconds it should flush all "unflushed" cache to disk, so all "flushed" cache should be ready to instantly be released for up coming new cache
If you want the flushed cache to be used first, you can check the option "Free Cache on Written".
SnowReborn
Level 4
Level 4
Posts: 34
Joined: Sun Dec 02, 2012 3:13 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by SnowReborn »

Support wrote: Tue May 16, 2023 6:55 am
SnowReborn wrote: Sun May 14, 2023 6:17 pm Thanks Support, It seems like I only encountered BSOD under very long flush, that is probably more than 10+ minutes. I am not sure under such extreme condition would have unexpected behavior even with the mechanism implemented, I don't know if I would want to try to reproduce the issue, but maybe I was thinking, it would be probably better implementation if primocache can detect a restart / shutdown command has been issued, and give a pop up or intercept the command before user gets locked in blue "restarting" or "shutting down" phase where nothing can be done.
In general, "INFINITE" + Native mode is strongly discouraged. Because the size of the cache space is limited, it is extremely easy to trigger Urgent Writes which have bad performance. See https://www.romexsoftware.com/en-us/pri ... write.html

PrimoCache is designed to run with only drivers and no user applications. We will consider whether the design should be changed to monitor shutdown events. Thanks for your advice.
Really appreciate all the answers! You've cleared most of my concerns, but I still got a three more questions. I understand from the online manual, and past supports' response towards defer write + infinite. I understand urgent write is bad for performance and can potentially be slower than hard drive native speed; But when I do use it, I want to ensure no data is being flushed to my main disk because 99% of the write operation will be temporary(intermediate computing), and will be deleted before it gets flushed to disk, and the write is very large in size, sometimes 10~20GB every couple minutes, but after the dataset has been written and computation is complete, it gets deleted, and final output is only couple MBs. Only concern is, you and past support responses has always been very critical about defer write + infinite interval. Are there any concerns for data integrity? I don't mind occasional performance hit when large urgent write happens, because it's in a very controlled enviroment with large L1, but sometimes it's inevitable when i run into mass urgent writes; so please help me confirm that, despite the perf hit, there are no other drawbacks for this!

I understand from version 4.1 there is a new feature to check L2 cache integrity based on (Last good boot); If I cached in 100GB read only data, properly restarted, and next time i cached additional 150GB data, total 250GB, and suddenly BSOD, from my understanding primocache will recover the initial 100GB data from last good boot, and discard the new 150GB from last good boot to ungraceful shutdown. Is it correct? For maximum data safety, If I encountered unexpected crash, Should I just discard all my caches(this is what I been doing)?

Last question. this is my experience using primocache 4.3 with the new freeze cache feature which has been very helpful and very useful; But i still one special scenario I'd like to ask some advise of; It would be really nice if we can indepedently freeze L1, L2. So let's say my F: drive is my data process partition. I have allocated 500GB L2 cache to it for read cache only. Now, I also want to allocate 50GB of L1 RAM cache for infinite defer write. Now What would be the best way to "freeze L2 cache" to have it serve read-only cache and not gather any new data to cache, while still allow L1 cache to take in defer write + serving cache? - if cache isn't frozen, after I wrote 25GB to F:, it will cached in defer-write L1, and if the 25GB are read by my program, L2 will register and try to save it in L2(which I don't want); one potential work around for me right now is to set L2 data gather interval to be maximum(250 seconds), and delete the data set in L1 defer-write before the timer expires and gets flushed to L2. Or set L2 gather at idle only, but at the moment this is not super convenient than having a indepedent L1 L2 freeze option. Thanks again for everyone whos helping me!
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by Support »

SnowReborn wrote: Tue May 16, 2023 11:30 pm Only concern is, you and past support responses has always been very critical about defer write + infinite interval. Are there any concerns for data integrity? I don't mind occasional performance hit when large urgent write happens, because it's in a very controlled enviroment with large L1, but sometimes it's inevitable when i run into mass urgent writes; so please help me confirm that, despite the perf hit, there are no other drawbacks for this!
Performance is one aspect to consider. On the other hand, the longer the latency, the higher the risk of data loss. This is because write-data is first stored in the cache when Defer-Write is enabled, rather than being written to the disk in real time, in the event of a sudden power failure, system crash or freeze, the data will have no chance to be written to the disk, resulting in loss.
SnowReborn wrote: Tue May 16, 2023 11:30 pm If I cached in 100GB read only data, properly restarted, and next time i cached additional 150GB data, total 250GB, and suddenly BSOD, from my understanding primocache will recover the initial 100GB data from last good boot, and discard the new 150GB from last good boot to ungraceful shutdown. Is it correct? For maximum data safety, If I encountered unexpected crash, Should I just discard all my caches(this is what I been doing)?
Yes, correct. PrimoCache now can verify data by comparing source data and cached data to ensure cached data is 100% correct. It may read lots of data from source disk, so if you don't want this process, you can disable it in the advanced L2 settings. Then PrimoCache will discard all cached data.
SnowReborn wrote: Tue May 16, 2023 11:30 pm Now What would be the best way to "freeze L2 cache" to have it serve read-only cache and not gather any new data to cache, while still allow L1 cache to take in defer write + serving cache? - if cache isn't frozen, after I wrote 25GB to F:, it will cached in defer-write L1, and if the 25GB are read by my program, L2 will register and try to save it in L2(which I don't want); one potential work around for me right now is to set L2 data gather interval to be maximum(250 seconds), and delete the data set in L1 defer-write before the timer expires and gets flushed to L2. Or set L2 gather at idle only, but at the moment this is not super convenient than having a indepedent L1 L2 freeze option.
Sorry, there are currently no options available for your situation. The current programming design cannot support independent L1/L2 freeze option. They must be done together. However, I will suggest to our developers to add a new option to prevent L2 from collecting new data, for eg. set Gather Inteval to "No Gather".
SnowReborn
Level 4
Level 4
Posts: 34
Joined: Sun Dec 02, 2012 3:13 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by SnowReborn »

Support wrote: Fri May 19, 2023 4:00 am
SnowReborn wrote: Tue May 16, 2023 11:30 pm Only concern is, you and past support responses has always been very critical about defer write + infinite interval. Are there any concerns for data integrity? I don't mind occasional performance hit when large urgent write happens, because it's in a very controlled enviroment with large L1, but sometimes it's inevitable when i run into mass urgent writes; so please help me confirm that, despite the perf hit, there are no other drawbacks for this!
Performance is one aspect to consider. On the other hand, the longer the latency, the higher the risk of data loss. This is because write-data is first stored in the cache when Defer-Write is enabled, rather than being written to the disk in real time, in the event of a sudden power failure, system crash or freeze, the data will have no chance to be written to the disk, resulting in loss.
Thanks again support for answering my questions. sorry I have been very busy lately. I understand we have went over this but I feel there are still ambiguity with this issue. I just want to really really really make sure and re-iterate what I mentioned to ensure my understanding is correct. because I use this feature in the way i mentioned alot.

1. I understand long / infinite defer write is bad because once L1 is out of space, it will trigger urgent write, which is bad for performance and could be slower than native disk speed.
2. long / infinite defer write is bad because the data accumulated in L1 and not being flushed to disk, in the case of system crash all data not flushed to disk will be lost or corrupted.

I am well aware of above statements, I have legitimate need to have it on infinite defer write; But I also treat my data integrity with upmost standard. with any possible or smallest possibility of data corruption occured, I will full disk image restore(I have periodic full disk backups enabled), and a UPS. If my PC crashes(very rarely, maybe 2~5 times a year), it doesn't matter if I have my defer write on infinite, 300 seconds, 10 seconds, or 1 seconds. I will use image to completely restore my data for all drives that had defer write enabled.

The only concern and worry I have is, other than the 2 draw backs of defer write long / infinite you mentioned, are there any possible draw backs like data corruption due to urgent write, or out of L1 cache? or any other draw back from using defer write if my system do NOT crash?


Lastly, since we are touching on the issue of defer write and data integrity. I have some finding and questions as well.
I will share some of my finding briefly here, possibly I will start another thread explaining in detail to spread awareness, but I use macrium reflect as my backup of choice, but in default mode of macrium with RDR enabled could result in data corruption/ incomplete restore due to possible corrupted MFT. I have brought the issue to macrium reflect support and they aren't really taking it seriously, and this issue with primocache defer write could happen much more frequently and snowball into a much larger data integrity issue(note this is completely macrium's fault, not primocache).

A question I have regarding data integrity / offline modification. In the past I mentioned I use primocache on my main windows 10 OS, and I do have the need to use another win 10 OS, and linux. However, in the past I've tried, and asked support if there are any good ways to prevent "offline modification", but not alot of good resolution exist. So as a workaround I have been manually disconnecting all my drives that are cached by primocache, the cache drive, and OS drive that has primocache installed on, if i want to dual boot another system in another drive. This is obviously very tedious and inefficient, but ensures data integrity and no modification can happen with physical isolations; now. the question I have for support is. If i were to install vmware vSphere (EXSI) as level 1 hypervisor, create my the OSs as VMs on top of exsi, then physically attach my hard drives with RDM(Raw Device Mapping) to my main OS(with primocache). Will this be a good choice for dual or multi OS enviroment? Since all hardwares are managed by vSphere Exsi, and it should be a software level of (hardware isolation); which should essentially prevent any data being access or modified offline by other OS. I would like to know if this is a viable solution to prevent offline modification? Is Primocache designed to work under this kind setup?(can primocache work with RDM / Exsi env?) Are there possible issues for primocache to be under such complex enviroment? Have primocache been tested or used under such enviroment?

Another potential workaround than tediously physically disconnect all the drive would be, I first delete all cache on primocache from OS#1, I boot into OS#2, OS#3, "offline" or dismount letters of all drives associated with OS#1 including cached drives, caching drives, and OS drives. Then go back OS#1 to re-enable re-configure cache for OS#1. Then now if i boot into OS#2 or OS#3, OS#2 and OS#3 has set the corrsponding disks to "offline" or "dismount" so in theory there will be no "read / write" activity to those target drives, and hence no offline modification. Am I right? But since this just in theory, there is no way to physically prevent modification, so I do not trust this workaround, and believes more in physical or software based hardware isolation. Please also give me some feedback on what you think about this approach, other than exsi, is this also a potential viable way to prevent offline modification?
Thanks!
Last edited by SnowReborn on Tue May 23, 2023 11:49 pm, edited 4 times in total.
SnowReborn
Level 4
Level 4
Posts: 34
Joined: Sun Dec 02, 2012 3:13 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by SnowReborn »

Support wrote: Fri May 19, 2023 4:00 am
SnowReborn wrote: Tue May 16, 2023 11:30 pm Now What would be the best way to "freeze L2 cache" to have it serve read-only cache and not gather any new data to cache, while still allow L1 cache to take in defer write + serving cache? - if cache isn't frozen, after I wrote 25GB to F:, it will cached in defer-write L1, and if the 25GB are read by my program, L2 will register and try to save it in L2(which I don't want); one potential work around for me right now is to set L2 data gather interval to be maximum(250 seconds), and delete the data set in L1 defer-write before the timer expires and gets flushed to L2. Or set L2 gather at idle only, but at the moment this is not super convenient than having a indepedent L1 L2 freeze option.
Sorry, there are currently no options available for your situation. The current programming design cannot support independent L1/L2 freeze option. They must be done together. However, I will suggest to our developers to add a new option to prevent L2 from collecting new data, for eg. set Gather Inteval to "No Gather".
Thanks! L2 gather interval with "No Gather" would be nice. Looking for that new feature for next update!
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: caching behavior with windows built-in cache; and other generic questions

Post by Support »

SnowReborn wrote: Tue May 23, 2023 7:40 pm The only concern and worry I have is, other than the 2 draw backs of defer write long / infinite you mentioned, are there any possible draw backs like data corruption due to urgent write, or out of L1 cache? or any other draw back from using defer write if my system do NOT crash?
No, there aren't.
SnowReborn wrote: Tue May 23, 2023 7:40 pm If i were to install vmware vSphere (EXSI) as level 1 hypervisor, create my the OSs as VMs on top of exsi, then physically attach my hard drives with RDM(Raw Device Mapping) to my main OS(with primocache). Will this be a good choice for dual or multi OS enviroment? Since all hardwares are managed by vSphere Exsi, and it should be a software level of (hardware isolation); which should essentially prevent any data being access or modified offline by other OS. I would like to know if this is a viable solution to prevent offline modification? Is Primocache designed to work under this kind setup?(can primocache work with RDM / Exsi env?) Are there possible issues for primocache to be under such complex enviroment? Have primocache been tested or used under such enviroment?
Sorry, we haven't tested this kind of setup. Theoretically, it is possible as long as L2 doesn't cache drives mapped to VMs.

Another easy way is just tick the option "Volatile Cache Contents" in the advanced L2 cache settings before you boot into another OS. Thus L2 will be reset when you go back to the OS. The drawback is all L2 cached data will be lost.
Post Reply