简体   繁体   English

Infinispan 复制缓存中的驱逐是如何工作的?

[英]How does eviction work in a Infinispan replicated cache?

Infinispan supports a type of cache tier called "Replicated" where the content of multiple caches (in different JVMs or even container instances/VMs/servers) are kept (asynchronously) synchronized. Infinispan 支持一种称为“复制”的缓存层,其中多个缓存(在不同的 JVM 甚至容器实例/VM/服务器中)的内容保持(异步)同步。 My question is how eviction is handled in this case - if a normal local eviction algorithm is used that only looks at one cache it sounds to me like the result would be suboptimal ie entries that is not used much in one JVM and therefore are evicted could be the most frequently used one in all the others (that, as I understand it, also will see these entries evicted due to the synchronization between them)...我的问题是在这种情况下如何处理逐出 - 如果使用仅查看一个缓存的普通本地逐出算法,在我看来结果将是次优的,即在一个 JVM 中使用不多并因此被逐出的条目可能成为所有其他人中最常用的人(据我了解,由于它们之间的同步,这些条目也会被驱逐)...

You will want to check out this section of the Infinispan User Guide https://infinispan.org/docs/stable/titles/configuring/configuring.html#eviction-and-expiration_configuring-memory-usage您需要查看 Infinispan 用户指南的这一部分https://infinispan.org/docs/stable/titles/configuring/configuring.html#eviction-and-expiration_configuring-memory-usage

As you mentioned eviction is done per node and removes entries that were deemed to be used the least most recently.正如您提到的,逐出是按节点完成的,并删除被认为最近最少使用的条目。 (Note that off JVM heap and on heap have slightly different algorithms). (请注意,off JVM heap 和 on heap 的算法略有不同)。 Due to this it is possible to have some nodes with and without data if you have run out of entries.因此,如果您用完了条目,则可能有一些节点有数据和没有数据。 This in turn can cause inconsistencies with what each node can see.这反过来会导致每个节点可以看到的内容不一致。

If you need to limit memory usage, which is the main point of eviction, all you need to do to keep consistency between all nodes is to have a persistent storage defined, such as file store which is covered in the next section https://infinispan.org/docs/stable/titles/configuring/configuring.html#persistence .如果你需要限制 memory 的使用,这是驱逐的要点,你需要做的就是保持所有节点之间的一致性,定义一个持久存储,比如下一节将介绍的文件存储https:// infinispan.org/docs/stable/titles/configuring/configuring.html#persistence

Note that expiration differs from eviction in that it is done cluster wide.请注意,过期与逐出不同,因为它是在集群范围内完成的。 So if you still want data consistency across all nodes, expiration can be used instead if it is sufficient for your use case.因此,如果您仍然希望所有节点之间的数据保持一致,则可以使用过期时间来代替,前提是它足以满足您的用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM