How much L2 cache? Backups?

FAQ, getting help, user experience about PrimoCache
User avatar
RAMbo
Level 6
Level 6
Posts: 73
Joined: Wed May 11, 2011 7:50 am

How much L2 cache? Backups?

Post by RAMbo »

L2 cache is not persistent between reboots.
How often is the data written back to the medium it's cached from? Is it
the same time as the deferred setting for L1?

L1 cache is 200MB
L2 cache is an SSD

If I'm working on a 50MB file I assume that takes place in L1 cache. Right?

What happens if I work on 1GB file?
Is it moved to L2 as a whole? Or just active blocks?
If the access to that 1GB files is very random (say a database) what
happens then? No caching at all?


Like everyone I like speed, but at what cost does it come? I have
frequent automatic backups scheduled and I don't want missing or corrupt
files because FancyCache is doing 'something'.



I'm planning to buy a SSD that I'll use as L2 cache only.

How big should that SSD be? Is there a rule to roughly calculate the best size?

I also would like to know how the L2 works.
AMD's StoreMI gives a great speed increasement in both read and write. But it does so by moving frequently used files from HDD to SSD.
I don't like that because it makes backups more complex because I don't know where the files are.
Does PrimoCache L2 work in a similar way?
User avatar
Jaga
Contributor
Contributor
Posts: 692
Joined: Sat Jan 25, 2014 1:11 am

Re: How much L2 cache? Backups?

Post by Jaga »

RAMbo wrote:L2 cache is not persistent between reboots.
You can tell it to be persistent if you setup the Cache Task as read/write. It will hold a "copy" of what it's written out and stay as full as it can at all times, and you can tell it to reload that cache at boot time. Simply turn off the "Free Cache on Written" feature, so it holds contents even after writing.

RAMbo wrote:How often is the data written back to the medium it's cached from? Is it
the same time as the deferred setting for L1?
The write cache can be set to use different algorithms. Both the L1 and L2 use the same algorithm inside the same cache task. Click the "Advanced defer write options" icon to the right of the time dropdown and read about the different options. These work directly with the write time you choose in that dropdown to control how often and how aggressive the L1/L2 write out.

RAMbo wrote:L1 cache is 200MB
L2 cache is an SSD

If I'm working on a 50MB file I assume that takes place in L1 cache. Right?

What happens if I work on 1GB file?
Is it moved to L2 as a whole? Or just active blocks?
If the access to that 1GB files is very random (say a database) what
happens then? No caching at all?
If you had previously read it into the L1 so it was already there, yes. If not, then when you loaded the file it would load it into the L1, so the next access of the data was available for it there. Note: there is some "weighing" of the data accessed - Primocache tries to keep the most often accessed data in the cache at all times.

The same applies to a 1GB file - if it's already in the cache, part will reside in the L1, and part in the L2. If the L1 can't hold the entire file (as in the case of a 1GB file with your settings), then the remainder will try to be placed in the L2. It's always a case of either the most recently accessed blocks, or the most frequently accessed blocks - Primocache determines what's appropriate.

If it was a 1GB database with frequent randomly accessed areas of the file, those blocks would be held and given priority over less frequently accessed cache data. There's no way to pre-load a file or folder currently however, it's been asked for as a future feature.

RAMbo wrote:Like everyone I like speed, but at what cost does it come? I have
frequent automatic backups scheduled and I don't want missing or corrupt
files because FancyCache is doing 'something'.
I use the following .bat file script with my backup software to temporarily pause Primocache, flush any deferred writes, preserve the current data in L1/L2, run the backup, then un-pause Primocache and reset caching statistics so they aren't affected by backup activity:

Code: Select all

rxpcc pause -a -s
timeout 10
cd "C:\Program Files\Macrium\Reflect"
Reflect.exe -e -w "C:\Users\username\Documents\Reflect\My Backup.xml" -full
timeout 10
rxpcc resume -a -s
timeout 5
rxpcc perf -a -r -s
RAMbo wrote:I'm planning to buy a SSD that I'll use as L2 cache only.

How big should that SSD be? Is there a rule to roughly calculate the best size?
I like to have a L2 that's no smaller than 10% of the actual data on the drive, but I also like high hitrates, so even 5% may be enough for a L2. That means if you want to cache 10TB of data with a L2 SSD, you'd want to give Primocache a 1TB SSD. If you're only caching 500GB of data, then a 50GB L2 volume would be enough. If you can handle a slightly lower hitrate, even a 25GB volume to cache 500GB of data may be enough, though I always try to give it as much as possible. It works best when it has "room to breathe".

