Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Improving the performance of views
The performance of view-based hierarchies depends on the construction of the hierarchy itself and the number of entries in the directory tree (DIT).
In general, there may be a marginal change in performance (within a few percentage points of equivalent searches on a standard DIT) if you use virtual DIT views. If you do not invoke a view in a search, then there is no performance impact. Test the virtual DIT views against expected search patterns and loads before deployment.
Red Hat recommends indexing the attributes used in view filters if you intend to use the views as general-purpose navigation tools in the organization.
Further, you can configure a virtual list view (VLV) index to be used in evaluation of sub-filters in views.
There is no need to tune any other part of the directory specifically for views.
2.1. Creating indexes to improve the performance of views using the command line Copiar o linkLink copiado para a área de transferência!
Views are derived from search results based on a given filter. Part of the filter are the attributes given explicitly in the nsViewFilter
; the rest of the filter is based on the entry hierarchy, looking for the entryid
and parentid
operational attributes of the actual entries included in the view.
(|(parentid=search_base_id)(entryid=search_base_id))
(|(parentid=search_base_id)(entryid=search_base_id))
If any of the searched attributes - entryid
, parentid
, or the attributes in the nsViewFilter
- are not indexed, then the search becomes partially unindexed and Directory Server searches the entire directory tree for matching entries.
To improve views performance, create the indexes as follows:
-
Create equality index (
eq
) forentryid
. Theparentid
attribute is indexed in the system index by default. -
If a filter in
nsViewFilter
tests presence (attribute=*
), then create presence index (pres
) for the attribute being tested. You should use this index type only with attributes that appear in a minority of directory entries. -
If a filter in
nsViewFilter
tests equality (attribute=value
), create equality index (eq
) for the attribute being tested. -
If a filter in
nsViewFilter
tests a substring (attribute=value*
), create substring index (sub
) for the attribute being tested. -
If a filter in
nsViewFilter
tests approximation (attribute~=value
), create approximate index (approximate
) for the attribute being tested.
For example, when you use the following view filter:
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))
you should index objectClass
with the equality index, which is done by default, and roomNumber
with the substring index.
Prerequisites
- You are aware of the attributes that you use in a view filter.
Procedure
Optional: List the back ends to determine the database to index:
dsconf instance_name backend suffix list
# dsconf instance_name backend suffix list dc=example,dc=com (userroot)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note the selected database name (in parentheses).
Create index configuration with the
dsconfig
utility for the selected back-end database.Specify the attribute name, index type, and, optionally, matching rules to set collation order (OID), especially in case of an internationalized instance.
dsconf instance_name backend index add --attr roomNumber --index-type sub userroot
# dsconf instance_name backend index add --attr roomNumber --index-type sub userroot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Repeat this step for each attribute used in the view filter.
Reindex the database to apply the new indexes:
dsconf instance_name backend index reindex userroot
# dsconf instance_name backend index reindex userroot
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Perform a search that is based on the standard directory tree with the same filter that you use in the view:
ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b dc=example,dc=com (&(objectClass=inetOrgPerson)(roomNumber=*66)) ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b dc=example,dc=com "(&(objectClass=inetOrgPerson)(roomNumber=*66))"
# ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b dc=example,dc=com (&(objectClass=inetOrgPerson)(roomNumber=*66)) # ldapsearch -D "cn=Directory Manager" -W -H ldap://server.example.com -x -b dc=example,dc=com "(&(objectClass=inetOrgPerson)(roomNumber=*66))"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the access log in
/var/log/dirsrv/slapd-instance_name/access
.The
RESULT
of your search should not containnote=U
orPartially Unindexed Filter
in the details.
2.2. Creating indexes to improve the performance of views using the web console Copiar o linkLink copiado para a área de transferência!
Views are derived from search results based on a given filter. Part of the filter are the attributes given explicitly in the nsViewFilter
; the rest of the filter is based on the entry hierarchy, looking for the entryid
and parentid
operational attributes of the actual entries included in the view.
(|(parentid=search_base_id)(entryid=search_base_id))
(|(parentid=search_base_id)(entryid=search_base_id))
If any of the searched attributes - entryid
, parentid
, or the attributes in the nsViewFilter
- are not indexed, then the search becomes partially unindexed and Directory Server searches the entire directory tree for matching entries.
To improve views performance, create the indexes as follows:
-
Create equality index (
eq
) forentryid
. Theparentid
attribute is indexed in the system index by default. -
If a filter in
nsViewFilter
tests presence (attribute=*
), then create presence index (pres
) for the attribute being tested. You should use this index type only with attributes that appear in a minority of directory entries. -
If a filter in
nsViewFilter
tests equality (attribute=value
), create equality index (eq
) for the attribute being tested. -
If a filter in
nsViewFilter
tests a substring (attribute=value*
), create substring index (sub
) for the attribute being tested. -
If a filter in
nsViewFilter
tests approximation (attribute~=value
), create approximate index (approximate
) for the attribute being tested.
For example, when you use the following view filter:
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))
you should index objectClass
with the equality index, which is done by default, and roomNumber
with the substring index.
Prerequisites
- You are logged in to the instance in the web console.
- You are aware of the attributes that you use in a view filter.
Procedure
- Under Database, select a suffix from the configuration tree for which you want to create an index.
- Navigate to Indexes and Database Indexes.
- Click the button.
- Type the name of the attribute and select the attribute.
- Select the Index Types that should be created for this attribute.
- Optionally, add Matching Rules to specify collation order (OID), especially in case of an internationalized instance.
- Select Index attribute after creation to rebuild the index afterwards.
- Click .
- Repeat the steps for each attribute to be indexed.
Verification
- Filter Indexes by typing the name of the added attribute.
- The newly indexed attribute should appear in the results.