Specify connection timeout

Current version: 10.0

Sitecore interacts with the Solr server for index operations, running search queries, managing Solr schema, and administrating Solr cores. By default, Sitecore uses the same timeout configuration for all requests, regardless of the purpose of the request.

But requests with different purposes can sometimes benefit from having different request timeout values. For example, requests that update Solr schemas or change Solr core properties are rare so a longer timeout for such operations is acceptable. Search queries, on the other hand, can degrade the whole system performance if the timeout is too long.

Therefore, you can specify distinct connection timeout values for three different types of operations:

  • Admin: used for core admin operations. You can see a full list of these operations at the Solr website.

  • Query: used for regular search queries.

  • Default: used for operations that are neither of the above.

To enable and specify distinct connections timeout values.

  1. Rename the App_Config\Include\Examples\Sitecore.ContentSearch.Solr.ConnectionSettings.config.example file to App_Config\Include\Examples\Sitecore.ContentSearch.Solr.ConnectionSettings.config.

  2. Specify the values (in milliseconds) you require for admin, query, and default:

    RequestResponse
    <sitecore search:require="solr">
    <contentSearch>
      <indexConfigurations>
    
        <!-- HTTP WEB REQUEST FACTORY
             Allows you to override the http web request factory. This factory class is responsible for creating IHttpWebRequest's.
        -->
        <solrHttpWebRequestFactory type="HttpWebAdapters.HttpWebRequestFactory, SolrNet" />
    
        <!-- SOLR CONNECTION CONFIGURATIONS
    	     Allows to configure connections to Solr which are used for different types of operations.
        -->
        <solrConnectionConfigurations>
    
          <!-- Connection configuration used for the CoreAdmin operations. -->
          <solrConnectionConfiguration name="admin">
            <timeout>0</timeout>
            <!-- This connection type requires the 'usePost' element is set to 'false'. -->
            <usePost>false</usePost>
          </solrConnectionConfiguration>
    
          <!-- Connection configuration used for the Query operations. -->
          <solrConnectionConfiguration name="query">
            <timeout>0</timeout>
            <usePost>false</usePost>
          </solrConnectionConfiguration>
    
          <!-- Connection configuration used for the rest of operations. -->
          <solrConnectionConfiguration name="default">
            <timeout>0</timeout>
            <!-- This connection type requires the 'usePost' element is set to 'false'. -->
            <usePost>false</usePost>
          </solrConnectionConfiguration>
        </solrConnectionConfigurations>
      </indexConfigurations>
    </contentSearch>
    </sitecore>

Do you have some feedback for us?

If you have suggestions for improving this article,