Replies: 4 comments
-
I'm wondering why LRU evction in |
Beta Was this translation helpful? Give feedback.
-
I think we should consider refactoring foryer-memory 🤔 . |
Beta Was this translation helpful? Give feedback.
-
The latest used LRU entry is moved when releasing, instead of accessing. When serving as an LSM-tree block cache, a block iterator can hold a block for a much longer time than other operations. If the entry is moved when accessing, a block that is held by a slow iterator will be evicted too soon after it is unheld. |
Beta Was this translation helpful? Give feedback.
-
I agree. But some of the complexity comes from the use cases. We can discuss about where you want to refactor before you do it to avoid misunderstandings. 🥰
Sorry about that. I will write some example and docs for it. For now, you can refer to how foyer-memory is used in RisingWave. block cache and meta cache
The unsafe is used for implementing intrusive data structures. To achieve better performance (e.g. remove a entry from a linked list with a entry pointer) and solve the multi-container problem (one entry is held by both the eviction container and the indexer), the intrusive data structure is a good choice to avoid redundant memory usage, memory copy and unnecessary lock usage to make the ownership checker happy. The complexity is hidden behind the safe abstractions. It will not bother the user (and as you see, a naive user can focus on 2 generic types only). I think it is worth bothering the developer to provide better performance for users.
As the saying goes, the onlooker sees clearly, but those involved are often confused. Ideas are always welcomed. |
Beta Was this translation helpful? Give feedback.
-
Regarding the abstraction of eviction in foryer-memory, i.e., the Eviction trait, I feel it is somewhat over-abstracted. We should simplify some of its interfaces and the use of generics to reduce the development and maintenance costs of the eviction algorithms.
Here are two references:
Looking forward to everyone's opinions."
Beta Was this translation helpful? Give feedback.
All reactions