简体   繁体   English

使用一致性缓存的开销

[英]Overhead of using coherence cache

I consider caching key-value lists stored in database.我考虑缓存存储在数据库中的键值列表。 Right now for rendering of JSF pages, a lot of redundant queries are executed to find the names to be displayed for some keys (O/R-Mapper: Eclipselink).现在为了渲染 JSF 页面,执行了很多冗余查询来查找要为某些键显示的名称(O/R-Mapper:Eclipselink)。 The values are quasi-static, but can change very seldom by using the application (no change in database except by the application in question).这些值是准静态的,但很少会通过使用应用程序更改(数据库中没有更改,除非有问题的应用程序)。

A simple cache would suffice when only using one application server.当只使用一个应用服务器时,一个简单的缓存就足够了。 However, load balancing with multiple servers should be possible, avoiding returning stale values if data is changed using one server and therefore not reflected by the other server.但是,应该可以使用多台服务器进行负载平衡,如果使用一台服务器更改数据并且因此不会被另一台服务器反映,则避免返回陈旧的值。

One idea would be to use oracle coherence as distributed cache.一种想法是使用 oracle 一致性作为分布式缓存。 I'm not sure whether this is overkill because of the fact that the data is only changed very seldomly and the cache itself does not need to be distributed, only the invalidation should be.我不确定这是否是矫枉过正,因为数据很少更改并且缓存本身不需要分发,只有失效应该是。

What is the overhead of coherence in terms of memory, execution times and network communication?就 memory、执行时间和网络通信而言,一致性的开销是多少? Are there any alternatives that better suit my use case?有没有更适合我的用例的替代方案?

I talk about 50.000 key value pairs, mainly short strings.我谈论 50.000 个键值对,主要是短字符串。

If the invalidation is that rare, then you can use a local cache and something like a JMS Topic that everyone subscribes to in order to handle the invalidation.如果失效很少见,那么您可以使用本地缓存和每个人都订阅的 JMS 主题之类的东西来处理失效。

There's also something like EHCache as an alternative, since it's OSS and free to use vs Coherence, if that's important.还有像 EHCache 这样的替代方案,因为它是 OSS 并且可以免费使用 vs Coherence,如果这很重要的话。 I like to use EHCaches pull through ability.我喜欢使用 EHCaches 拉通能力。

Coherence has relatively low overhead, and can easily manage 50,000 (or 50,000,000) objects. Coherence 的开销相对较低,可以轻松管理 50,000(或 50,000,000)个对象。 However, if your use case is super simple, and you don't mind doing the invalidation work yourself, and don't need the various QoS that Coherence provides, then it probably is overkill.但是,如果您的用例非常简单,并且您不介意自己进行失效工作,并且不需要 Coherence 提供的各种 QoS,那么它可能是矫枉过正。

Also, this simple use case can easily be done using the Coherence Standard Edition, which is far less expensive (licensed per server instead of per processor, and it's a much lower price).此外,这个简单的用例可以使用 Coherence 标准版轻松完成,它的成本要低得多(按服务器而不是按处理器获得许可,而且价格要低得多)。

For the sake of full disclosure, I work at Oracle.为了充分披露,我在 Oracle 工作。 The opinions and views expressed in this post are my own, and do not necessarily reflect the opinions or views of my employer.这篇文章中表达的观点和观点是我自己的,并不一定反映我雇主的观点或观点。

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

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