pre cache frequently used files

Suggestions around PrimoCache
minhgi
Level 10
Level 10
Posts: 255
Joined: Tue May 17, 2011 3:52 pm

Re: pre cache frequently used files

Post by minhgi »

It was just for testing purpose. With the 1GB ramdisk, I was getting 100MB of read precache to the L1. And with a 512MB, I was getting a little over 150MB in precache. So there is some small benefit to using the ramdisk as L2. I have estimate that it takes about 1.3 GB of ram when Windows is fully loaded from boot. Primocache show I was getting 20-25% hit rate.

A real SSD L2 get me anywhere from 95-99%. This test was just for thought, as Stenruiz here mention about using ramdisk as a caching stage.
AikenDrum
Level 2
Level 2
Posts: 8
Joined: Thu Aug 15, 2013 2:25 am

Re: pre cache frequently used files

Post by AikenDrum »

EricL wrote:... the table of "hot" data could be preserved, thus allowing the cache to be rebuilt much more quickly.
As both a dev and a user, this makes the most sense to me. Save the previous state as a hint to rebuild the cache on next startup, but don't save the cache itself. Judging by the "overhead" we're told about in the cache setup, the state shouldn't be more than 50-100MiB for a typical user. Saving and reloading that much data is nothing. Primo would just need to be good about using the hints to do a deferred cache rebuild in the background, rather than doing it synchronously while everything else waits.

There's no potential problem with cache coherency that way, which is what would scare me otherwise.
AbsoluteJoe
Level 2
Level 2
Posts: 5
Joined: Thu Aug 15, 2013 3:46 am

Re: pre cache frequently used files

Post by AbsoluteJoe »

Some have noted the possible redundancy of Windows file cache, prefetcher, superfetch, and etc. - Here are some of my observations

If have seen some of the good, bad, and the ugly aspects as various Windows file cache and prefetch schemes evolve from XP thru Windows 8.
The two tier file caching done by PrimoCache is far simpler and very effective. I wish that Microsoft would allow the Windows file cache, which is now too tightly coupled to it's memory management, to be completely replaced by 3rd party products - alas it won't. The old mechanism of reducing the file cache working set size is now ineffective in preventing Windows Vista and 7+ from keeping the max amount of cached file data in memory until more free memory is needed. With PrimoCache the customer sets the fixed maximum memory cache size.

The Windows superfetch and readyboot, which now supercedes the prefetcher, is designed to predict when programs and files are needed and agressively preload them into cache when it predicts that they will be used by a program. It is worth noting that the superfetch/prefetch is disabled by default on Windows Servers, and enabled by default on non-Server versions. Unfortunately, in some cases the superfetch/prefetch behavior is a bit too agressive in preloading files that will not actually be re-opened that often.
If the un-needed prefetched files are large, it can result in file cache being quickly filled with un-needed data and can cause heavy and un-necessary pre-fetch i/o.
Because the appiications that I use most do not often reference the same files, I have chosen to enable prefetch and superfetch for boot time files only.
Please be aware that the readyboot performance feature and boot defrag logic uses data supplied and processed by the superfetch service and superfetch boot flag, so you probably don't want to completely disable it.

In summary, some of the Windows prefetch/superfetch behavior may benefit PrimoCache by pre-caching files as progams are run and some may not (just adds overhead).
Each user experience can be different depending on the frequency, size, number of files accessed, so more detailed analysis of performance monitor data and statistics is required to predict the pre-cache benefit vs negative overhead.
senoctar
Level 2
Level 2
Posts: 5
Joined: Sun Sep 22, 2013 11:34 am

Re: pre cache frequently used files

Post by senoctar »

I tried eBoostr and it does preserve your cache after restarts.
I think it is able to do that because it doesn't have a live cache. You need to build the cache manually. In that process it will copy files to the cache based on recent usage statistics. When the cache is not being (re)built is in readonly mode and can't be corrupted by restarts.
The major downside of this approach is performance. eBoostr has horrible performance compared to PrimoCache. New files will be read from the main drive every time until you rebuild the cache. Also the algorithm for building the cache is not that great, it misses a lot of often-used files.

However, it does have a great idea that PrimoCache could use: Rebuilding the cache.
Personally I would like to have an option to keep data on unclean restarts (which I would use at my own risk, like the defer writes option) and maybe an option to recheck/refresh the cache.
For users that have important data, PrimoCache could delete the data in the cache but keep metadata (i.e. what blocks were in the cache and their related usage statistics). It could then offer an option to rebuild the cache.

EDIT: didn't notice there were more pages in the thread and the rebuild idea was already mentioned before.
User avatar
Support
Support Team
Support Team
Posts: 3623
Joined: Sun Dec 21, 2008 2:42 am

Re: pre cache frequently used files

Post by Support »

@senoctar,

Thank you! We also have similar ideas but we still need more time to implement these features.
stenrulz
Level 4
Level 4
Posts: 34
Joined: Sun Aug 04, 2013 3:48 am

Re: pre cache frequently used files

Post by stenrulz »

I have done some testing with Grub4Dos's RamDisk as a level 2 cache drive it seems to be working well. This allows me to have the ram drive load before windows much better than just loading the whole windows into ram. As this allow the files used on startup to be cached and not have to load the complete system into ram.

http://tech.outcult.com/tutorials/winram/01/

Depending on how PrimoCache can be loaded it might be possible to start it before windows thus even the first bit of data for the windows startup is running from RAM. Much like how anti virus products scan files as the system start up.
Post Reply