directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lecharny <>
Subject Re: DN and valueOf( "<a DN>" ) method
Date Wed, 28 Jul 2010 11:07:51 GMT
  On 7/28/10 11:31 AM, Stefan Seelmann wrote:
>> I was thinking lately about the DN class. I know that OpenDS (and probably
>> UnboundId, but not sure) has a DN.valueOf( "<a DN>" ) factory that returns
>> DN potentially leveraging a cache associated to a ThreadLocal.
> ...
>> I don't think it's such a good idea :
>> - first, as it's ThreadLocal based, you will have as many cache as you have
>> threads processing requests. Not sure it competes with a unique cache, not
>> sure either we can't use the memory in a better way...
> An advantage to use ThreadLocal is that you don't need to synchronize
> access to the cache Could be worth to measure the performance
Using ConcurrentHashMap should not be a major performance penalty. I 
mean, it *will* be more costly than not having any synchronization but 
it sounds acceptable.

Another possibility is to use a CopyOnWriteArraySet, but I'm afraid that 
it will crawl if many new DN are added.
> difference, I wonder if the OpenDS team did some performance analysis?
They compared the performances they get with a ThreadLocal cache and no 
cache : the gain was sensible (I don't have the number for OpenDS). FYI, 
the DN parsing count for more or less 13% of the whole CPU needed 
internally (network excluded) to process a simple search, and 
normalization cost an extra 10%. There is most certainly a net potential 
gain to implement a DN cache !

Emmanuel L├ęcharny

View raw message