-
15. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
vblagojevic Jul 6, 2010 11:02 AM (in response to nfilotto)1 of 1 people found this helpfulNicolas,
Logic is not so simple to explain in a few sentences or even paragraphs. If you are interested in details of implementation have a look at http://infinispan.blogspot.com/2010/03/infinispan-eviction-batching-updates.html and after that you can dive into code directly at http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/main/java/org/infinispan/util/concurrent/BoundedConcurrentHashMap.java?r=HEAD
Regards,
Vladimir
-
16. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
nfilotto Jul 9, 2010 3:15 PM (in response to vblagojevic)OK, thank you for your help, it was not the expected answer because it means that Eviction in infinispan must be considered as a black box since it is very complex but I will try to deal with it at worse I will go deeper into the code to understand the magic.
-
17. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
vblagojevic Jul 12, 2010 11:23 AM (in response to nfilotto)Nicolas,
Definetely have a look. I am of course biased but the ideas behind are novel and indeed very interesting. Follow the pointers I mentioned earlier. Enjoy!
Vladimir
-
18. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
nfilotto Jul 13, 2010 11:30 AM (in response to vblagojevic)Hi Vladimir,
I follow your recommendations, I had a look to the code so now I better understand why my test case cannot pass. The eviction is done locally per segment not globally like in JBC as I thought, so the current cache size will depend on how the entries are distributed into the map. So it is impossible to predict the cache size as you suggested. Thanks to your advice, I could realize how critical is the implementation of the method hashCode because if my keys are always affected to the same segment the effective value of the parameter maxEntries will be the "capacity of one segment".
During my code review, I only see 2 eviction policies which are LRU and LIRS (and NullEvictionPolicy but it is more like a mock), FIFO and UNORDERED seem to rely on LRU, does it mean that UNORDERED and FIFO are not really implemented or the logic of those algorithms is somewhere else in the code?
BTW Congrats guys for BoundedConcurrentHashMap, it is really a wonderful piece of code :-)
Nicolas
-
19. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
vblagojevic Jul 13, 2010 11:49 AM (in response to nfilotto)Nicolas,
You are right, there are no other policies at the moment except LRU and LIRS. FIFO and UNORDERED, for now default to LRU. They are nowhere else:) If you are interested in getting your hands dirty - let us know!
Thanks for the review of BCHM. All the credits go to Doug Lea. We just bolted on eviction in a novel approach.
Regards,
Vladimir
-
20. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
nfilotto Jul 13, 2010 12:17 PM (in response to vblagojevic)Vladimir,
<< FIFO and UNORDERED, for now default to LRU. They are nowhere else:) If you are interested in getting your hands dirty - let us know!
>> Sure, I would be glad to help if I can, I will provide a patch if we realize that FIFO could be helpful in our case. However, I believe that in practice LRU is much more efficient than FIFO so what you provide out of the box should be enough.
<< Thanks for the review of BCHM. All the credits go to Doug Lea. We just bolted on eviction in a novel approach.
>> Actually, I was not talking about the code related to ConcurrentHashMap which is indeed revolutionary (with all his friends from java.util.concurrent), I was talking about the idea to limit the contention by managing the eviction directly inside the segments behind the lock acquisition. With JBC, we meet some contention issues due to the LinkedBlockingQueue used by the EvictionAlgorithms to register all the EvictionEvents (more details here http://community.jboss.org/message/532238), thanks to this new approach we should not meet this problem again.
BR,
Nicolas
-
21. Re: How is the parameter maxEntries interpreted by the Eviction Algorithms?
vblagojevic Jul 19, 2010 4:05 PM (in response to nfilotto)Thanks for the praise Nicolas. I included this question into a technical FAQ.
Best regards,
Vladimir