RAMbo wrote:I also would like to know how the L2 works.
AMD's StoreMI gives a great speed increasement in both read and write. But it does so by moving frequently used files from HDD to SSD.
I don't like that because it makes backups more complex because I don't know where the files are.
Does PrimoCache L2 work in a similar way?
Primocache works completely on a "block" level with the disk (pieces of files). On a read/write Cache Task, anything that's written to the drive passes through the L1/L2 first, then is written out to the disk based on the time and strategy you defined when you set up the Cache Task. Anything that's read from the disk, Primocache checks the L1/L2 first to see if it's there, and if it is you get super fast access. If it isn't there already it fetches it from the drive and places those blocks in the L1/L2 for subsequent fast access. It always tries to keep the cache(s) as full as possible, to get the highest hit rates. It is fully transparent and doesn't mess with files/locations at all. It will never move a file, or alter it's contents beyond what you do with the Operating System (copies/moves/edits/deletes). And it can be set to prefetch at boot time, further increasing the speed of applications/files accessed after. It always works with copies of blocks of data, never moving the actual data into/out of the caches.
User avatar
RAMbo
Level 6
Level 6
Posts: 73
Joined: Wed May 11, 2011 7:50 am

Re: How much L2 cache? Backups?

Post by RAMbo »

There's no way to pre-load a file or folder currently however, it's been asked for as a future feature.
Still using my 1GB database example: Isn't so that PrimoCache does pre-load the whole file if it knows from past experience it's a very active set of blocks? It takes a while, but say PrimoCache learned this after 'wactching' my diskaccess for a week?


Thanks for the script! I'll likely ask some questions about it later when I have L2 cache running. I still in the process of buying a SSD for L2 cache only.
BTW I use Macrium Reflect for to image my disks. For backups I use AISBackup. I keep between 1 and 40 generations of my files on two disks. Making it between 2 and 80 generations of each file in total.


The problem is this, I have two backup regimes running at all times. Daily all changed files are backed up. Every hour my important files are backed up. Those files are the most active ones. The most likely ones to be found in L1 or L2 cache.
Doesn't it hurt performance if I flush cache every hour?


About your SSD size recommendations. Where do those numbers come from? I'm not trying to insult you or anything like that. In fact I thank you for your in depth answers. I'm just wondering that info is somewhere in the PrimoCache manual or that you figured this out by experience?

Is it to increas the SSDs lifespan? Somewhere on this forum Romex warned that L2 cache is a real disk trasher that wears down the SSD quite quikly.
I used a 1 GB database in my example because that's easiest understood by many. I reality I do have a lot of stuff on my HDDs but what I actively work on is vastly smaller than 1 GB.
My System disk is 1TB Samsung 850 EVO. It my not be the fastest on the market but I want to keep using it until prices come down and I can make my PC SSD only.
Most things are installed on that drive, but for reasons I can't even explain I want some things to remain on my old HDD.
I could partition my System SSD because it has enough free space for that. But because PrimoCache is a disk trasher I won't.
I still have to figure out the best size but I think a 128GB cache SSD would be enough for my purposes. Even when taking your 10% rule into account. But likely I'll buy a 256GB SSD because they are the better deals. At only $50, it wouldn't be that bad if dies in two years. My big hope is that by then prices have come down so much L2 becomes obsolete because I'm all SSD by then :-)


Once again thanks for your answers. I feel more safe now trying L2.
User avatar
Jaga
Contributor
Contributor
Posts: 692
Joined: Sat Jan 25, 2014 1:11 am

Re: How much L2 cache? Backups?

Post by Jaga »

RAMbo wrote:Still using my 1GB database example: Isn't so that PrimoCache does pre-load the whole file if it knows from past experience it's a very active set of blocks? It takes a while, but say PrimoCache learned this after 'wactching' my diskaccess for a week?
There's no way to force a pre-load of an entire, contiguous file (regardless of whether or not any of it's blocks are in cache). Primocache decides which parts of it are in memory based on frequency of use. I requested the force-pre-load feature as a right-click on a file or folder some time ago, and I think it's something Romex is working on, but it doesn't exist yet. So for now we just rely that Primocache is doing it's job correctly and keeping the most frequently used blocks in L1/L2.

