Best way to extract the top N keys from a local cache? #85
Replies: 2 comments 10 replies
-
@javafanboy We don't keep statistics at the key level (and it would be cost prohibitive to do so), but you could possibly use the Invocation Service to get the front cache key set from each of the existing storage disabled members and then preload the intersection of those key sets, or keys that are present on > X% of members, or something similar. That said, you may not gain much, if anything -- it may be more expensive to calculate and preload the entries that you think are "the best", than to simply load them as the requests on the new member come in. Basically, you are optimizing a simple get from a remote member, which is not an expensive operation unless the entry itself is pretty big (I assume that the latency between storage enabled and storage disabled members is quite low). It may be best just to let the near cache do its thing and prime itself based on the actual requests coming in. Just my two cents. |
Beta Was this translation helpful? Give feedback.
-
From my personal point of view my previous improvement proposal "Allow auto scaling without making cluster vulnerable" is however much more important as it makes a big difference for Coherence CEs suitability in a (non-Kubernettes) cloud environment. |
Beta Was this translation helpful? Give feedback.
-
When starting new VMs participating as non-storage enabled nodes in a "near cache" with already several tens of nodes, we would like to pre-load it with the "best" key values based on the other front caches on already running VMs usage statistics (we need to think about if creating some average or trusting the longest running VM etc) and my question is what the best method would be to getting hold of the "top N" keys from a local cache?
My plan is to onced I know the top N keys perform a number of getAll calls with the very best keys in the last one (this way they will have a slightly more recent access time making them a little less likely to get evicted). My thinking is also to use an N that is quite a bit smaller than the near cache capacity once again to avoid the "good" keys/values from getting evicted before they have started picking up use and to keep the load time down to get the new VMs into use fast.
I am not aware of any way to otherwise "prime" the usage data of newly loaded keys to make them less likely to get evicted - if anybody have some tips on that let me know!
Beta Was this translation helpful? Give feedback.
All reactions