[
https://issues.apache.org/jira/browse/DIRSERVER-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16864935#comment-16864935
]
Emmanuel Lecharny commented on DIRSERVER-2168:
----------------------------------------------
The way the {{add}} operation works is that it first check if the entry exists
or not in the backend. We do that by looking into the {{RdnIndex}}, and that
requires a forward lookup (we start by searching for the root RDN, then we
search for each RDN up to the entry's one. That means we *always* fetch the
parent's ID before failing to find the entry's ID.
Typically, let's say we want to add the {{cn=test, ou=system}} entry. We first
have to search for the {{ou=system}} ID to be able to check if the
{{ParentIdAndRdn}} key {{[<ou=system's ID>, cn=test])) exists. We have done 2
lookups in the {{RdnIndex}} (and that's fine) just to check if the entry exists
or not.
Now, if the entry does not already exist, we are going to inject a new key in
the {{RdnIndex}}, constructed with the entry's Rdn ({{cn=test}}) and the
entry's parent ID. And we do another lookup in the {{RdnIndex}} to fetch this
parent's ID, while we already have done it.
Things get worse when the entry's DN is long (like, many RDNs). If it's 5 RDNs
long, we will do 5 then 4 lookups in the {{RdnIndex}} where we should only do 5.
Bottom line, we should first fetch the parent's ID - because we need it anyway
- and then do a simple lookup in the {{RdnIndex}} with this parent'sID as a
parameter to check if the entry exists. We need a function to do so.
> Possible performance improvement in the Add operation
> -----------------------------------------------------
>
> Key: DIRSERVER-2168
> URL: https://issues.apache.org/jira/browse/DIRSERVER-2168
> Project: Directory ApacheDS
> Issue Type: Improvement
> Affects Versions: 2.0.0-M22
> Reporter: Emmanuel Lecharny
> Priority: Major
> Fix For: 2.0.0.AM26
>
>
> The {{Add}} operation is fetching two ID from the DN index :
> * The entry's ID
> * The parent's ID
> The thing is that when we fetch the entry's ID, we also fetch the parent's
> ID. It would be better to first fetch the parent's ID and the the entry,
> saving quite a lot of index access.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]