当我把solr服务器启动好,用btrace监控IndexSearch.search()方法,我发现虽然没有任何地方用到查询,但也会被触发:
Search .execute time is:1028ms
Search .execute time is:20ms
Search .execute time is:16ms
Search .execute time is:981ms
Search .execute time is:154ms
Search .execute time is:920ms
Search .execute time is:746ms
Search .execute time is:754ms
Search .execute time is:743ms
Search .execute time is:731ms
Search .execute time is:737ms
Search .execute time is:736ms
Search .execute time is:868ms
Search .execute time is:882ms
Search .execute time is:841ms
Search .execute time is:28ms
Search .execute time is:172ms
Search .execute time is:191ms
Search .execute time is:55ms
Search .execute time is:910ms
我怀疑是因为master的索引文件跟新了之后,slave会自动做一次warmup,把之前的记录查询一次,在日志里面发现这些信息:
先看一段日志:
INFO: autowarming result for Searcher@20e68e11 main documentCache
{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=131928, cumulative_hits=131750,cumulative_hitratio=0.99,cumulative_inserts=178,cumulative_evictions=0}
Jul 12, 2012 11:23:20 AM org.apache.solr.core.SolrCore registerSearcher
INFO: [feed] Registered new searcher Searcher@20e68e11 main
Jul 12, 2012 11:23:20 AM org.apache.solr.search.SolrIndexSearcher close
INFO: Closing Searcher@34114882 main
fieldValueCache{lookups=0,hits=0,hitratio=0.00,inserts=0,evictions=0,size=0,warmupTime=0,cumulative_lookups=0,cumulative_hits=0,cumulative_hitratio=0.00,cumulative_inserts=0,cumulative_evictions=0}
filterCache{lookups=54,hits=48,hitratio=0.88,inserts=22,evictions=0,size=22,warmupTime=5355 ,cumulative_lookups=144, cumulative_hits=113,cumulative_hitratio=0.78,cumulative_inserts=31,cumulative_evictions=0}
queryResultCache{lookups=4136,hits=4130 ,hitratio=0.99,inserts=14,evictions=0,size=14,warmupTime=691 ,cumulative_lookups=5497 , cumulative_hits=5479,cumulative_hitratio=0.99,cumulative_inserts=18,cumulative_evictions=0}
documentCache{lookups=99264,hits=99240 ,hitratio=0.99,inserts=24,evictions=0,size=24,warmupTime=0,cumulative_lookups=131928 , cumulative_hits=131750,cumulative_hitratio=0.99,cumulative_inserts=178,cumulative_evictions=0}