扩展EhCache

发布于 2024-09-18 10:24:51 字数 274 浏览 11 评论 0原文

我目前正在构建一个需要可扩展的应用程序,因此我对分布式缓存而不是复制缓存感兴趣。我们将使用 memcache 来处理常见的缓存用例。

然而,Hibernate 和 Spring Security ACL 都依赖于 EhCache,它似乎没有与 memcache 相同的复制方案,我担心失效逻辑。

我的应用程序服务器需要无状态才能很好地扩展,我想知道是否需要在 memcache 上运行 Hibernate 和 Acl 还是它们只存储瞬态数据?

感谢您的帮助。

尼古拉斯.

I'm currently building an application that needs to be scalable, and therefor I'm interested in distributed caching and not replicated caching. We will be using memcache for common cache use cases.

However Hibernate and Spring Security ACL both rely on EhCache which doesn't seem to have the same replication scheme as memcache and I'm worried about the invalidation logic.

My application servers need to be stateless to scale well and I'm wondering if I need to run Hibernate and Acl on memcache or do they only store transient data ?

Thanks for your help.

Nicolas.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北城挽邺 2024-09-25 10:24:51

我目前正在构建一个需要可扩展的应用程序,因此我对分布式缓存而不是复制缓存感兴趣。

你能详细说明一下吗?是什么让您认为复制缓存无法扩展?到什么程度呢?

然而,Hibernate 和 Spring Security ACL 都依赖于 EhCache,它似乎没有与 memcached 相同的复制方案,我担心失效逻辑。

Hibernate 使用 EhCache 作为默认 L2 缓存提供程序,但 L2 缓存提供程序是可插入的。

关于您的担忧,您能否详细说明一下:

  • 您到底要缓存什么?
  • 您需要支持哪些缓存策略(只读?非严格读写?读写?事务性?
  • 您为什么担心?您测量过什么吗?来自某处的任何负面反馈吗?

我的应用程序服务器需要无状态才能很好地扩展,我想知道我是否需要在 memcache 上运行 Hibernate 和 Acl,还是它们只存储瞬态数据?

缓存并不会让你变得有状态。抱歉,但我不明白你的问题。

虽然似乎可以使用 memcached 作为 Hibernate 的L2 缓存提供程序,但 memcached 确实可以不仅有优点(它没有得到官方支持,它是一个远程缓存,这意味着你总是通过网络发送东西,我什至不知道它支持什么策略)。

我认为你应该澄清你的要求和你的担忧。在目前的状态下,我无法理解你写的所有内容。

顺便说一句,我可以告诉你,EhCache 的扩展性非常好,我已经在“大”24 个以上节点的集群上使用它,没有出现任何问题(当然,“大”是相对的,但这看起来还不错)。

I'm currently building an application that needs to be scalable, and therefor I'm interested in distributed caching and not replicated caching.

Could you elaborate? What makes you think replicated caching doesn't scale? And to what point?

However Hibernate and Spring Security ACL both rely on EhCache which doesn't seem to have the same replication scheme as memcached and I'm worried about the invalidation logic.

Hibernate uses EhCache as default L2 cache provider, but L2 cache providres are pluggable.

Regarding your concerns, again, could you please elaborate:

  • what are you going to cache exactly?
  • what caching strategies do you need to be supported (read-only? nonstrict-read-write? read-write? transactional?
  • why are you worried? did you measure anything? any negative feedback from somewhere?

My application servers need to be stateless to scale well and I'm wondering if I need to run Hibernate and Acl on memcache or do they only store transient data ?

Caching doesn't make you stateful. Sorry, but I don't understand your questions.

And while it seems possible to use memcached as L2 cache provider for Hibernate, memcached does not have advantages only (it's not officially supported, it's a remote cache which means you're always sending things over the wire, I don't even know what strategies it supports).

I think you should clarify your requirements and your concerns. In its current state, I don't understand everything you wrote.

And by the way, I can tell you that EhCache scales pretty well, I've used it on a "big" 24+ nodes cluster without troubles (of course, "big" is relative but this seems decent).

笑,眼淚并存 2024-09-25 10:24:51

您不会被迫使用任何一种缓存实现。虽然 Ehcache 是 Spring 的事实上的缓存,但您可以轻松地为 memcached 连接不同的 CacheManager 并使用它。您还可以编写自己的 MethodSecurityInterceptor 来执行任何自定义缓存/失效逻辑。基本的 Spring Security 类作为指南,但实际上只适用于非常通用的情况 - 我经常发现我必须为自定义应用程序逻辑编写自己的实现。

You are not forced into using any one cache implementation. While Ehcache is the defacto one for Spring, you can easily wire in a different CacheManager for memcached and use it instead. You can also write your own MethodSecurityInterceptor to do any custom cache/invalidation logic. The basic Spring Security classes are there as a guide, but really only work for their very generic case - I often find I have to write my own implementations for custom application logic.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文