Warmers: Have an explicit warmer thread pool
Have an explicit threadpool warmer that is dedicated to execute warmers. Currently, it uses the search threadpool, which does not work well since the number of concurrent searches should be separate from the number of concurrent warmers allows, also the characteristics of the search pool (for example, bounded queue_size) might not fit well with how warmers should be executed (they should not be "rejected"). closes #2815
This commit is contained in:
parent
0e815ce11c
commit
b7106622d8
|
@ -23,16 +23,19 @@ import org.elasticsearch.cluster.metadata.IndexMetaData;
|
|||
import org.elasticsearch.index.engine.Engine;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.index.shard.service.IndexShard;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface IndicesWarmer {
|
||||
|
||||
static interface Listener {
|
||||
public abstract class Listener {
|
||||
|
||||
String executor();
|
||||
public String executor() {
|
||||
return ThreadPool.Names.WARMER;
|
||||
}
|
||||
|
||||
void warm(IndexShard indexShard, IndexMetaData indexMetaData, WarmerContext context);
|
||||
public abstract void warm(IndexShard indexShard, IndexMetaData indexMetaData, WarmerContext context);
|
||||
}
|
||||
|
||||
public static class WarmerContext {
|
||||
|
|
|
@ -622,12 +622,7 @@ public class SearchService extends AbstractLifecycleComponent<SearchService> {
|
|||
}
|
||||
}
|
||||
|
||||
class SearchWarmer implements IndicesWarmer.Listener {
|
||||
|
||||
@Override
|
||||
public String executor() {
|
||||
return ThreadPool.Names.SEARCH;
|
||||
}
|
||||
class SearchWarmer extends IndicesWarmer.Listener {
|
||||
|
||||
@Override
|
||||
public void warm(IndexShard indexShard, IndexMetaData indexMetaData, IndicesWarmer.WarmerContext warmerContext) {
|
||||
|
|
|
@ -71,6 +71,7 @@ public class ThreadPool extends AbstractComponent {
|
|||
public static final String MERGE = "merge";
|
||||
public static final String CACHE = "cache";
|
||||
public static final String REFRESH = "refresh";
|
||||
public static final String WARMER = "warmer";
|
||||
public static final String SNAPSHOT = "snapshot";
|
||||
}
|
||||
|
||||
|
@ -96,6 +97,7 @@ public class ThreadPool extends AbstractComponent {
|
|||
|
||||
Map<String, Settings> groupSettings = settings.getGroups(THREADPOOL_GROUP);
|
||||
|
||||
// TODO figure out the best defaults for *all* thread pools
|
||||
defaultExecutorTypeSettings = ImmutableMap.<String, Settings>builder()
|
||||
.put(Names.GENERIC, settingsBuilder().put("type", "cached").put("keep_alive", "30s").build())
|
||||
.put(Names.INDEX, settingsBuilder().put("type", "cached").build())
|
||||
|
@ -107,6 +109,7 @@ public class ThreadPool extends AbstractComponent {
|
|||
.put(Names.FLUSH, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 10).build())
|
||||
.put(Names.MERGE, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 20).build())
|
||||
.put(Names.REFRESH, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 10).build())
|
||||
.put(Names.WARMER, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", Math.min(Runtime.getRuntime().availableProcessors() / 2, 5)).build())
|
||||
.put(Names.CACHE, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 4).build())
|
||||
.put(Names.SNAPSHOT, settingsBuilder().put("type", "scaling").put("keep_alive", "5m").put("size", 5).build())
|
||||
.build();
|
||||
|
|
Loading…
Reference in New Issue