Cache Failure behaviour

3 views
Skip to first unread message

javadoc

unread,
Feb 26, 2009, 10:56:07 AM2/26/09
to hibernate-memcached
Hi

i just replace ehcache with this one and i must admit: impressive
work!

one thing bugs me though: when the cache goes down, the app basically
stops working. i´ve read about "Better Exception handling during cache
failure scenarios", but i did not find a way to configure behaviour on
failure or something like that.

Is there a way to detect a cache/connection failure, then blacklist
the cache for some time and skip caching completely?

i do want to have exceptions escalated through to the GUI when
memcached (or more likely the connection to it) fails.

cu uwe

javadoc

unread,
Feb 26, 2009, 11:01:41 AM2/26/09
to hibernate-memcached

javadoc

unread,
Feb 26, 2009, 11:11:54 AM2/26/09
to hibernate-memcached
hmm. still, the question remains:

if the underlying cache fails, every request from hibernate makes the
cache try to reconnect to the nonexisting cache. we have request-
cycles, that involve 60-90 cache lookups, so that having to deal with
the same number of timeouts is not an option.
so some blacklisting before reconnect would be awesome. is there
something like that already?

cu uwe

Ray Krueger

unread,
Feb 26, 2009, 11:46:56 AM2/26/09
to hibernate...@googlegroups.com

Are you only running one instance of memcached? That would sort of
defeat the purpose.
The spymemcached library is responsible for managing the connections
to the memcached instances. I don't believe there is any functionality
like what you're describing built into it though.

javadoc

unread,
Feb 26, 2009, 11:54:41 AM2/26/09
to hibernate-memcached


On Feb 26, 5:46 pm, Ray Krueger <raykrue...@gmail.com> wrote:

> Are you only running one instance of memcached?

currently yes.

> That would sort of
> defeat the purpose.

how is that? let me explain: what i am trying to do is to have a
central cache used by a bunch of appservers, which formerly had their
own and had to notify changes to the others.
this way i could spare some mem and do not have to propagate changes
anywhere.

> The spymemcached library is responsible for managing the connections
> to the memcached instances. I don't believe there is any functionality
> like what you're describing built into it though.

i´d be easy to implement i think. would you care to have this
included, or is this more like a corner-case ?

cu uwe

javadoc

unread,
Feb 26, 2009, 12:00:04 PM2/26/09
to hibernate-memcached
> > That would sort of
> > defeat the purpose.

ah, now i get it. we could use a local and a remote memcached on every
appserver, so that at least one is likely to survive, right?
well that sort of solves my problem, but the first failure still
causes:

java.lang.RuntimeException: Cancelled
at net.spy.memcached.MemcachedClient$OperationFuture.get
(MemcachedClient.java:1443)
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:
764)
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:
784)
at com.googlecode.hibernate.memcached.MemcachedCache.memcacheGet
(MemcachedCache.java:88)
at com.googlecode.hibernate.memcached.MemcachedCache.get
(MemcachedCache.java:110)
at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:
155)

is that intended?

cu uwe

Ray Krueger

unread,
Feb 26, 2009, 12:36:12 PM2/26/09
to hibernate...@googlegroups.com

When bad things happen, errors are logged. Yes, that's intended :)

Are you running hibernate-memcached 1.1.0?

javadoc

unread,
Feb 26, 2009, 1:08:56 PM2/26/09
to hibernate-memcached
On Feb 26, 6:36 pm, Ray Krueger <raykrue...@gmail.com> wrote:

> > well that sort of solves my problem, but the first failure still
> > causes:
>
> > java.lang.RuntimeException: Cancelled
> >     at net.spy.memcached.MemcachedClient$OperationFuture.get
> > (MemcachedClient.java:1443)

> > is that intended?
> When bad things happen, errors  are logged. Yes, that's intended :)

*g* i was not talking about logging here. that exception comes
straight through to the UI Layer as a RTE:)

> Are you running hibernate-memcached 1.1.0?

nope, actally, i just copied the 0.3 dependency from the wicket page.
Now everything works smoothly!

my bad, thanks for your time!

Ray Krueger

unread,
Feb 26, 2009, 1:37:36 PM2/26/09
to hibernate...@googlegroups.com
>> Are you running hibernate-memcached 1.1.0?
>
> nope, actally, i just copied the 0.3 dependency from the wicket page.
> Now everything works smoothly!
>

You were using 0.3? Holy crap that's old. Where'd you find that?
1.1.0 Is definitely the way to go. It has a pluggable exception
handler that catches everything bad at the cache layer.

javadoc

unread,
Feb 26, 2009, 2:35:09 PM2/26/09
to hibernate-memcached


On Feb 26, 7:37 pm, Ray Krueger <raykrue...@gmail.com> wrote:

> > Now everything works smoothly!
> You were using 0.3? Holy crap that's old. Where'd you find that?

*G* i carelessly copied the dependency from here:
http://code.google.com/p/hibernate-memcached/wiki/MavenRepository

maybe you could update it accordingly?

thx uwe

Ray Krueger

unread,
Feb 26, 2009, 3:13:54 PM2/26/09
to hibernate...@googlegroups.com
> *G* i carelessly copied the dependency from here:
> http://code.google.com/p/hibernate-memcached/wiki/MavenRepository
>
> maybe you could update it accordingly?

haha thanks, done!

Reply all
Reply to author
Forward
0 new messages