Skip to Content

3 Types of Solr Caches (Sarah Turner)

Jan 18, 2010

Solr has basically three types of built-in caches. By setting up the caches properly, application performance can be improved.

Let us look at the three types of Solr caches that should be carefully used after enough consideration given to the actual usage of the application.

FilterCache This cache stores information to filter out the right documents across the entire index for a particular query. This cache is based on unordered document ids. It is used for caching filter queries. This cache will not present the returned documents in a sequence and so, is not appropriate for caching a query that relies on relevance or sort fields.

QueryCache This cache is based on ordered document ids. This is used for caching the results of normal queries. This cache requires much less RAM compared to FilterCache because it only caches the returned documents, while the FilterCache caches the results for the whole index. The optimal size of this cache should be decided based on the results of the common queries that are cached.

DocumentCache: This cache stores stored fields that increases speed of retrieval. Solr caches documents in memory so that no request has to use disk space for stored fields. This can be very valuable as stored fields are most often used for hit list displays. The size of this cache should be set to at least (max_results) * (max_concurrent_queries), in order to ensure that Solr does not need to re-fetch a document during a request.

Some Important Points to Note 1. Always check the cache statistics that is shown in the Solr admin webpage. Very low hit rates mean that the cache may be doing more harm than good. Very high eviction rate could mean that the cache is too small, and also may be doing more harm than good. 2. Remember to check the Solr Wiki on SolrCaching and be sure to use the appropriate settings for best performance. 3. Always be mindful of the autowarm value. This tells Solr how many entries to take from the old cache and put into the new one when a new view of the index is opened. 4. The document cache cannot be autowarmed, while the other two require a large value that is big enough to give the caches a good filling.
About the AuthorUsing Solr caches can greatly improve enterprise search application performance..

Similar entries