扩展EhCache
我目前正在构建一个需要可扩展的应用程序,因此我对分布式缓存而不是复制缓存感兴趣。我们将使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你能详细说明一下吗?是什么让您认为复制缓存无法扩展?到什么程度呢?
Hibernate 使用 EhCache 作为默认 L2 缓存提供程序,但 L2 缓存提供程序是可插入的。
关于您的担忧,您能否详细说明一下:
缓存并不会让你变得有状态。抱歉,但我不明白你的问题。
虽然似乎可以使用 memcached 作为 Hibernate 的L2 缓存提供程序,但 memcached 确实可以不仅有优点(它没有得到官方支持,它是一个远程缓存,这意味着你总是通过网络发送东西,我什至不知道它支持什么策略)。
我认为你应该澄清你的要求和你的担忧。在目前的状态下,我无法理解你写的所有内容。
顺便说一句,我可以告诉你,EhCache 的扩展性非常好,我已经在“大”24 个以上节点的集群上使用它,没有出现任何问题(当然,“大”是相对的,但这看起来还不错)。
Could you elaborate? What makes you think replicated caching doesn't scale? And to what point?
Hibernate uses EhCache as default L2 cache provider, but L2 cache providres are pluggable.
Regarding your concerns, again, could you please elaborate:
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).
您不会被迫使用任何一种缓存实现。虽然 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 ownMethodSecurityInterceptor
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.