Question about the prune method in LRUAlgorithm.  This is probably a small 
issue that will not actually affect anyone, but I'm looking for an opinion.

I hope this explanation makes sense....

Currently, the process method runs through the queue processing the 
gets/adds/deletes, then it runs through the items in the cache looking to see 
if it should evict them.

There is a window of time (maybe large depending upon how many things are in 
the cache), that after the queue is drained and the first part of the cache is 
being pruned that a get comes in for something (at the end of the cache) that 
has been timed out (but not yet pruned) the get is successful (while the prune 
is still going on).  The prune then gets to the end of the cache and evicts the 
newly gotten object (the newly gotten object placed a GET event in the queue, 
but the queue is not processed until the next time the eviction runs).

The result of this is a get can be successful, but then immediately after, the 
get will fail.  Since a get is supposed to reset the time, if a get is 
successful, it should not be removed until at least TimeToLive seconds after 
the last successful get.

A couple of questions about this..
1) If this really a problem, or is it just me?  I think the saving grace of 
this is that the window is small unless the cache gets really big.
2) Is there a simple fix for this?  Can you drain the queue again during the 
prune method, before each eviction to make sure the object is still available 
for eviction?

Because this is such a relatively small window of time, I can't make a reliable 
JUnit test (Unless I add a sleep the prune method to simulate a really large 
cache).

-Kevin

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3863194#3863194

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3863194


-------------------------------------------------------
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
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to