+1 as well.

Regards,
Pierre-Arnaud

On 31 juil. 2013, at 22:29, Kiran Ayyagari <kayyag...@apache.org> wrote:

> without further ado, my +1
> 
> 
> On Thu, Aug 1, 2013 at 1:47 AM, Emmanuel Lécharny <elecha...@gmail.com> wrote:
> Hi guys,
> 
> I have done some profiling on the search operation, and I have found
> that for each processed search, we call the modifyFilter() operation,
> which tries to optimize the filter. In this method, we check if the
> search is done on the SubSchema Subentry. To do that, we get the rootDSE
> from the Nexus, and get the SubschemaSubentry Dn :
> 
>     private boolean isSubSchemaSubEntrySearch( LdapSession session,
> SearchRequest req ) throws Exception
>     {
>         Dn base = req.getBase();
>         String baseNormForm = ( base.isSchemaAware() ?
> base.getNormName() : base.getNormName() );
> 
>         // get the rootDSE from the nexus
>         DirectoryService ds =
> session.getCoreSession().getDirectoryService();
>         PartitionNexus nexus = ds.getPartitionNexus();
> 
>         Value<?> subschemaSubentry = nexus.getRootDse( null ).get(
> SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
> 
>         // Grab the SubschemaSubentry from the rootDSE, and transform it
> to a Dn
>         Dn subschemaSubentryDn = new Dn( ds.getSchemaManager(),
> subschemaSubentry.getString() );
> 
>         String subschemaSubentryDnNorm = subschemaSubentryDn.getNormName();
> 
>         return subschemaSubentryDnNorm.equals( baseNormForm );
>     }
> 
> The two commented operations are extremely costly :
> - we clone the root DSE just to get one single attrinbute from it
> - and we parse a DN which is not lakely to change, ever.
> 
> We could most certainly spare us the CPU to do those two operations. The
> RootDSE is initialized once when we start the server, and never updated
> later, so the getRootDSE() method could perfectly be returned as is (and
> duringthe initialization, we can encapsulate the rootDse in a
> ImmutableEntry to protect it against any modification.
> 
> The very same for the subschemaSubentry DN : we could store a pre-parsed
> version of it in the rootDSE, to avoid a parsing every time we do a search.
> 
> The gain would be around 8%, per the proviling session I have conducted.
> 
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
> 
> 
> 
> 
> -- 
> Kiran Ayyagari
> http://keydap.com

Reply via email to