views:

37

answers:

2
+1  Q: 

Scaling EhCache

Hi everyone,

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.

A: 

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.

Gandalf
+1  A: 

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).

Pascal Thivent