Skip to content

Commit

Permalink
hsearch-es: Add an option to configure the thread pool size
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Apr 2, 2020
1 parent cf40509 commit 7b485d9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ private void contributeBackendRuntimeProperties(BiConsumer<String, Object> prope
elasticsearchBackendConfig.maxConnections);
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.MAX_CONNECTIONS_PER_ROUTE,
elasticsearchBackendConfig.maxConnectionsPerRoute);
addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.THREAD_POOL_SIZE,
elasticsearchBackendConfig.threadPool.size);

addBackendConfig(propertyCollector, backendName, ElasticsearchBackendSettings.DISCOVERY_ENABLED,
elasticsearchBackendConfig.discovery.enabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

import org.hibernate.search.backend.elasticsearch.index.IndexStatus;
import org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames;
Expand Down Expand Up @@ -118,6 +119,12 @@ public static class ElasticsearchBackendRuntimeConfig {
@ConfigItem
DiscoveryConfig discovery;

/**
* Configuration for the thread pool assigned to the backend.
*/
@ConfigItem
ThreadPoolConfig threadPool;

/**
* The default configuration for the Elasticsearch indexes.
*/
Expand Down Expand Up @@ -418,6 +425,18 @@ public static class SchemaManagementConfig {

}

@ConfigGroup
public static class ThreadPoolConfig {
/**
* The size of the thread pool assigned to the backend.
* <p>
* Defaults to the number of processor cores available to the JVM on startup.
*/
// We can't set an actual default value here: see comment on this class.
@ConfigItem
OptionalInt size;
}

// We can't set actual default values in this section,
// otherwise "quarkus.hibernate-search.elasticsearch.index-defaults" will be ignored.
@ConfigGroup
Expand Down

0 comments on commit 7b485d9

Please sign in to comment.