RAMbo wrote:Thanks for the script! I'll likely ask some questions about it later when I have L2 cache running. I still in the process of buying a SSD for L2 cache only. BTW I use Macrium Reflect for to image my disks. For backups I use AISBackup. I keep between 1 and 40 generations of my files on two disks. Making it between 2 and 80 generations of each file in total.
Sounds useful. I'm happy with Macrium for both workstation and server, though when I migrate the server to WSE 2016 I'll probably switch to Veeam, for the Hyper-V support.

RAMbo wrote:The problem is this, I have two backup regimes running at all times. Daily all changed files are backed up. Every hour my important files are backed up. Those files are the most active ones. The most likely ones to be found in L1 or L2 cache. Doesn't it hurt performance if I flush cache every hour?
The script I posted doesn't flush the cache, it simply pauses it while the backup runs, so that blocks you wouldn't otherwise want in the cache are kept out. It restarts after the backup, preserving what was already in the cache and continuing operation as usual.

RAMbo wrote:About your SSD size recommendations. Where do those numbers come from? I'm not trying to insult you or anything like that. In fact I thank you for your in depth answers. I'm just wondering that info is somewhere in the PrimoCache manual or that you figured this out by experience?
Correct, purely by experience using Primocache. I first started using it when it was still called Fancycache, actually a very early version many years ago. Normally I try to throw as many resources at Primocache as possible, since it's very good at what it does. The more headroom it has, the better the job it does. On my workstation I currently have a 20GB L1, and 20GB Primo Ramdisk for temp files and smaller software installs (OS has 64GB total). Going to be sourcing two 1TB SSDs for use in a L2 (RAID 0 stripe) against the new Stablebit Drivepool I setup (88TB total).

Take the Trimmed Blocks feature as an example - if given a large enough cache and deferred write time (using a UPS of course), you can complete downloads and offload them to long-term storage before they've even been written to the cached disk, which results in no hard drive usage at all, just L1 or L2 depending on their size. I do it all the time with FTP transfers - the files never hit my download folder disk. They are put in the L1 cache and get copied to my Pool drive for storage without ever hitting the local drive. I often end up with millions of trimmed blocks due to L1 efficiency, never hitting the local hard drive.

RAMbo wrote:Is it to increas the SSDs lifespan? Somewhere on this forum Romex warned that L2 cache is a real disk trasher that wears down the SSD quite quikly. I used a 1 GB database in my example because that's easiest understood by many. I reality I do have a lot of stuff on my HDDs but what I actively work on is vastly smaller than 1 GB. My System disk is 1TB Samsung 850 EVO. It my not be the fastest on the market but I want to keep using it until prices come down and I can make my PC SSD only.
Most things are installed on that drive, but for reasons I can't even explain I want some things to remain on my old HDD.
I could partition my System SSD because it has enough free space for that. But because PrimoCache is a disk trasher I won't.
I still have to figure out the best size but I think a 128GB cache SSD would be enough for my purposes. Even when taking your 10% rule into account. But likely I'll buy a 256GB SSD because they are the better deals. At only $50, it wouldn't be that bad if dies in two years. My big hope is that by then prices have come down so much L2 becomes obsolete because I'm all SSD by then :-)
Using a UPS on the system in combination with a decent L1 (and if you want a L2) along with a long deferred write time is what helps avoid a lot of disk thrashing on spinner disks. It will even help with L2 writes to SSDs. Keeping those writes down does help their lifespan. Other things that help SSD lifespan: the size of the SSD (larger typically have longer/larger warranties), overprovisioning them before creating Windows volumes on them, cutting down on unnecessary file writes (disabling unnecessary services and installed MS software in W10 for example), using a Primo Ramdrive and setting the temp folders on it, etc.

Primocache can definitely help with reducing writes to any drive, even a SSD. But you are correct that any drive with a L2 volume on it is going to see much heavier write activity. That's why any time I use a L2, I dedicate an entire SSD to it, and usually oversize it. That helps spread writes around, keeping NAND re-writes to a minimum, and with the larger SSDs comes longer lifespan to begin with.
User avatar
RAMbo
Level 6
Level 6
Posts: 73
Joined: Wed May 11, 2011 7:50 am

