17

I'm trying to compare the performance of different Solr queries. In order to get a fair test, I want to clear the cache between queries.

How is this done? Of course, one can restart the server, I was curious if there is a quicker way.

Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
  • To get an even fairer test (depending on what you are actually measuring), you could could also clear the OS buffer cache before every test (see http://linux-mm.org/Drop_Caches). – jpountz Feb 01 '12 at 15:14
  • @jpountz thanks for the link. I tested it with `echo 3 > /proc/sys/vm/drop_caches` but it does not clear the Solr caches. – arun Dec 13 '12 at 21:32
  • Right, it only clears the OS cache. To clear solr caches, I think having autowarmCount=0 and running a commit would work http://wiki.apache.org/solr/SolrCaching#autowarmCount ' – jpountz Dec 13 '12 at 21:59

3 Answers3

7

I'm using version 4.2.1 and even with autowarmCount="0" the cache is not updated after doing a Dataimport.

In that case, on Solr Admin (usually http://localhost:8983/)

Go to Core Admin and click Reload. When refreshed, you should see a green check mark on the "current" field.

bubbassauro
  • 3,969
  • 2
  • 45
  • 45
3

Disable all the caches from solrconfig.xml.

Note that the Lucene FieldCache will still be enabled.

nikhil500
  • 3,458
  • 19
  • 23
0

Just for thorough details

If you want to disable a cache (or all), comment out those sections in solrconfig.xml and restart solr.

example diable queryResultCache

   <!-- 
   <queryResultCache class="solr.LRUCache"
                      size="5000"
                      initialSize="5000"
                      autowarmCount="2000"/>

-->
Hafiz Muhammad Shafiq
  • 8,168
  • 12
  • 63
  • 121