2

In my server I need to server high method calls rate (300 method calls per second). In order to stand this requirement I know that I need a cache/in-memory solution.

The conflict is how to do that when I'm using hibernate:

  1. If I will use Hibernate 2nd level cache doesn't saves the real entity but the identifier, thus, it doesn't fit.

  2. If I will use an in-memory solution as Infinispan or Couchbase I will need to develop a layer that doe's duplicated works (save/delete/update to DB and memory).

Is there any way that I can save/update/delete a JPA Entity to hibernate and to in-memory grid without to develop a layer that doe's that?

I also tried to find the Hibernate API docs but it looks deprecated (if someone can redirect me I'll be happy).

Thanks! Tomer

4

2 回答 2

0

你能确认你唯一想要的就是替换 Hibernate 的缓存吗?而不是持久层?

因此,如果您想要在 Hibernate 中拥有“更快”的二级缓存,您是否使用 Infinispan 进行了测试(https://docs.jboss.org/author/display/ISPN/Using+Infinispan+as+JPA-Hibernate+Second +Level+Cache+Provider ),这是一个缓存解决方案。这可能是今天最好的选择。Couchbase 不仅仅是一个缓存(它具有基于 memcached 的缓存,但也允许您将数据作为 NoSQL 引擎持久保存到磁盘上)。

以防万一您可能已经看到 Hibernate OGM ( http://www.hibernate.org/subprojects/ogm.html ),它允许您将数据存储到 NoSQL 实例中,而不是存储到 RDBMS 实例中。我目前正在为 OGM 开发 Couchbase 提供商。(https://github.com/tgrall/hibernate-ogm/tree/couchbase-support

于 2012-12-11T00:08:37.087 回答
0

内存缓存提供程序的一种选择是GridGain

我不使用它们的后端持久性功能,但它们提供了一个可插入的GridCacheStore接口,因此当您调用 gridGainCache.put(...) 时,它将同步(默认情况下)或异步(使用后写) ,将新条目写入持久层。

文档在这里,请注意,他们有一个使用 Hibernate 处理内容的示例。

于 2012-12-10T17:49:23.147 回答