L1/L2 cache recommendations

FAQ, getting help, user experience about PrimoCache
Post Reply
docbill
Level 3
Level 3
Posts: 19
Joined: Wed Aug 21, 2013 1:04 am

L1/L2 cache recommendations

Post by docbill »

I'm having difficulty understanding how to tweak all the options in primo-cache.

Here is my usage. My wife has a laptop, with a 750 GB drive. I recently purchased her a 128GB Crucial M4 mSata drive. I was planning on using dataplex, but then I discovered they don't actually license the software for use with this SSD, even though crucial advertised the drive can be used as a caching drive, because it has been validated with dataplex.

It looks to me like primo-cache might do the same thing for her. Which is to accelerate her computer, with out the need to transfer to windows to the SSD.

Now, here are my questions:

1. How do a I determine what is the optimal L1 cache size?

2. Is there any reason why I need more than one L1 cache? For the life of me the only reason I can think of for multiple caches is if I want some read-only and some read-write. But in that case, at most I need two. Why would I want 16?

3. How do I determine what is the optimal L2 cache size? I gave the full 128GB Msata to use a cache. When I select though to use it as cache, it picks a default size 128 MB? That seems absurdly small. Even if I made 16 caches, it would only use a small fraction of the drive. I decided just to tell it to use the full disk, but I could not find a button for that. The disk size is shown in GiB, but the cache size is entered in MB. But there seems to be a computation error, as the actual disk size shown is not correct neither GiB or GB, so I can't just move the decimal place to guess at the number MB to use for full disk. It seems the dialogue is quite happy to allow me to set a value to large, so actually using full disk is pain in the neck. I just ended-up ballparking it, and so the extra space is unused. Is there a reason I would not want to do full disk?

4. I've read all sorts of things about tweaking SSD drives. e.g. Aligning sector boundries, enabling trim support. Does primo-cache do these things, or should I set-up the drive optomized as if I was going to put Windows on it, and then activate primo-cache. BTW. I have an hard time understanding why sector size would matter on an SSD, when sectors are a purely logical mapping...

Thanks,

Bill
InquiringMind
Level SS
Level SS
Posts: 477
Joined: Wed Oct 06, 2010 11:10 pm

Re: L1/L2 cache recommendations

Post by InquiringMind »

Docbill,

1). Optimum cache size mostly depends on your file usage patterns (i.e. how much data re-reads the programs you use make) which can be difficult to measure. Another approach is to determine how much memory you have available to allocate to caching, which is easier (allocating too much can result in poorer performance by forcing programs and Windows to swap to pagefile more often).

To do this, check if you are using (or have) unmanaged memory on your system. This is anything above 3.25 GB on a 32-bit Windows system and anything above the Microsoft-imposed memory limits in 64-bit versions (e.g. 16GB in Win7 Home Premium). Since this memory cannot be used normally, if present you should allocate it all to caching (unless you have Primo Ramdisk which can use unmanaged memory also) and leave it at that.

If you are using system memory, then be aware that Windows maintains its own cache (which cannot be disabled) which means Primo Cache will be duplicating existing functionality. If you wish to proceed, then run the most memory intensive programs you use and check the maximum memory usage in Task Manager (the peak usage figure). Add some extra memory to that (20% say) and treat the remainder as spare memory to allocate to Primo Cache.

So if you have a 16GB system and your maximum utilisation is 5GB, then a 10GB cache is probably a good starting point.

2) Primo Cache works at block level, so needs a separate cache for each physical disk. For different paritions on a disk, then aside from different caching strategies (which you mention) separate caches allow more memory to be allocated to specific volumes for more performance. That isn't likely to matter with most users though.

3) I would suggest leaving L2 cache alone for the moment - only consider it if you don't have enough memory for L1 caching.

4) Primo Cache does no SSD optimisation - that is something handled by Windows' disk format (on Vista and later - with XP you will need to align partitions manually). Clusters need to align with SSD blocks to avoid unnecessary erase/write cycles (if a sector crossed an SSD block bounday). Primo Cache can however reduce the data written to disk by Windows which can improve SSD lifespan - see the Registry Corruption thread for more discussion on this.
docbill
Level 3
Level 3
Posts: 19
Joined: Wed Aug 21, 2013 1:04 am

Re: L1/L2 cache recommendations

Post by docbill »

InquiringMind wrote:Docbill,

