Neither READ_COMMITED nor READ_UNCOMMITED help, only NONE which is
inappropriate.
I do not claim it's cache's bug, but it appears to be some design issue.
Let me explain. Suppose you have some read-only entity which is frequently used
through application. This is exactly where I expect to take advantage of cache,
right?
I'm using hibernate but even without hibernate scenario is the same:
| Entity getEntity(PK entityPK){
| if(cache.exists(entityPK)){
| return (Entity)cache.get(entityPK);
| } else {
| Entity entity = (Entity)storage.load(entityPK);
| cache.put(entity); // write lock here
| return entity;
| }
|
you'll do it yourself or O-R mapping tool (eg hibernate) will do it for you if
you configured it to use TreeCache as 2nd level cache.
In any application there are plenty of read-only entites which are the first
candidates to caching.
They are accessed in random order (should be no problem since they are
read-only)
BUT, ANY read access to that entity can cause write to the cache (if entity
never been read or get evicted from cache) and therefore require write lock.
So, running into deadlock becomes just a matter of time.
In my example (in first post) I intentionally requesting that entities in
different order and put some delay into servlet to easily reproduce the issue.
Again, I'm not claiming a bug in TreeCache. But since I'm considering this is
very common scenario (everyone caching readonly entities, if you're using O-R
mapping tool like hibernate you definitely want 2LC do it for you) I'm looking
for any solution allowing me to concurrently access cached read-only entities
without deadlocks.
PS commit after each load definitely not a solution - it leaves you without
transactions and brings you huge overhead instead.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863883#3863883
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3863883
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development