[jboss-as7-dev] A simple timed cache?

Jason T. Greene jason.greene at redhat.com
Tue Sep 6 13:12:59 EDT 2011


On 9/6/11 11:43 AM, Sanne Grinovero wrote:
> On 6 September 2011 17:17, Jason T. Greene<jason.greene at redhat.com>  wrote:
>> On 9/6/11 9:58 AM, Sanne Grinovero wrote:
>>>
>>> On 6 September 2011 16:28, Anil Saldhana<Anil.Saldhana at redhat.com>    wrote:
>>>>
>>>> On 09/06/2011 08:38 AM, Jason T. Greene wrote:
>>>>>>>>>
>>>>>>>>>   2) copy infinispan's LIRS map
>>>>>>>
>>>>>>>   Infinispan's LIRS is not easy to extract out, you'll have to make
>>>>>>>   significant changes
>>>>>
>>>>> Last I looked it was a small handful of classes. Not a big deal. I think
>>>>> Jesper used it in ironjacamar. The security subsytem directly linked
>>>>> against it. That' something I have been meaning to open a JIRA on, since
>>>>> this is technically not a public API it's likely better to copy.
>>>>>
>>>> For the Auth Cache in the Security subsystem, we have 2 use cases:
>>>> a) Timed Cache.
>>>> b) Timed Cache with cluster distribution.
>>>>
>>>> The former is default usage while the latter is something the user
>>>> configures.
>>>>
>>>> For the cluster aware cache, we brought in direct dependence on
>>>> Infinispan cache.
>>>>
>>>> Jason, we support your insistence on  a smaller infinispan dependence.
>>>
>>> +1 from another Infinispan consumer&&    developer.
>>>
>>> If you could explain why you don't want to depend on it I'll call
>>> attention on this at the Infinispan meeting, to be held in two weeks,
>>> and see if we can do something in useful time.
>>> If the main reason is bootup time in standalone mode, right now the
>>> testsuite performs a dozen tests per second, to give a rough idea of
>>> where we stand now, but we can work on it more if that's the main
>>> factor.
>>> I don't think we ever spent any effort to optimize the boot time, so
>>> there might be some low hanging fruits.
>>
>> When we were working on 7, code which used infinispan (even without the slow
>> jaxb XML parsing) had to eat close to 500 ms initialization time. I didn't
>> look too deeply into it, but infinispan does reflective analysis and
>> injection which isnt free.
>>
>> Basically at the end of the day, when all we need is a map, there is no
>> reason to expect any initialization time that is not comparable to any other
>> map implemementation (CHM etc).
>
> Right I see your point, for internal usage you could avoid XML parsing
> and rely on the programmatic configuration, which should be much
> faster,

Yep that's exactly what we do atm.

> but reflection and injection are unlikely to be removed soon.
> I hope we will bring it significantly under 500 ms (I guess it is
> already) but obviously it won't ever be as simple as a CHM.
 >
> If one day you'll have more reasons to need it you could start a local
> CacheManager early in the boot process to be reused across all
> internal caching needs.

Think of it as hitting a finishing nail with a sledgehammer :)

Note that the JDK is planning on offering a bounded concurrent structure 
for caching in 8, so we will probably look at it is a contender when 
backporting.

-- 
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat


More information about the jboss-as7-dev mailing list