public class LRUStatsCache extends ExactStatsCache
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
.
ExactStatsCache.ExactStatsSource
StatsCache.StatsCacheMetrics
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_IDLE_TIME |
static int |
DEFAULT_MAX_SIZE |
COL_STATS_KEY, FIELDS_KEY, pluginInfo, statsCacheMetrics, TERM_STATS_KEY, TERMS_KEY
Constructor and Description |
---|
LRUStatsCache() |
Modifier and Type | Method and 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) |
doMergeToGlobalStats, doReceiveGlobalStats, doReturnLocalStats, doSendGlobalStats
approxCheckMissingStats, get, getCacheMetrics, mergeToGlobalStats, receiveGlobalStats, retrieveStatsRequest, returnLocalStats, sendGlobalStats
public static final int DEFAULT_MAX_SIZE
public static final int DEFAULT_MAX_IDLE_TIME
protected StatsSource doGet(SolrQueryRequest req)
doGet
in class ExactStatsCache
public void clear()
StatsCache
clear
in class StatsCache
public void init(PluginInfo info)
init
in interface PluginInfoInitialized
init
in class StatsCache
protected ShardRequest doRetrieveStatsRequest(ResponseBuilder rb)
doRetrieveStatsRequest
in class ExactStatsCache
protected void addToGlobalTermStats(SolrQueryRequest req, Map.Entry<String,TermStats> e)
addToGlobalTermStats
in class ExactStatsCache
protected void addToPerShardColStats(SolrQueryRequest req, String shard, Map<String,CollectionStats> colStats)
addToPerShardColStats
in class ExactStatsCache
protected Map<String,CollectionStats> getPerShardColStats(ResponseBuilder rb, String shard)
getPerShardColStats
in class ExactStatsCache
protected void addToPerShardTermStats(SolrQueryRequest req, String shard, String termStatsString)
addToPerShardTermStats
in class ExactStatsCache
protected TermStats getPerShardTermStats(SolrQueryRequest req, String t, String shard)
getPerShardTermStats
in class ExactStatsCache
protected void addToGlobalColStats(SolrQueryRequest req, Map.Entry<String,CollectionStats> e)
addToGlobalColStats
in class ExactStatsCache
protected void printStats(SolrQueryRequest req)
printStats
in class ExactStatsCache
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.