简体   繁体   English

Infinispan:仅本地缓存

[英]Infinispan : Local cache only

I'm using Infinispan (7.2.3.Final) to store data into multiples caches. 我正在使用Infinispan(7.2.3.Final)将数据存储到多重缓存中。

The thing is : I only want to store datas locally, into files. 问题是:我只想将数据本地存储到文件中。 I don't want to store datas into memory to avoid memory issues. 我不想将数据存储到内存中以避免内存问题。

I get this error : 我收到此错误:

java.lang.OutOfMemoryError: Java heap space

Infinispan is a Java distributed in-memory. Infinispan是一种Java分布式内存。 So I don't think it is relevant to use it if you don't want to use RAM. 因此,如果您不想使用RAM,则我认为使用它无关紧要。 In my opinion, a good usage of Infinispan means you will have tune the memory (size and eviction) to find a good tradeoff between the running-cost, the complexity, and the performance. 在我看来,Infinispan的良好用法意味着您将调整内存(大小和逐出),以在运行成本,复杂性和性能之间找到良好的折衷。

You can configure Infinispan to persist data ( doc ). 您可以将Infinispan配置为保留数据( doc )。 And you can configure it to evict data from RAM memory ( doc ). 您可以配置它以从RAM内存( doc )中删除数据。 But I cannot advice a real configuration if you do not describe your use-case, and in particular why you think you need Infinispan (why not a data base?) 但是,如果您不描述用例,尤其是为什么您认为自己需要Infinispan(为什么没有数据库?),我就不能建议实际配置。

A possible usage is to keep all-in-memory. 一种可能的用法是保留所有内存。 Obviously your data has to be small enough (I don't give number, some people can accept to pay several machines to reduce latency, it depends on your business...) 显然,您的数据必须足够小(我没有给出数字,有些人可以接受支付多台机器以减少延迟的时间,这取决于您的业务...)

Ten year ago, we could use them to simply batch insertions in a data base. 十年前,我们可以使用它们来简单地批量插入数据库。 Now we use Kafka for this use case. 现在我们在这个用例中使用Kafka。

A frequent usage is keep hot data in memory. 一种常见用法是将热数据保留在内存中。 In this case we configure eviction and persistence. 在这种情况下,我们配置逐出和持久性。 I think you are looking for eviction strategies here . 我认为您正在这里寻找迁离策略。 There are several eviction strategies. 有几种驱逐策略。 But as far I know none allows to not use RAM at all: objects will pass through the memory, at least during the persistence. 但是据我所知,任何人都不允许根本不使用RAM:至少在持久性期间,对象将通过内存。

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

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