Primocache Prefetching from HDD and not SSD? Topic is solved

FAQ, getting help, user experience about PrimoCache
InquiringMind
Level SS
Level SS
Posts: 477
Joined: Wed Oct 06, 2010 11:10 pm

Re: Primocache Prefetching from HDD and not SSD?

Post by InquiringMind »

lordsnipe wrote: Fri Jan 15, 2021 8:50 pm
InquiringMind wrote: Fri Jan 15, 2021 3:22 pmIt could, but that relies on the L2 cache being current and correct (and there are a number of cases why this may not apply on system startup). Loading pre-fetch from the original data is the safest option and provides an extra opportunity for PrimoCache to check L2 (whether it actually does so is a question for Support).
I don't think that's the reason why it fetches from the HDD. Primocache uses registry entries to determine if the L2 contents are out of date and also says offline modification of files is a no no...
Registry entries aren't a perfect solution - they may not be updated during a system hang or crash (PrimoCache does invalidate L2 if it detects an abnormal Windows startup - but a system hang, as opposed to a BSOD, may not trigger that). And saying that avoiding offline modification is the user's responsibility doesn't stop it happening.

So there is the possibilty of L2 cache being invalid without being detected, and that could lead to data corruption if it was used as the source for L1.
janusz521 wrote: Sun Jan 17, 2021 12:24 pm Personally, I think that prefetch should not be set by default. It may be useful when someone is working with a specific set of applications all the time and wants them to run at full speed right after the boot. However quite often people work with different apps/games on every session so prefetch loads quite a lot of unneeded data that will be soon discarded. It may take some time too...
Directories/folders (and associated metadata) usage will typically not vary, and these can benefit from Prefetch (I use a snapshot-based install monitor - scanning an 850GB SSD volume usually takes 30 seconds but with pre-fetch it comes down to 10). Utilities like WinDirStat also show similar benefits.

That's not to say that some data may be cached unnecessarily - but the overheads of discarding that data are minimal and the pre-fetch process itself seems to use idle time on startup (and takes about 20-30 seconds to complete from SSD in my case).
QuantumX
Level 2
Level 2
Posts: 5
Joined: Mon Jan 11, 2021 6:30 am

Re: Primocache Prefetching from HDD and not SSD?

Post by QuantumX »

Support wrote: Mon Jan 18, 2021 12:18 pm Yes, currently PrimoCache prefetch data from underlying disks in order not to interfere L2. But we are considering to allow prefetch from L2 for better performance. Thanks.
I would like to upvote a prefetch from L2 feature. I currently avoid using prefetch since it takes about 5min to prefetch 8GB L1 from a 2.5" HDD.

Perhaps when this feature is implemented it can be done in such a way that the "most recent" or "most used" data in L2 can be pulled into L1 upon prefetch to maximize the L1 hit rate.

For example I have 512GB L2 and 8GB L1 so upon prefetch Primocache can move the most used ~8GB of the 512GB L2 data into L1.

Another way could be to have L1 filled by file size. This way all the smallest files will be put into L1 since L1 4K Q1T1 read speed is in most cases 10x faster than L2 (NVMe) 4K Q1T1 read speeds.

For example if I run PowerShell code

Code: Select all

"{0:N2} GB" -f ((Get-ChildItem -Path "C:\" -Recurse | where Length -lt 512KB | measure Length -s).Sum /1GB)
on my current system the result is 8.12GB. Which means that 8GB L1 cache is enough to fit 99% of files 512KB and smaller from my C: drive.

Speaking of this, just a simple "file size limit" for L1 could be useful also then if activated the user can choose to only fill L1 data with files smaller than specified size. This combined with prefetch from L2 will ensure that most, if not all, of smallest files from a cached volume will run from L1.

Even with highest tier PCIe 4.0 NVMe drives (bar Optane) with huge marketing numbers of 7GB/s reads the 4K Q1T1 reads barely exceed 50-60 MB/s whereas L1 with 3200MHz DDR4 does over 500MB/s 4K Q1T1 read in my testing. So for single thread transfers of very small files the L1 cache will still be 10 - 25x faster than the best PCIe 4.0 L2 cache on the market.

With larger files this advantage of L1 decreases to only 1.5x when compared to a good PCIe 4.0 L2, and L1 will provide an intangible difference over L2 in real world usage. So to maximize the benefit of L1 it makes sense, in my mind at least, to limit it to speed up only small files.

I appreciate that this might be much harder to implement than I made it sound.
TomB
Level 5
Level 5
Posts: 44
Joined: Wed Jul 29, 2020 11:15 pm

Re: Primocache Prefetching from HDD and not SSD?

Post by TomB »

Upvote +1 on previous post.

Especially the file size limit for L1 fill, whether prefetch or not, for the reasons given by QuantumX. Namely, because by far the slowest disk accesses are the small (4kb) transfer sizes with low queue depths and number of threads.

I think that just by limiting L1 fill size to 4kb, whether prefetched or not, then I could commit much less RAM to L1 on my C: drive (Samsung 970 EVO Plus, PCIe 4x, NVMe v1.3) and still get probably 90% of the benefit I get on that drive (I currently commit 8GB for L1 and I think I could lower that to 2GB or even 1GB).

I have no L2 on the C drive, but for the same reasons I would project similar results on my 1TB spinner for D drive, because I have 20% L2 coverage for that drive plus 4GB L1.

I know that PrimoCache is a block-level rather than file-level caching system, so thank you very much for even considering this.

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

Re: Primocache Prefetching from HDD and not SSD?

Post by Support »

This feature is planned now, thank you everyone!
RobF99
Level 8
Level 8
Posts: 130
Joined: Fri Sep 19, 2014 5:14 am

Re: Primocache Prefetching from HDD and not SSD?

Post by RobF99 »

FYI, I have been using the product for years and I do not use Prefetch. Data that it would prefetch will already be in L2 cache. With an SSD of the speed you are using, or even any SSD, just wait until you need to organically read the data during PC use and first time, it is going to come from L2 anyway. So you will avoid the 4.5 minutes of wait time to fill the L1 cache from the hard drive when you could be using the PC and getting SSD read rates anyway - plus they will then go into L1. I hope that makes sense.
RobF99
Level 8
Level 8
Posts: 130
Joined: Fri Sep 19, 2014 5:14 am

Re: Primocache Prefetching from HDD and not SSD?

Post by RobF99 »

TomB wrote: Wed Feb 10, 2021 1:48 am I think that just by limiting L1 fill size to 4kb, whether prefetched or not, then I could commit much less RAM to L1 on my C: drive (Samsung 970 EVO Plus, PCIe 4x, NVMe v1.3) and still get probably 90% of the benefit I get on that drive (I currently commit 8GB for L1 and I think I could lower that to 2GB or even 1GB).
FYI, I have a 32 Gb system and I actually allocate 24 Gb of this to L1 with 350 Gb of an SSD for L2. Yes, this leaves me with only an "8 Gb" system but I find that I rarely even have 4 Gb used by my OS and always have around 4 Gb free memory sometimes as much as 6 Gb. I would prefer to let PrimoCache do all my caching instead of Windows since you can clearly see a difference when data is cached as L1 compared to when Windows is doing most of the caching.

I don't use prefetch but a couple of other "tricks" I do to prewarm the cache is upon startup and logon I have a batch file that reads all of the pf files in my Windows Prefetch folder so any prefetching Windows needs to do when launching a program, the .pf file is already in L1.

If you want to get all of your small files into L1 and especially into L2 where you will always get more performance compared to a spinner is to use a batch file that uses Robocopy to copy all files below a certain size to a small SSD partition which you can then delete the files from or reformat. This at least performs a read on those files and gets them onto L2. You can set it up to run on a schedule, say once a week. Programs that read a lot of smaller files on launch such as Photoshop launches in seconds. You see a dramatic difference in performance when those small files are on L2. This is the intent of utilities such as Readyboost, which is to get those small files onto a solid state drive.
QuantumX
Level 2
Level 2
Posts: 5
Joined: Mon Jan 11, 2021 6:30 am

Re: Primocache Prefetching from HDD and not SSD?

Post by QuantumX »

RobF99 wrote: Sat Feb 20, 2021 3:05 pm This at least performs a read on those files and gets them onto L2.
Good idea. :thumbup: Even more so now since they will implement prefetch from L2.

If anyone wants to try it here is the code for a script. It copies all files up to size 64KB from D: to Z:\temp\SFC. Drives letters should be changed as required.

Code: Select all

del /s Z:\temp\SFC /f /q
rmdir Z:\temp\SFC /s /q
mkdir "Z:\temp\SFC"
RoboCopy.exe  "D:\\" "Z:\temp\SFC" *.* /E /J /COPY:D /MT:8 /IS /MAX:65536 /XJ /R:1 /W:1 /NS /NFL /NP /LOG:"Z:\temp\SFC\sfc.txt"
If you run the script a second time, and reset your cache statistics before doing so, you should get a near 100% hit rate after the script finished. This is to confirm that all the files were indeed added to L2
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: Primocache Prefetching from HDD and not SSD?

Post by Support »

Now we have added the option of prefetching from L2 in version 4.3.0.
Thank you all.
Post Reply