Enable adaptive replica selection by default (#26522)

Relates to #24915
This commit is contained in:
Lee Hinman 2017-09-07 09:25:05 -06:00 committed by GitHub
parent d68d8c9cef
commit cff904bf97
5 changed files with 38 additions and 21 deletions

View File

@ -46,7 +46,7 @@ import java.util.stream.Collectors;
public class OperationRouting extends AbstractComponent { public class OperationRouting extends AbstractComponent {
public static final Setting<Boolean> USE_ADAPTIVE_REPLICA_SELECTION_SETTING = public static final Setting<Boolean> USE_ADAPTIVE_REPLICA_SELECTION_SETTING =
Setting.boolSetting("cluster.routing.use_adaptive_replica_selection", false, Setting.boolSetting("cluster.routing.use_adaptive_replica_selection", true,
Setting.Property.Dynamic, Setting.Property.NodeScope); Setting.Property.Dynamic, Setting.Property.NodeScope);
private String[] awarenessAttributes; private String[] awarenessAttributes;

View File

@ -368,12 +368,3 @@ So what is the right number of replicas? If you have a cluster that has
be able to cope with `max_failures` node failures at once at most, then the be able to cope with `max_failures` node failures at once at most, then the
right number of replicas for you is right number of replicas for you is
`max(max_failures, ceil(num_nodes / num_primaries) - 1)`. `max(max_failures, ceil(num_nodes / num_primaries) - 1)`.
[float]
=== Turn on adaptive replica selection
When multiple copies of data are present, elasticsearch can use a set of
criteria called <<search-adaptive-replica,adaptive replica selection>> to select
the best copy of the data based on response time, service time, and queue size
of the node containing each copy of the shard. This can improve query throughput
and reduce latency for search-heavy applications.

View File

@ -28,8 +28,10 @@ way to reindex old indices is to use the `reindex` API.
* <<breaking_70_cluster_changes>> * <<breaking_70_cluster_changes>>
* <<breaking_70_indices_changes>> * <<breaking_70_indices_changes>>
* <<breaking_70_mappings_changes>> * <<breaking_70_mappings_changes>>
* <<breaking_70_search_changes>>
include::migrate_7_0/aggregations.asciidoc[] include::migrate_7_0/aggregations.asciidoc[]
include::migrate_7_0/cluster.asciidoc[] include::migrate_7_0/cluster.asciidoc[]
include::migrate_7_0/indices.asciidoc[] include::migrate_7_0/indices.asciidoc[]
include::migrate_7_0/mappings.asciidoc[] include::migrate_7_0/mappings.asciidoc[]
include::migrate_7_0/search.asciidoc[]

View File

@ -0,0 +1,20 @@
[[breaking_70_search_changes]]
=== Search changes
==== Adaptive replica selection enabled by default
Adaptive replica selection has been enabled by default. If you wish to return to
the older round robin of search requests, you can use the
`cluster.routing.use_adaptive_replica_selection` setting:
[source,js]
--------------------------------------------------
PUT /_cluster/settings
{
"transient": {
"cluster.routing.use_adaptive_replica_selection": false
}
}
--------------------------------------------------
// CONSOLE

View File

@ -11,10 +11,11 @@ exception of the <<search-explain>> endpoints.
[[search-routing]] [[search-routing]]
== Routing == Routing
When executing a search, it will be broadcast to all the index/indices When executing a search, Elasticsearch will pick the "best" copy of the data
shards (round robin between replicas). Which shards will be searched on based on the <<search-adaptive-replica,adaptive replica selection>> formula.
can be controlled by providing the `routing` parameter. For example, Which shards will be searched on can also be controlled by providing the
when indexing tweets, the routing value can be the user name: `routing` parameter. For example, when indexing tweets, the routing value can be
the user name:
[source,js] [source,js]
-------------------------------------------------- --------------------------------------------------
@ -60,30 +61,33 @@ the routing values match to.
[[search-adaptive-replica]] [[search-adaptive-replica]]
== Adaptive Replica Selection == Adaptive Replica Selection
As an alternative to requests being sent to copies of the data in a round robin By default, Elasticsearch will use what is called adaptive replica selection.
fashion, you may enable adaptive replica selection. This allows the coordinating This allows the coordinating node to send the request to the copy deemed "best"
node to send the request to the copy deemed "best" based on a number of based on a number of criteria:
criteria:
- Response time of past requests between the coordinating node and the node - Response time of past requests between the coordinating node and the node
containing the copy of the data containing the copy of the data
- Time past search requests took to execute on the node containing the data - Time past search requests took to execute on the node containing the data
- The queue size of the search threadpool on the node containing the data - The queue size of the search threadpool on the node containing the data
This can be turned on by changing the dynamic cluster setting This can be turned off by changing the dynamic cluster setting
`cluster.routing.use_adaptive_replica_selection` from `false` to `true`: `cluster.routing.use_adaptive_replica_selection` from `true` to `false`:
[source,js] [source,js]
-------------------------------------------------- --------------------------------------------------
PUT /_cluster/settings PUT /_cluster/settings
{ {
"transient": { "transient": {
"cluster.routing.use_adaptive_replica_selection": true "cluster.routing.use_adaptive_replica_selection": false
} }
} }
-------------------------------------------------- --------------------------------------------------
// CONSOLE // CONSOLE
If adaptive replica selection is turned off, searches are sent to the
index/indices shards in a round robin fashion between all copies of the data
(primaries and replicas).
[float] [float]
[[stats-groups]] [[stats-groups]]
== Stats Groups == Stats Groups