[infinispan-dev] A question and an observation

Bela Ban bban at redhat.com
Mon Jul 7 05:37:14 EDT 2014



On 07/07/14 10:58, Sanne Grinovero wrote:
> On 7 July 2014 09:14, Bela Ban <bban at redhat.com> wrote:
>>
>> 1: Observation:
>> -------------
>> In my Infinispan perf test (IspnPerfTest), I used
>> cache.getAdvancedCache().withFlags(...).put(key,value) in a tight loop.
>>
>> I've always thought that withFlags() was a fast operation, *but this is
>> not the case* !!
>>
>> Once I changed this and predefined the 2 caches (sync and async) at the
>> start, outside the loop, things got 10x faster ! So please change this
>> if you made the same mistake !
>
> Right that's the better way to use the flags; I'm pretty sure we
> documented this at some point but I couldn't find it in the docs nor
> javadocs now...?!! bad bad.


Looking at the code, I see that withFlags() creates a new 
DecoratedCache, so this can obviously be mitigated by instantiating the 
caches beforehand. Haven't had time to investigate the cost of this.


> Where we do use flags internally (Lucene Directory), we hold on to
> multiple instances of the Cache, even if the same cache content but to
> use different flags. The code is quite horrible to read as it seems
> like you interact with different Caches, but as you noticed it's worth
> it.

Yes


> 10x faster? That's surprising for a benchmark which is supposed to be
> network bound isn't it?

I ran 2 IspnPerfTest processes on my local box with numOwners=2 (no L1 
cache). I guess that roughly half of the calls go to the local node, and 
there the cost of withFlags() is not amortized by the network round trip.

> If you can measure a 10X improvement, it seems
> like your tests where bound by memory allocation (as that's the
> resource you starve by using _withFlags_ extensively) ?
> Might be worth checking with flight recorder if that's still the case,
> as _withFlags_ isn't sufficient on its own to saturate your memory
> bandwith, so I'd guess there are other hot consumers which might be
> easy to take down.
>
>>
>> 2. Question:
>> -----------
>> In Infinispan 6, I defined my custom transport as follows:
>> <transport ... transportClass="org.perf.CustomTransport"/>
>>
>> This is gone in 7. Do I now have to use programmatic configuration ? If
>> so, how would I do this ?
>
> I don't know this one, hopefully others will.. ?
>
> Cheers,
> Sanne


-- 
Bela Ban, JGroups lead (http://www.jgroups.org)


More information about the infinispan-dev mailing list