On Fri, Jul 8, 2011 at 12:44 PM, Dan Berindei <dan.berindei(a)gmail.com> wrote:
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 added another batch threshold check while holding the lock and the
performance anomaly disappeared.
Another strange pattern is that neither eviction policy respects the
capacity parameter exactly. LIRS rounds up the capacity to the next
power of 2, and LRU/LRUOld do the same rounding and then multiply by
0.75.
I updated BCHM to pass the initial capacity to the eviction policy,
and now all the policies keep the same number of entries.
I'll report again once I fixed these and once I update the
reporting -
I think the total number of misses might be more relevant than the
standard deviation of the keys at the end.
I got the tests running on the test cluster again and the new LRU is
clearly better in every respect than the old LRU. In fact the only
"problem" in the test results is that in the new "writeOnMiss"
scenario the hit ratio of the new LRU is much better than all the
other policies. There is probably a mistake somewhere in the test, if
it was a random thing I don't think it would have been so visible in a
20-minutes test:
MapStressTest configuration: capacity 500000, test running time 1200 seconds
Container BCHM:LIRS Ops/s 11155.49 HitRatio 96.54 Size
499968 stdDev 193558.30
Container BCHM:LRU Ops/s 31292.06 HitRatio 97.84 Size
500000 stdDev 193168.07
Container BCHM:LRU_OLD Ops/s 116.89 HitRatio 76.11 Size
500032 stdDev 197974.87
Testing write on miss performance with capacity 500000, keys 2000000,
concurrency level 32, threads 100
Container BCHM:LIRS Ops/s 1684.01 HitRatio 63.13 Size
499968 stdDev 338637.40
Container BCHM:LRU Ops/s 4884.57 HitRatio 84.47 Size
500000 stdDev 353336.31
Container BCHM:LRU_OLD Ops/s 50.69 HitRatio 41.34 Size
500032 stdDev 361239.68