Make the search coordinator thread pool size configurable and set a (#2457)
reasonable default value. The default was 1 and all searches were being executed sequentially.
This commit is contained in:
parent
9f5786ba6c
commit
f752e46e84
|
@ -151,6 +151,7 @@ import org.springframework.scheduling.concurrent.ScheduledExecutorFactoryBean;
|
|||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
|
@ -200,6 +201,29 @@ public abstract class BaseConfig {
|
|||
@Autowired
|
||||
private DaoRegistry myDaoRegistry;
|
||||
|
||||
/**
|
||||
* Subclasses may override this method to provide settings such as search coordinator pool sizes.
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initSettings() {}
|
||||
|
||||
private Integer searchCoordCorePoolSize = 20;
|
||||
private Integer searchCoordMaxPoolSize = 100;
|
||||
private Integer searchCoordQueueCapacity = 200;
|
||||
|
||||
public void setSearchCoordCorePoolSize(Integer searchCoordCorePoolSize) {
|
||||
this.searchCoordCorePoolSize = searchCoordCorePoolSize;
|
||||
}
|
||||
|
||||
public void setSearchCoordMaxPoolSize(Integer searchCoordMaxPoolSize) {
|
||||
this.searchCoordMaxPoolSize = searchCoordMaxPoolSize;
|
||||
}
|
||||
|
||||
public void setSearchCoordQueueCapacity(Integer searchCoordQueueCapacity) {
|
||||
this.searchCoordQueueCapacity = searchCoordQueueCapacity;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public BatchConfigurer batchConfigurer() {
|
||||
return new NonPersistedBatchConfigurer();
|
||||
|
@ -316,6 +340,9 @@ public abstract class BaseConfig {
|
|||
public ThreadPoolTaskExecutor searchCoordinatorThreadFactory() {
|
||||
final ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
threadPoolTaskExecutor.setThreadNamePrefix("search_coord_");
|
||||
threadPoolTaskExecutor.setCorePoolSize(searchCoordCorePoolSize);
|
||||
threadPoolTaskExecutor.setMaxPoolSize(searchCoordMaxPoolSize);
|
||||
threadPoolTaskExecutor.setQueueCapacity(searchCoordQueueCapacity);
|
||||
threadPoolTaskExecutor.initialize();
|
||||
return threadPoolTaskExecutor;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue