Best Practices: Solr Memory Management
To ensure optimized, high-performance Solr queries, you need to balance your allocated core resources with the number and weight of the documents held in cache.
Solr uses heap memory and off-heap memory. Although Solr automatically uses available off-heap memory, you can control how to use heap memory. In most cases, Solr doesn't require the use of large heap memory.
You can expect positive results by optimizing memory use, rather than simply increasing heap memory; increasing heap memory can negatively impact performance. Solr doesn't use additional memory by default: you must configure it to do so.
- Current requests, indexing
- Field cache, per node or instance
- Field value cache, per core
- Document cache, per core
- Filter cache, per core
- Query cache, per core
You can control the size of these caches by customizing the solrconfig.xml file. Use the Solr admin console to view the size and effectiveness of these caches, then use this information to make optimizations.
Use _docValues_ when you require Facet Grouping. Solr queries perform best when they load documents from cache instead of accessing them from the disk. Use caution with _docValues_ for index fields, since it can increase memory use.
- Increase the size of the caches in line with the size of your indexes and cores.
- Configure the autowarming queries to warm the caches on startup.
For more information, refer to the Solr wiki at Apache.org
.
Using the solrconfig.xml file, you can define your own cache sizes for filters, queries, and storing documents. By increasing the document cache, you can make more documents be available from memory, requiring fewer documents to be loaded from storage. This configuration typically improves query time.
- One index
- Four replicas (one per server)
- One shard
You can review the number of replicas being used by viewing the Services panel in the Environment details page.