dynamic ram allocation & suggestion for best cluster size

Suggestions around PrimoCache
Level 2
Level 2
Posts: 5
Joined: Sun Oct 27, 2013 12:16 pm

dynamic ram allocation & suggestion for best cluster size

Post by b74 »

Hi, and thanks for this wonderful program
I was wondering by the way is there any dynamic ram allocation & suggestion for best cluster size planned ?

I sometimes do complete the 99% physical Ram usage 70% cache usage with a cluster size of 4kb in read-only mode ( had a BSOD once with delay write set to 1 minute, was catastrophic )
and was wondering if the program could then re-allocate some of it's ram usage for the system ..

I was wondering too if we could set the list of cache files, and set some exclusions, wildcards or regular expression to ban some files from being cached or delay-written ..
if the program could flush that cache when windows hibernation mode enables ..

Regards :mrgreen:
Level SS
Level SS
Posts: 471
Joined: Wed Oct 06, 2010 11:10 pm

Re: dynamic ram allocation & suggestion for best cluster siz

Post by InquiringMind »

The nature of caching software generally is to start with near-zero memory usage and increase that as the cache is filled, up to the maximum size you set. If you have applications running short on memory, you need to reduce the amount allocated to PrimoCache (Task Manager should tell you the peak memory usage on its Performance tab, subtract that from the memory installed on your system and take another 1-2GB away for a safety margin - what's left can then be allocated to PrimoCache). If you really want dynamic memory usage, Windows' own internal file caching does offer that.

Support have recommended using the same cluster size as your filesystem (4KB by default on NTFS volumes), but a larger size will boost read/write speeds on large files and lower the memory overheads needed for the indexes (I have found 64KB to be the sweet spot myself).

The ability to pre-read or exclude specific files has been asked for by others - PrimoCache operates at block level though so it isn't aware of filenames. It shouldn't be hard to pre-read specific files to get them in the cache, but excluding others would be another matter (it would be easier to relocate such files to an uncached volume/disk).
Level 1
Level 1
Posts: 1
Joined: Fri Apr 24, 2015 2:04 pm

Re: dynamic ram allocation & suggestion for best cluster siz

Post by rastilin »

I'd also love to see dynamic ram allocation; it's definitely possible on Windows because SQL Server will release memory as it detects that the amount of free system memory reaches past a given point, so presumably Primo Cache could do the same. There are several reasons why you would want Primo Cache to replace the Windows File Cache. To pick the most obvious...

1. Windows File Cache uses 256KB blocks, aligned to the start of a file to cache individual files. This is a problem when many programs use 4KB files to store their data for quick look-up. 4 x 4KB files take up 1MB of cache in this way. This is mentioned in Windows Internals btw if you don't believe me.
2. Many applications bypass the file cache even when they probably shouldn't and there is not always a way to make them stop doing this. Virtualbox does this (although it's a selectable option) and so does VLC.
3. There is no way to completely stop Windows flushing writes even when you know that the speed is more important than reliability or that the machine has battery backup. This is a problem if a process that needs to write as quickly as possible is being slowed by an application writing out it's log files in the background and insisting that it has to flush them to disk.

Primo Cache has many advantages over the built-in Windows Cache and it's largest drawback is that to work optimally it requires a large amount of fiddling even when it should be able to configure itself (eg .. use up all available memory less 1GB and release memory if the free memory drops below that amount).
User avatar
Level 6
Level 6
Posts: 68
Joined: Wed May 11, 2011 7:50 am

Re: dynamic ram allocation & suggestion for best cluster size

Post by RAMbo »

This is a very useful suggestion/request!

I would like a PrimoCache setting like: Leave 2GB RAM free.
Memory usage on my PC varies greatly. Sometimes it's nearly full, sometimes it's nearly empty.
It's a sin to have 20GB of RAM doing nothing :-)

Additional question: What is the maximum amount or RAM PrimoCache can use (in a useful way)?
Level 8
Level 8
Posts: 135
Joined: Sat Oct 26, 2013 2:13 pm

Re: dynamic ram allocation & suggestion for best cluster size

Post by idefix44 »

RAM is NEVER, NEVER, NEVER really free.
Free in Microsoft Windows OS don't mean inused...
Level 2
Level 2
Posts: 8
Joined: Mon Jun 26, 2017 8:44 pm

Re: dynamic ram allocation & suggestion for best cluster size

Post by l0rdraiden »

Any comments about this feature? dynamic ram allocation

More info here
https://www.romexsoftware.com/bbs2/en-u ... tion#p6915
Level 10
Level 10
Posts: 242
Joined: Tue May 17, 2011 3:52 pm

Re: dynamic ram allocation & suggestion for best cluster size

Post by minhgi »

If you really want more performance, in addition to up above memory optimization, try to use a smart defrag that can align file distribution back to back. Meaning the defragger should know to do a file order placement for Window boot and application launch so it can load file sequentially if the data is not in cache.

The only two smart defragment utilities that, I know of, can do that is Diskeeper 12 (later version remove ifast for application) and PerfectDisk. It may have change with other defragger freeware out there.

You not going to see any improvement right away. When it does, you will see the overall performance is better with Primocache then without.
User avatar
Posts: 681
Joined: Sat Jan 25, 2014 1:11 am

Re: dynamic ram allocation & suggestion for best cluster size

Post by Jaga »

I've used PerfectDisk before, it's good software for spindle disks.
Level 3
Level 3
Posts: 18
Joined: Sun Dec 17, 2017 7:19 pm

Re: dynamic ram allocation & suggestion for best cluster size

Post by jussssx1 »

I would appreciate dynamic memory allocation as well!! The function could contain two parts:

1) Initially memory allocation starts with zero bytes, as data is being cached, new allocations
are done for example in 128Mb slots (reducing the number of required new malloc()s)

2) there could be trigger (time, or "available" ram, or other configurable parameter) for
freeing least used blocks. This allows primocache to eventually go back to initial memory
allocation if a trigger is configured so.
-> the benefit would be "ideal" cache size always.
Axel Mertes
Level 9
Level 9
Posts: 178
Joined: Thu Feb 03, 2011 3:22 pm

Re: dynamic ram allocation & suggestion for best cluster size

Post by Axel Mertes »

Hi guys,

while I understand the basic idea behind the request for dynamic RAM cache size, there might be the problem on how its being allocated.

I'd assume PrimoCache simply picks a piece of RAM in the size its set to, potentially in one piece. To make dynamic RAM cache work, you'd essentially need to allocate RAM block by block. So for each block you cache, you allocate the corresponding amount of RAM. Only then you can easily deallocate the RAM on e.g. a least used policy when the systems may get to a point of low RAM.

Another point would be - will there still be a minimum size and a maximum size set, to not go e.g. below 10 GB for cache but not beyon 80 GB and so on? Things to consider.

If you want to avoid allocating block by block, it would force you to allocate at least in bigger chunks like 1 GByte at a time. Then, when you decide to deallocate some cache blocks, you may need to relocate some of the cached data blocks content within that 1 GB block to other RAM blocks, as otherwise its not reflecting your caching strategy. That takes time and may slow down the system a bit, compared to "now".

You may quickly fragment RAM into only small pieces of RAM being available for 3rd party apps.

While I get the wish, I am not sure how easily it can be implemented to work as desired and not create other issues. A cache that is going to copying cache data from RAM to RAM all the time, rather than doing its main job may not be that efficient anymore.

Short term solution: Add RAM ;-)
Post Reply