1). Optimum cache size mostly depends on your file usage patterns (i.e. how much data re-reads the programs you use make) which can be difficult to measure. Another approach is to determine how much memory you have available to allocate to caching, which is easier (allocating too much can result in poorer performance by forcing programs and Windows to swap to pagefile more often).

To do this, check if you are using (or have) unmanaged memory on your system. This is anything above 3.25 GB on a 32-bit Windows system and anything above the Microsoft-imposed memory limits in 64-bit versions (e.g. 16GB in Win7 Home Premium). Since this memory cannot be used normally, if present you should allocate it all to caching (unless you have Primo Ramdisk which can use unmanaged memory also) and leave it at that.

If you are using system memory, then be aware that Windows maintains its own cache (which cannot be disabled) which means Primo Cache will be duplicating existing functionality. If you wish to proceed, then run the most memory intensive programs you use and check the maximum memory usage in Task Manager (the peak usage figure). Add some extra memory to that (20% say) and treat the remainder as spare memory to allocate to Primo Cache.


So if you have a 16GB system and your maximum utilisation is 5GB, then a 10GB cache is probably a good starting point.
Windows 64 bit, 8 GB of RAM. I believe the laptop only supports up to 16 GB. I notice most of the time windows does not use all the memory, even for caching. So RAM cache is probably useless, except as a way to cheat benchmarks, since it would effectively bypass the windows API calls to sync the data to disk immediately... That said Microsoft does not have a reputation to implementing the most efficient algorithms. So maybe RAM caching can improve performance that way. That would be really hard to measure.

Really though, what I'm looking for is persistent caching. That is provided by L2 cache. So my key question here is here a minimum amount of L1 cache I need for L2 cache to work effectively? e.g. Is 128 MB always enough?

InquiringMind wrote: 2) Primo Cache works at block level, so needs a separate cache for each physical disk. For different paritions on a disk, then aside from different caching strategies (which you mention) separate caches allow more memory to be allocated to specific volumes for more performance. That isn't likely to matter with most users though.
OK. That makes sense. It also occurs to me one could use primo-cache for removable drives. In that case you would definitely want a separate cache for each removable drive, even if the software supported otherwise.
InquiringMind wrote: 3) I would suggest leaving L2 cache alone for the moment - only consider it if you don't have enough memory for L1 caching.
As I said, L1 caching is NOT at all what I'm looking for. The whole point is to use the SSD to speed up access to data. L1 caching doesn't do that. L1 caching is also not persistent. Since laptops are shutdown and restarted regularly, RAM caching is probably even less useful than it would be for a desktop computer. If I could I would completely disable L1 caching and use just L2 caching so I could easily benchmark of primo-cache is really making effective use of the SSD.
InquiringMind wrote: 4) Primo Cache does no SSD optimisation - that is something handled by Windows' disk format (on Vista and later - with XP you will need to align partitions manually). Clusters need to align with SSD blocks to avoid unnecessary erase/write cycles (if a sector crossed an SSD block bounday). Primo Cache can however reduce the data written to disk by Windows which can improve SSD lifespan - see the Registry Corruption thread for more discussion on this.
Good to know. I'll probably give primo-cache a week to see if the current settings speed things up significantly. I'm not sure how Windows format can effect things, when primo-cache reformats the disk for use as Windows cache. But I'll take your word that it does, and optimize that before drawing any conclusions on the effectiveness of primo-cache. Do I need to disable L2 cache, reformat as a windows partition before I can optimize, or is there a shortcut to avoid reformatting multiple times?

BTW. The registery corruption discussion really isn't relevant. In that case, the person was obviously using the SSD as a boot drive, and using premo-cache to try and increase the life span of the SSD. (That seems rather silly for a 3rd generation SSD or later.) In my case, I have absolutely no windows partitions on the SSD, as the SSD is intended to be used as a L2 cache. If it were my laptop, I would have cloned the windows partition onto the SSD and used that as the boot drive, but my wife likes to put 100% of her files as folders on her desktop, and would quickly fill-up the SSD while leaving the 750GB disk un-used. So that is not effective solution for her... She also does not like having more than a single drive letter to back-up. I guess she feels far more comfortable copying and pasting folders the desktop to an external drive, than relying on any sort of automated backup procedure to protect her data. I can't really blame her for that as she has lost valuable files before because windows backup failures in the restore procedure.
InquiringMind
Level SS
Level SS
Posts: 477
Joined: Wed Oct 06, 2010 11:10 pm

