Guidelines for Optimizing Searches


Topic Last Modified: 2005-05-06

This topic provides information you can use to increase the efficiency of searches while minimizing the performance cost of those searches. It describes how search folders affect the operation of the server running Exchange Server 2003 where they reside, how you can reduce the number of search folders created, and the circumstances in which you might want to change the default limits controlling search folders.

Search folders can affect the performance of an Exchange Server 2003 mailbox or public folder server in two major ways: they can increase the processing load on the server, and they can increase the size of the transaction logs on the server (sometimes drastically).

Creating a search folder incurs a certain processing cost on the Exchange server. In addition, Exchange Server 2003 treats this operation as a transaction that must be logged. Every time that Exchange Server 2003 processes a new search request, the transaction log files increase in size. One of the simplest ways to control this increase is to reuse existing search requests whenever possible.

After a search folder has been created, Exchange Server 2003 maintains it and updates it when the target folder (the folder that was searched) changes. If a message is added to, deleted from, or modified in the target folder, Exchange Server 2003 updates the search folder accordingly. Such updates increase the processing load associated with each affected search folder, and each such update is logged in the transaction logs. Therefore, searching folders that are frequently modified can affect the performance of a server much more than searching folders that are largely static and unchanging.

If a user posts a message with a large attached file to a target folder, the amount of data added to the transaction log files varies depending on the size of the attachment.

Searches that use the read or unread state of a message as a search condition also have a special performance impact. If you search a public folder that tracks per-user read and unread information, the search produces not one search folder but a search folder for each user that is associated with messages in the target folder. Each of these search folders has a corresponding impact on performance and on the transaction logs. In addition, referencing an unread item in such a folder changes its state to read. Exchange Server 2003 considers this to be a folder update, and it updates the related search folders accordingly.

The number of users connected to a search folder at any one time can also increase the load on the Exchange server, causing a noticeable increase in response time.

Each unique search request creates its own search folder. The query processor considers two searches to be the same if their result sets and the search expressions are identical. If a new search is identical to a previous search for which a search folder exists, the query processor can reuse the existing search folder rather than create a new one.

If many of your users run the same search repeatedly, or if you run many similar searches, use identical search expressions as much as possible. Reducing the number of search expressions reduces the load on the server and reduces the number of search folders created.

Exchange Server 2003 limits the number of search folders that can be maintained for a single target folder, and it limits the time that those search folders are retained after they are last used. By default, the maximum number of search folders is 11, and the maximum retention time is 8 days. You can change these default values at the store level using the msExchMaxCachedViews and msExchAgingKeepTime attributes. You can also use the attribute of a folder to limit the number of search folders for a specific target folder.

Each different search request creates a different search folder, and the number of simultaneous search folders for a specific target folder is limited. If your users or custom applications use many different types of search requests (instead of repeatedly issuing the same search request), increasing the maximum number of search folders increases the search efficiency. However, there is a significant disadvantage to this approach. Increasing the number of search folders also increases the time that it takes to update those folders, and increases the processing cost of each search as Exchange Server 2003 checks to see if a search can reuse an existing folder. Therefore, increasing the number of search folders is generally only practical when you are using a limited selection of search requests on folders that are largely static (updates are rare).

Generally, you should minimize the number of different types of search requests whenever possible, and also minimize the number of search folders.

Although you can change the default values, you should not change them unless you test the changes thoroughly. Use a test topology to simulate the load that you anticipate, and make sure that the changes do not adversely affect your system.

For detailed steps about how to change the maximum number of search folders per target folder for a store, see How to Change the Maximum Number of Search Folders per Target Folder for a Store.

For detailed steps about how to change the length of time that Exchange Server 2003 retains search folders for a store, see How to Change the Length of Time That Exchange Server 2003 Retains Search Folders for a Store.


Community Additions