[hibernate-dev] On 2nd level cache and requirements off the cache implementor

Alex Snaps alex.snaps at gmail.com
Mon Apr 7 17:32:05 EDT 2014


Y, Ehcache will work clustered both in transactional (JTA), read-only and
read-write just fine (non strict will work, only blows the race wider open
and inconsistent data will be noticed "quicker").
Am trying to think hard what a cache provider "conceptually needs" to
support clustered scenarios. One could argue clustered is merely doing
stuff over the wires rather than on the mem bus.
So I guess a strongly consistent mode, with some coordination primitives (a
synchronous API of some kind could well be enough I think). Actually
implementing the READ_WRITE strategy on top of jsr107 should give some
perspectives. Today, Ehcache resorts to explicit locks in read_write, but
entry processors should fit the bill just as much (until I'm proven wrong
obviously!). Transactional caches abstract that complexity from the H2LC
provider code, but the coordination still exists (and actually does more
too, as it also provide isolation and JTA recovery in our case as well).
Is this some meaningful input ? Willing to discuss this further though...

PS: Sorry for replying only now, had the pleasure of being sick for the
last three days :/



On Fri, Apr 4, 2014 at 2:13 PM, Sanne Grinovero <sanne at hibernate.org> wrote:

> Both Ehcache and Infinispan support transactions, but Ehcache doesn't
> use this capability when running as Hibernate 2nd level cache, while
> Infinispan uses it more as an implementation detail to provide
> internal consistency, and not to participate with the application
> transaction.
>
> So I think that the fact they both happen to also support Transactions
> should be considered incidental.
>
> I'd very interested too to hear from Galder and Alex about the
> required atomic operation they build on. I could look at the code but
> I'm primarily wondering of what they'd rather need conceptually, than
> knowing what they are forced to do today.
>
> Sanne
>
> On 4 April 2014 14:27, Emmanuel Bernard <emmanuel at hibernate.org> wrote:
> > This is brain storming at this stage.
> >
> > How much is required of a cache provider as far as semantic is
> > concerned and be cluster safe? The only providers we currently offer are
> EhCache and
> > Infinispan
> >
> http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/#performance-cache
> >
> > But both happen to be transactional so I wonder if that's a requirement
> > and if not what are the list of atomic operations that a clustered cache
> > provider would need to offer.
> >
> > Any hint and feedback appreciated :)
> >
> > Emmanuel
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>



-- 
Alex Snaps <alex.snaps at gmail.com>
Principal Software Engineer - Terracotta
http://twitter.com/alexsnaps
http://www.linkedin.com/in/alexsnaps
http://withinthefra.me


More information about the hibernate-dev mailing list