[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Thundering Herd problem causes stuck threads with blocking-caches  XML
Forum Index -> Ehcache
Author Message
reglof

journeyman

Joined: 01/14/2010 12:01:17
Messages: 21
Offline

I have defined a few blocking-caches to overcome the Thundering Herd problem where many threads try to retrieve the same key from a cache and realize there is no value to it yet...

However, under BEA WebLogic10, I experience many hogging threads which will eventually turn into stuck threads with the bad effect that WLS allocates more threads for its thread-pool, although I have set a timeout to 500ms to prevent an endless wait to the cache.

After taking a thread-dump I noticed that the problem was caused by cache.put().
However, I have no idea on how to fix this problem. The only way I could solve it was by using non-blocking caches which dont help with the Thundering Herd problem

Can anybody point me in the right direction (using ehcache 2.0.1)?
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

Are you using the BlockingCache from Ehcache or your own?
reglof

journeyman

Joined: 01/14/2010 12:01:17
Messages: 21
Offline

I am using the CachingFilter base class which turns my regular cache via the cecorator automatically into a BlockingCache.
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

So are you saying that n requests come in for the same page. The page does not exist. With the web caching the first request will do the work. The other threads will block.

Now, this is correct. The idea is to avoid the work of each request.

You can control the number of threads that accumulate by setting a timeout which it sounds like you have done.

If this is correct then the web caching is already doing what it is supposed to.
Or are you saying there is a bug? i.e. the cache should not stop at cache.put(). The BlockingCache will hold threads at cache.get()
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team