Re: How much L2 cache? Backups?

Post by RAMbo »

Yes, I fully understand there is no option to force certain files (blocks) to be in cache.
I'll try to be more clear what I tried to say.
I install PrimoCache. From that point on it starts learning and figures out file XYZ is extremly often accessed. So that file gets a very high access count. Doesn't that mean, the next time PrimoCache starts is pre-loads those blocks because it knows those blocks are so frequently accessed?
Or does PrimoCache just forgets everything it learns when the PC is rebooted?
So when I say pre-load I don't mean a user setting but per PrimoCache intelligence.

If I would use your script I have to guess how long PrimoCache needs to be paused?
What would happen if I didn't pause PrimoCache?
My backup program backsups open files I'm working on at that time. No idea how it works, but the result is good.
User avatar
Jaga
Contributor
Contributor
Posts: 692
Joined: Sat Jan 25, 2014 1:11 am

Re: How much L2 cache? Backups?

Post by Jaga »

RAMbo wrote:I install PrimoCache. From that point on it starts learning and figures out file XYZ is extremly often accessed. So that file gets a very high access count. Doesn't that mean, the next time PrimoCache starts is pre-loads those blocks because it knows those blocks are so frequently accessed?
Or does PrimoCache just forgets everything it learns when the PC is rebooted?
So when I say pre-load I don't mean a user setting but per PrimoCache intelligence.
If you set a L2 to non-volatile, it won't need to pre-cache at boot - it keeps the contents as long as it deems they are higher priority than other blocks. It always keeps itself as full as possible.

With the L1 cache, you need to toggle on Prefetch Last Cache / Start at Windows Boot. That way the blocks it had in it at last shutdown are reloaded and ready for use (instead of the cache being empty after each boot).

RAMbo wrote:If I would use your script I have to guess how long PrimoCache needs to be paused?
What would happen if I didn't pause PrimoCache?
My backup program backsups open files I'm working on at that time. No idea how it works, but the result is good.
The script I posted runs sequentially, so that each task runs, completes, then a short pause, and on to the next one. No guessing needed.

If you didn't pause Primocache, it would start reading in the data the backup accessed, and caching the parts of it that it decided it wanted to keep. That would flush other data in the cache, and reduce hitrate after the backup was over. It's better to pause it, and let Primocache keep what it sees you accessing through normal use.

I wouldn't worry about open files during a backup, but any blocks that get changed when Primocache is paused are flushed from the cache (since their data is no longer valid). To that end, less frequent backups (meaning less pausing for Primocache) would be advantageous. But if there aren't *that many* changes, it's essentially a non-issue. The next access on the file would bring it back into the cache again.
User avatar
RAMbo
Level 6
Level 6
Posts: 73
Joined: Wed May 11, 2011 7:50 am

Re: How much L2 cache? Backups?

Post by RAMbo »

I understand your script now. I have to check my backup program behaves as Macrium does.



BTW I'm now investigating DrivePool and the other Stablebit programs. Really intesting stuff. I can even use it as part of my backup strategy.
User avatar
Jaga
Contributor
Contributor
Posts: 692
Joined: Sat Jan 25, 2014 1:11 am

Re: How much L2 cache? Backups?

Post by Jaga »

RAMbo wrote:BTW I'm now investigating DrivePool and the other Stablebit programs. Really intesting stuff. I can even use it as part of my backup strategy.
It's excellent software, with a first class and very active development team. Can't go wrong there.
User avatar
RAMbo
Level 6
Level 6
Posts: 73
Joined: Wed May 11, 2011 7:50 am

Re: How much L2 cache? Backups?

Post by RAMbo »

I only did some brief tests with 3 pooled USB disks; when doing bulk copies from/to my SSD it gives great speeds. A little RAID 0 like :-)
User avatar
Jaga
Contributor
Contributor
Posts: 692
Joined: Sat Jan 25, 2014 1:11 am

Re: How much L2 cache? Backups?

Post by Jaga »

Now go and turn on 2x folder duplication for one of the folders you are testing with your copy, wait for the duplication to finish, then re-start the copy from that folder. Speeds should go up even higher due to multitasking the drives. I have 4x duplication set on my most important stuff, to guard against disk failure, and the read speeds are phenominal.
Post Reply