Re: L1/L2 cache recommendations

Post by InquiringMind »

docbill wrote:Windows 64 bit, 8 GB of RAM. I believe the laptop only supports up to 16 GB. I notice most of the time windows does not use all the memory, even for caching. So RAM cache is probably useless, except as a way to cheat benchmarks, since it would effectively bypass the windows API calls to sync the data to disk immediately... That said Microsoft does not have a reputation to implementing the most efficient algorithms. So maybe RAM caching can improve performance that way. That would be really hard to measure.
Your setup wouldn't likely see the greatest benefit from PrimoCache - the best way to test would be to use something like AutoHotKey to create a macro running and using your most popular applications, and then checking times with and without PrimoCache.
docbill wrote:Really though, what I'm looking for is persistent caching. That is provided by L2 cache. So my key question here is here a minimum amount of L1 cache I need for L2 cache to work effectively? e.g. Is 128 MB always enough?
I've not done any testing of Primo's L2 cache so can't comment authoritatively. I would suggest that it would need to match or exceed the L1 cache size to achieve what you're looking for.
docbill wrote:The whole point is to use the SSD to speed up access to data. L1 caching doesn't do that. L1 caching is also not persistent. Since laptops are shutdown and restarted regularly, RAM caching is probably even less useful than it would be for a desktop computer. If I could I would completely disable L1 caching and use just L2 caching so I could easily benchmark of primo-cache is really making effective use of the SSD.
Your situation is almost the opposite of mine (desktop that's almost never switched off) so I can't really comment aside from noting that a 128GB SSD should be large enough to use as a Windows+Programs disk (giving you the full benefit of SSD speed and access time), leaving the 750GB disk for media and download storage (where speed is less important). That is, if your laptop can contain two drives at once...
docbill wrote:I'll probably give primo-cache a week to see if the current settings speed things up significantly. I'm not sure how Windows format can effect things, when primo-cache reformats the disk for use as Windows cache. But I'll take your word that it does, and optimize that before drawing any conclusions on the effectiveness of primo-cache.
I'd assume that PrimoCache uses the Windows APIs to format, but Romex would be the best source of information here. As for testing, I didn't notice a speedup with PrimoCache active but I did notice a slowdown with it disabled so it may be worth alternating (one day on, one day off) to be able to judge better for yourself.
docbill wrote:She also does not like having more than a single drive letter to back-up. I guess she feels far more comfortable copying and pasting folders the desktop to an external drive, than relying on any sort of automated backup procedure to protect her data. I can't really blame her for that as she has lost valuable files before because windows backup failures in the restore procedure.
Going OT slightly, you might want to check out file versioning software (which takes copies of files just before any changes are made, and can keep multiple backup copies). Examples of these include Aphar Backup (Dutch webpage but program is in English), AutoVer, Yadis Backup (all free) and FileHamster (commercial). I use Aphar Backup myself (it's fast and lightweight and the only one that doesn't rely on .NET Framework) but you may prefer one of the others. These should be used to supplement, rather than replace, a regular backup but can be set to run unobtrusively in the background.
docbill
Level 3
Level 3
Posts: 19
Joined: Wed Aug 21, 2013 1:04 am

Re: L1/L2 cache recommendations

Post by docbill »

I have to say, even without optimization primo-cache really does the trick.

I checked in the middle of the day yesterday, and after less than 24 hours it was already at a 53% cache rate. My wife only has 240 GB used on her 750 GB drive, so I expect over time it will reach close to 100% cache rate. She rebooted her laptop yesterday evening. It started up again too quickly for her to even remember to time it. Definitely under 15 seconds. Normally here start-up time is about two and a half minutes. Even here resume time from hibernate tends to be longer than 15 seconds...

When I get time, I'll split her SSD into two partitions. That way I can allocate a portion of it towards regular windows virtual memory, as that is where hibernate data is stored...

Bill
InquiringMind
Level SS
Level SS
Posts: 477
Joined: Wed Oct 06, 2010 11:10 pm

Re: L1/L2 cache recommendations

Post by InquiringMind »

That's an impressive improvement there, DocBill (though a 2½ minute startup time suggests some serious cruft - possibly pre-installed third-party software?).

It would be interesting to see comparative times for an SSD-based Windows install on your system, but creating one is no small amount of work.

Still it does make another argument for PrimoCache: Using L2 caching to maximise the benefits of an SSD too small to accommodate a full system setup.
Post Reply