Package org.apache.solr.search.stats
Class LRUStatsCache
java.lang.Object
org.apache.solr.search.stats.StatsCache
org.apache.solr.search.stats.ExactStatsCache
org.apache.solr.search.stats.LRUStatsCache
- All Implemented Interfaces:
AutoCloseable,SolrInfoBean,SolrMetricProducer,PluginInfoInitialized
Unlike
ExactStatsCache this implementation preserves term stats across queries in a set
of LRU caches (with the same life-cycle as SolrIndexSearcher), and based on surface features of a
query it determines the need to send additional requests to retrieve local term and collection
statistics from shards. As a result the additional requests may be needed much less frequently.
Query terms, their stats and field stats are maintained in LRU caches, with the size by
default DEFAULT_MAX_SIZE, one cache per shard. These caches are updated as needed (when
term or field statistics are missing). Each instance of the component keeps also a global stats
cache, which is aggregated from per-shard caches.
Cache entries expire after a max idle time, by default DEFAULT_MAX_IDLE_TIME.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.solr.search.stats.ExactStatsCache
ExactStatsCache.ExactStatsSourceNested classes/interfaces inherited from class org.apache.solr.search.stats.StatsCache
StatsCache.StatsCacheMetricsNested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class org.apache.solr.search.stats.StatsCache
COL_STATS_KEY, FIELDS_KEY, pluginInfo, statsCacheMetrics, TERM_STATS_KEY, TERMS_KEYFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidaddToPerShardColStats(SolrQueryRequest req, String shard, Map<String, CollectionStats> colStats) protected voidaddToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString) voidclear()Clear cached statistics.protected StatsSourcedoGet(SolrQueryRequest req) protected ShardRequestprotected Map<String, CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard) protected TermStatsgetPerShardTermStats(SolrQueryRequest req, String t, String shard) voidinit(PluginInfo info) protected voidMethods inherited from class org.apache.solr.search.stats.ExactStatsCache
doMergeToGlobalStats, doReceiveGlobalStats, doReturnLocalStats, doSendGlobalStatsMethods inherited from class org.apache.solr.search.stats.StatsCache
approxCheckMissingStats, close, get, getCacheMetrics, getCategory, getDescription, getName, getSolrMetricsContext, initializeMetrics, mergeToGlobalStats, receiveGlobalStats, retrieveStatsRequest, returnLocalStats, sendGlobalStats
-
Field Details
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE- See Also:
-
DEFAULT_MAX_IDLE_TIME
public static final int DEFAULT_MAX_IDLE_TIME- See Also:
-
-
Constructor Details
-
LRUStatsCache
public LRUStatsCache()
-
-
Method Details
-
doGet
- Overrides:
doGetin classExactStatsCache
-
clear
public void clear()Description copied from class:StatsCacheClear cached statistics.- Overrides:
clearin classStatsCache
-
init
- Specified by:
initin interfacePluginInfoInitialized- Overrides:
initin classStatsCache
-
doRetrieveStatsRequest
- Overrides:
doRetrieveStatsRequestin classExactStatsCache
-
addToGlobalTermStats
- Overrides:
addToGlobalTermStatsin classExactStatsCache
-
addToPerShardColStats
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String, CollectionStats> colStats) - Overrides:
addToPerShardColStatsin classExactStatsCache
-
getPerShardColStats
- Overrides:
getPerShardColStatsin classExactStatsCache
-
addToPerShardTermStats
- Overrides:
addToPerShardTermStatsin classExactStatsCache
-
getPerShardTermStats
- Overrides:
getPerShardTermStatsin classExactStatsCache
-
addToGlobalColStats
- Overrides:
addToGlobalColStatsin classExactStatsCache
-
printStats
- Overrides:
printStatsin classExactStatsCache
-