| Executive Summary: |
The Windows Indexing Service can help you quickly search through files, but problems can arise that can make Windows XP Professional and other Windows operating systems sluggish and even hang. The Microsoft Management Console (MMC) Indexing Service snap-in can help you troubleshoot the problem. Microsoft Customer Service and Support (CSS) offers three solutions if the problem lies with master merges.
In my Reader To Reader article "Create an MMC Snap-In for Searching PDF Files" (March 2007, InstantDoc ID 94950), I expounded on the virtues of using Windows' Indexing Service to quickly search through mounds of files, including .pdf, .doc, .mht, .html, and .txt files. I might have jinxed myself because after I wrote that article, I began experiencing performance problems on my Windows XP Professional machine, which currently indexes about 6,700 files. When I attempted to open Microsoft Office files from the Windows desktop or Windows Explorer, my computer would sometimes hang for two to three minutes. (Interestingly, the computer didn't hang when I opened files from their native applications, such as Microsoft Word or Microsoft Excel.) The computer would also hang when I tried to do a file search from within Windows Explorer. However, I found that if I stopped the Indexing Service, my computer didn't hang. Leaving the Indexing Service disabled wasn't an option for me, so I'd restart the Indexing Service. Shortly thereafter (sometimes as soon as an hour later), my computer would start hanging again.
I used the custom Microsoft Management Console (MMC) snap-in that I created (see "Create an MMC Snap-In for Searching PDF Files") to monitor activities within the Indexing Service. The Indexing Service is supposed to throttle back when you're using the computer, but I noticed that when my computer was hanging, not all of the Indexing Service catalogs were in the Paused, User Activity state.
To correct the problem, I attempted to tune the Indexing Service through the MMC Indexing Service snap-in. After stopping the Indexing Service, I right-clicked Indexing Service on Local Machine, chose All Tasks, then selected Tune Performance. In the Indexing Service Usage dialog box, I selected the Used Occasionally option, which sets indexing to Lazy and querying to Low load. After closing the Indexing Service snap-in, I restarted the Indexing Service. It wasn't long before I discovered that this change didn't stop my machine from hanging.
I decided to dig a little deeper into how the Indexing Service works. I learned that the service creates temporary working catalogs as part of its normal daily operations. A temporary working catalog consists of word lists and saved indexes. When the Indexing Service indexes a document, the index information first goes into a temporary word list. When the Indexing Service stores an index on disk, it's placed in a temporary saved index. Periodically, the Indexing Service merges each catalog's word lists and stored indexes into a permanent master index, after which it deletes all the word lists and deletes all but one of the stored indexes.
You can see how many words lists and saved indexes exist for a catalog at any point in time by clicking Indexing Service on Local Machine in the Indexing Service snap-in and looking at the Word Lists and Saved Indexes columns, which Figure 1 shows, in the catalog summary in the right pane. In Figure 1, note the zeros in the third catalog's Word Lists and Saved Indexes columns. If you set a particular catalog's Include in Index? option to No, these columns will always contain zeros.
After periodically checking the catalog summary for several days, I noticed that the number of word lists and saved indexes for my various catalogs never went down but rather increased each day. Apparently, the word lists and stored indexes weren't being merged into master indexes.
As an interim solution, I forced each catalog to do a master merge by opening the Indexing Service snap-in, right-clicking a catalog, then selecting All Tasks, Merge. After a short period of time, the numbers in the Word Lists column dropped to zero and the numbers in the Saved Indexes column dropped to one, as Figure 2 shows. More important, my computer didn't hang any more.
To permanently fix the hanging problem, I had to determine why my catalogs weren't getting a master merge. An investigation led me to the Main Registry Entries Web page (http://msdn2.microsoft.com/enus/library/ms692119.aspx), which is part of the Indexing Service section in the Platform SDK. From this Web page, I learned about a registry entry named MasterMerge-Time, which is under the HKEY_ LOCAL_MACHINE\SYSTEM\ CurrentControlSet\Control\ContentIndex key. The MasterMergeTime entry's value specifies the time (represented as the number of minutes after midnight) at which a master merge will occur. The range of values is 0 through 1439. The default value is 0, which means that the master merge will occur exactly at midnight.
After I read about the MasterMergeTime entry, I had my suspicion about what might be wrong. When I checked with Microsoft Customer Service and Support (CSS), a support engineer confirmed my suspicion: If a machine isn't powered up when the master merge is scheduled to take place, the master merge won't occur. In addition, the support engineer told me that master merges also automatically occur after a certain number of documents have been indexed and when disk space gets low. And as the number of word lists and saved indexes increase, the computer's performance degrades.
The support engineer noted that I had three options to stop my machine from hanging:
Disable the Indexing Service.
Change the MasterMergeTime value to a time of day when the machine is powered up and can handle the extra CPU overhead brought about by the master merge.
Manually force a master merge for each catalog at regular intervals.
Disabling the Indexing Service wasn't an option for me. Manually forcing master merges for each catalog would be too time-consuming. So, I opted to change the MasterMergeTime value. Since I changed the value to a time of day when the PC is running but idle, I haven't had any more problems with my machine hanging because of the Indexing Service.
I also learned one other helpful tip from the support engineer. By default, XP Pro creates catalog indexes for two locations: the My Documents folder and the default IIS site. Typically, the catalog for the My Documents folder is at C:\System Volume Information\catalog.wci, whereas the catalog for the IIS site is at C:\Inetpub\ catalog.wci. If you want to run the Indexing Service because you need it for some special directories you have, but you don't need the ability to search the My Documents folder and the default IIS site for text strings, you can take one of two actions:
Not recommended: In the Indexing Service snap-in, delete the catalogs for the default locations.
Recommended: In the Indexing Service snapin, expand the catalog's Directories folder in the left pane. In the right pane, double-click each directory, which brings up a dialog box that has the odd name of Add Directory. In this dialog box, change the Include in Index? option from Yes to No. If you want to recover disk space after this change, you can force a master merge on that particular catalog. Note that although you can stop the indexing of a particular catalog by right-clicking the catalog in the left pane and selecting Stop, this action only temporarily stops the indexing. The indexing of that catalog will resume the next time the Indexing Service is started manually or the machine boots up (assuming the Indexing Service is set to the default startup setting of Automatic).
If your computer hangs or has other performance problems when you're opening or searching for files, you might want to use the Indexing Service snap-in to monitor your catalogs. If the numbers in the Word Lists and Saved Indexes columns for your catalogs never go down, you likely have a problem with master merges.