So let’s start with information about the information that documentCache holds. So documentCache contain Lucene documents that were fetched from the index. So little and so much.
Every object (Lucene document) stored in documentCache contains a list of references to the fields, that are stored with the document. Thanks to this, when a document is fetched and put into the cache it doesn’t have to be fetched again while processing another query. And this is why the number of I/O operations is reduces when rendering the query results list.
When using documentCache you have to remember about to important things:
The standard documentCache definition looks like this:
<documentCache class="solr.FastLRUCache" size="16384" initialSize="16384"/>
Let’s recall those parameters:
The usual question about cache – what size should I set ? According to the information from Solr wiki (http://wiki.apache.org/solr/SolrCaching#documentCache), the maximum size shouldn’t be less than the product of concurrent queries and the maximum number of documents fetched by the query. A simple relation that should ensure that Solr won’t have to fetch documents from the index during query processing.
In the case of documentCache we don’t have to worry about how we construct our queries to properly use this cache. But please remember that documentCache requires memory, the more memory, the more field you stored in the index.