L1 read cache directly to L2. Topic is solved

Suggestions around PrimoCache
Post Reply
Fearmazter
Level 1
Level 1
Posts: 1
Joined: Sun Nov 01, 2020 1:19 pm

L1 read cache directly to L2.

Post by Fearmazter »

Hi there,

I was wondering if is possible, on the case of the read cache is active on L1 and L2, to write uncached data from L1 directly to L2?
This would eliminate the need to read it again from the HDD when writing the cache.

Love the product by the way!
User avatar
Support
Support Team
Support Team
Posts: 3014
Joined: Sun Dec 21, 2008 2:42 am

Re: L1 read cache directly to L2.

Post by Support »

Currently in most cases when L2 is sufficient, it caches all data that were read. That is, read data cached in L1 usually are also cached in L2. So there is no need to transfer L1 data to L2 when L1 data is discarded.
Primo Ramdisk | PrimoCache
Romex Software Support
Nick7
Level 4
Level 4
Posts: 27
Joined: Sun Jun 25, 2017 7:50 am

Re: L1 read cache directly to L2.

Post by Nick7 »

I guess you misunderstood what he meant.
Currently, when reading file it's being cached in L1. If file is bigger than L1, parts of it get pushed out (LRU algorithm).
L2 cache is populated with that same data LATER, when there is no/low disk activity by reading that same data again from HDD. So whole data is read again.
What he suggests (and what I did quite a while ago) is - when data needs to be pushed out of L1, write it to L2, so there is no need to read same data twice.
User avatar
Support
Support Team
Support Team
Posts: 3014
Joined: Sun Dec 21, 2008 2:42 am

Re: L1 read cache directly to L2.

Post by Support »

Nick7 wrote: Tue Nov 03, 2020 12:19 pm What he suggests (and what I did quite a while ago) is - when data needs to be pushed out of L1, write it to L2, so there is no need to read same data twice.
We fully understand your request. However, this brings performance penalty to active requests. So we don't plan to implement this. However, we will let L2 gathering data from L1 cache instead of source disk, if data has been cached by L1. Currently L2 always gathers data from disks even data has been in L1.
Primo Ramdisk | PrimoCache
Romex Software Support
phat
Level 2
Level 2
Posts: 5
Joined: Tue Jul 14, 2020 12:24 am

Re: L1 read cache directly to L2.

Post by phat »

I want to add my voice to Nick7's. I think the way PrimoCache populates the L2 cache is really inefficient and has a bad degenerate case. The inefficiency is the redundant (2x) reads from HDD. This adds extra wear to the HDD, and wastes battery life on laptops. The degenerate case is if the HDD is always busy, then L2 never gets populated.

I don't agree with Support's reason for not always populating L2 from L1. For the majority of SSDs, writing to L2 would be 5-20x faster than reading from HDD, so flushing blocks from L1 to L2 would always be faster than L1 can be filled with blocks from the HDD.

I would implement this using a separate thread to copy L1 blocks to L2, independent of the thread that populates L1 from HDD. This won't add any performance penalty to foreground IO requests. The L1-to-L2 thread would normally greatly outrun the HDD-to-L1 thread, except on the occasional SSD stall. When the SSD stalls, the HDD-to-L1 thread might need to evict L1 blocks before they are transferred to L2, and those urgently evicted blocks would then need to be transferred to L2 from HDD, but this is just the normal case today.

Support, please run this by your development team. I think there is an opportunity to greatly improve your product.
User avatar
Support
Support Team
Support Team
Posts: 3014
Joined: Sun Dec 21, 2008 2:42 am

Re: L1 read cache directly to L2.

Post by Support »

Thanks, I will forward this to our R&D team.
Primo Ramdisk | PrimoCache
Romex Software Support
Post Reply