Enabling cache autowarming in search servers

You can ensure that Search is immediately responsive after indexing by 'auto-warming' your search caches. If the caches are not prefilled, you might experience unpredictable delays in search response until enough queries fill the caches.

About this task

After indexing, it takes time for Solr Search cores to rebuild their caches. During this period, search core responses can be delayed. In some cases, such delays might result in timeouts by processes that are waiting for the response. To avoid such delays, you can prepopulate the caches, a process known as auto-warming. Solr auto-warms its cores by issuing user-defined warming queries that fill the search caches with commonly requested data.

Enable the auto-warming feature by using the following procedure. When an index is configured to use shards or an extension index, the extension indexes do not warm-start. Set an initial query delay (such as 120 seconds) to allow all the search cores to start.

Procedure

  1. Edit the file solrhome/MC_masterCatalogId/locale_name/indextype/conf/solrconfig.xml.
  2. Insert the following code snippet,
    <searchComponent name="wc_query" class="com.ibm.commerce.foundation.internal.server.services.search.component.solr.SolrSearchMultipleQueryComponent">
            <int name="cacheSize">1320000</int>
            <str name="referenceField">catentry_id</str>
            <arr name="subCores">
            </arr>
            <int name="queryDelaySeconds">120</int>
            <arr name="queries">
                <lst>
                    <str name="q">*.*</str>
                    <str name="fq">inv_strlocqty_xxxx:xxxx:*</str>
                    <str name="rows">0</str>
                </lst>
            </arr>
        </searchComponent>   
    
    The searchComponent element and its variable attributes cacheSize, referenceField, subCores, and queryDelaySeconds define a warming query to be used at the subcore level. Its execution is delayed by 120 seconds to ensure that the subcores have all started. The cache size is specified as 132000. You can define which queries to issue in the queries array You may include multiple queries, which will be executed in sequence.
    Note: Include warming queries that return your most commonly requested documents. The queries in the sample snippet are only examples.
  3. Save and close the file.
  4. If you are using master and subordinate servers, repeat the procedure with each subordinate server.