[infinispan-dev] Faster LRU

Dan Berindei dan.berindei at gmail.com
Mon Jul 11 14:19:44 EDT 2011


On Mon, Jul 11, 2011 at 7:29 PM, Vladimir Blagojevic
<vblagoje at redhat.com> wrote:
> On 11-07-08 5:44 AM, Dan Berindei wrote:
>>
>> I haven't run the tests with concurrency level 512, as the total
>> number of threads is only 100, but I suspect the old LRU still won't
>> catch up with the new LRU's performance.
>>
>> It's interesting that in the writeOnMiss test the new LRU performance
>> dropped when I increased the concurrency level from 32 to 128. I think
>> it might be because the eviction.thresholdExpired() check in
>> BCHM.attemptEviction() is done without a lock and so it could return
>> true simultaneously for multiple threads - which will all proceed to
>> wait on the segment lock and attempt eviction at the same time.
>>
>
> I am not sure about this Dan. I looked at this code for hours! I do not see
> how two threads can call eviction#execute() concurrently.
>

Sorry I wasn't very clear, two threads can enter attemptEviction
simultaneously, one will get the lock and perform eviction, the other
will also try to get the lock and when it gets it it will proceed to
call eviction#execute() again.
So eviction#execute() is not called concurrently, but it is called
twice when it should have been called only once, and I think this
dilutes the advantages of batching.


More information about the infinispan-dev mailing list