Skip to content

Commit

Permalink
HSEARCH-5045 Raise various default max-connection config properties f…
Browse files Browse the repository at this point in the history
…or the Elasticsearch backend
  • Loading branch information
marko-bekhta committed Oct 31, 2024
1 parent 7eec299 commit dbb8afd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private ElasticsearchBackendSettings() {
* The maximum number of simultaneous connections to the Elasticsearch cluster,
* all hosts taken together.
* <p>
* Expects a positive Integer value, such as {@code 20},
* Expects a positive Integer value, such as {@code 40},
* or a String that can be parsed into such Integer value.
* <p>
* Defaults to {@link Defaults#MAX_CONNECTIONS}.
Expand All @@ -176,7 +176,7 @@ private ElasticsearchBackendSettings() {
/**
* The maximum number of simultaneous connections to each host of the Elasticsearch cluster.
* <p>
* Expects a positive Integer value, such as {@code 10},
* Expects a positive Integer value, such as {@code 20},
* or a String that can be parsed into such Integer value.
* <p>
* Defaults to {@link Defaults#MAX_CONNECTIONS_PER_ROUTE}.
Expand Down Expand Up @@ -331,8 +331,8 @@ private Defaults() {
public static final String PATH_PREFIX = "";
public static final int READ_TIMEOUT = 30000;
public static final int CONNECTION_TIMEOUT = 1000;
public static final int MAX_CONNECTIONS = 20;
public static final int MAX_CONNECTIONS_PER_ROUTE = 10;
public static final int MAX_CONNECTIONS = 40;
public static final int MAX_CONNECTIONS_PER_ROUTE = 20;
public static final boolean DISCOVERY_ENABLED = false;
public static final int DISCOVERY_REFRESH_INTERVAL = 10;
public static final boolean LOG_JSON_PRETTY_PRINTING = false;
Expand Down
6 changes: 5 additions & 1 deletion documentation/src/main/asciidoc/migration/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ no database schema update is necessary for these tables.
== Configuration

The configuration properties in Hibernate Search {hibernateSearchVersion}
are backward-compatible with Hibernate Search {hibernateSearchPreviousStableVersionShort}.
, in general, are backward-compatible with Hibernate Search {hibernateSearchPreviousStableVersionShort}.
But some default values have changed:

- The default value of the Elasticsearch backend property `hibernate.search.backend.max_connections` is now set to `40` instead of `20`.
- The default value of the Elasticsearch backend property `hibernate.search.backend.max_connections_per_route` is now set to `20` instead of `10`.

[[api]]
== API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,30 @@ hibernate.search.backend.max_connections_per_route = 10

* `max_connections` defines maximum number of simultaneous connections
to the Elasticsearch cluster, all hosts taken together.
The default for this property is `20`.
The default for this property is `40`.
* `max_connections_per_route` defines maximum number of simultaneous connections
to each host of the Elasticsearch cluster.
The default for this property is `10`.

+
These properties expect a positive <<configuration-property-types,Integer value>>, such as `20`.

+
[NOTE]
====
When working with an Elasticsearch backend cluster, multiple cluster nodes might exist.
If so, the REST client communicating with the cluster will try to distribute the requests among the nodes.
That’s why the maximum number of connections can be set per route (cluster node)
and then limited by the general number of maximum connections.
When modifying the maximum connection values, it is worth remembering the number
of <<backend-elasticsearch-indexing-queues,indexing queues>> configured for the backend
With an application performing a lot of indexing operations, having a subpar configuration of the maximum connections may
result in all connections primarily being consumed by the indexing processes, resulting in the degrading performance of search operations,
as those would be struggling to get a connection.
To prevent that from happening consider having the maximum number of connections greater than the number of active indexing queues.
====

Keep Alive::
+
[source]
Expand Down

0 comments on commit dbb8afd

Please sign in to comment.