Thursday 10 November 2011

Optimizing Solr

Check the stats and find out these numbers: (you can find these stats in admin console of the solr)
1. queryRequestHandlers - First find out which one you are using, most likely it could be "dismax"
1. requests
2. avgTimePerRequest
2. queryResultCache
3. documentCache

Now 3 above things can be optimized...

1. If Number of requests for queryRequestHandler is quite good, say more than 10000 and avgTimePerRequest is more than 10ms, then I am pretty sure that It can be optimized.
2. Increase the documentCache size to the number of documents that you have in the index, or if it too big, then set it to the number which you think could get requested per day, might be 20000 to 30000 should suffice if you have traffic of 50000.
3. Increase the queryResultCache by the number which you think is getting request frequently
4. In both the cache, queyResultCache and documentCache, you should optimize the hit ratio to more than 95%, then caching is making sense to be used
5. Observe the avgTimePerRequest for the query handler