Specify connection timeout


This topic describes how you can specify the connection timeout for Solr in different ways.

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:

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