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:
PluginInfoInitialized
public class LRUStatsCache extends ExactStatsCache
UnlikeExactStatsCache
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.ExactStatsSource
-
Nested classes/interfaces inherited from class org.apache.solr.search.stats.StatsCache
StatsCache.StatsCacheMetrics
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_MAX_IDLE_TIME
static int
DEFAULT_MAX_SIZE
-
Fields inherited from class org.apache.solr.search.stats.StatsCache
COL_STATS_KEY, FIELDS_KEY, pluginInfo, statsCacheMetrics, TERM_STATS_KEY, TERMS_KEY
-
-
Constructor Summary
Constructors Constructor Description LRUStatsCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addToGlobalColStats(SolrQueryRequest req, Map.Entry<String,CollectionStats> e)
protected void
addToGlobalTermStats(SolrQueryRequest req, Map.Entry<String,TermStats> e)
protected void
addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats)
protected void
addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString)
void
clear()
Clear cached statistics.protected StatsSource
doGet(SolrQueryRequest req)
protected ShardRequest
doRetrieveStatsRequest(ResponseBuilder rb)
protected Map<String,CollectionStats>
getPerShardColStats(ResponseBuilder rb, String shard)
protected TermStats
getPerShardTermStats(SolrQueryRequest req, String t, String shard)
void
init(PluginInfo info)
protected void
printStats(SolrQueryRequest req)
-
Methods inherited from class org.apache.solr.search.stats.ExactStatsCache
doMergeToGlobalStats, doReceiveGlobalStats, doReturnLocalStats, doSendGlobalStats
-
Methods inherited from class org.apache.solr.search.stats.StatsCache
approxCheckMissingStats, get, getCacheMetrics, mergeToGlobalStats, receiveGlobalStats, retrieveStatsRequest, returnLocalStats, sendGlobalStats
-
-
-
-
Field Detail
-
DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MAX_IDLE_TIME
public static final int DEFAULT_MAX_IDLE_TIME
- See Also:
- Constant Field Values
-
-
Method Detail
-
doGet
protected StatsSource doGet(SolrQueryRequest req)
- Overrides:
doGet
in classExactStatsCache
-
clear
public void clear()
Description copied from class:StatsCache
Clear cached statistics.- Overrides:
clear
in classStatsCache
-
init
public void init(PluginInfo info)
- Specified by:
init
in interfacePluginInfoInitialized
- Overrides:
init
in classStatsCache
-
doRetrieveStatsRequest
protected ShardRequest doRetrieveStatsRequest(ResponseBuilder rb)
- Overrides:
doRetrieveStatsRequest
in classExactStatsCache
-
addToGlobalTermStats
protected void addToGlobalTermStats(SolrQueryRequest req, Map.Entry<String,TermStats> e)
- Overrides:
addToGlobalTermStats
in classExactStatsCache
-
addToPerShardColStats
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats)
- Overrides:
addToPerShardColStats
in classExactStatsCache
-
getPerShardColStats
protected Map<String,CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard)
- Overrides:
getPerShardColStats
in classExactStatsCache
-
addToPerShardTermStats
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString)
- Overrides:
addToPerShardTermStats
in classExactStatsCache
-
getPerShardTermStats
protected TermStats getPerShardTermStats(SolrQueryRequest req, String t, String shard)
- Overrides:
getPerShardTermStats
in classExactStatsCache
-
addToGlobalColStats
protected void addToGlobalColStats(SolrQueryRequest req, Map.Entry<String,CollectionStats> e)
- Overrides:
addToGlobalColStats
in classExactStatsCache
-
printStats
protected void printStats(SolrQueryRequest req)
- Overrides:
printStats
in classExactStatsCache
-
-