Skip to content

Commit

Permalink
Expose per node counts (#93439)
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Feb 2, 2023
1 parent a0343e4 commit 513dc2f
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 133 deletions.
79 changes: 48 additions & 31 deletions docs/reference/cluster/get-desired-balance.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,53 +33,70 @@ The API returns the following result:
"reconciliation_time_in_millis": 0
},
"cluster_balance_stats" : {
{
"tiers": {
"data_hot" : {
"total_shard_size" : {
"total" : 36.0,
"min" : 10.0,
"max" : 16.0,
"average" : 12.0,
"std_dev" : 2.8284271247461903
"shard_count" : {
"total" : 7.0,
"min" : 2.0,
"max" : 3.0,
"average" : 2.3333333333333335,
"std_dev" : 0.4714045207910317
},
"total_write_load" : {
"forecast_write_load" : {
"total" : 21.0,
"min" : 6.0,
"max" : 8.5,
"average" : 7.0,
"std_dev" : 1.0801234497346435
},
"shard_count" : {
"total" : 7.0,
"min" : 2.0,
"max" : 3.0,
"average" : 2.3333333333333335,
"std_dev" : 0.4714045207910317
"forecast_disk_usage" : {
"total" : 36.0,
"min" : 10.0,
"max" : 16.0,
"average" : 12.0,
"std_dev" : 2.8284271247461903
}
},
"data_warm" : {
"total_shard_size" : {
"total" : 42.0,
"min" : 12.0,
"max" : 18.0,
"average" : 14.0,
"std_dev" : 2.8284271247461903
"shard_count" : {
"total" : 3.0,
"min" : 1.0,
"max" : 1.0,
"average" : 1.0,
"std_dev" : 0.0
},
"total_write_load" : {
"forecast_write_load" : {
"total" : 0.0,
"min" : 0.0,
"max" : 0.0,
"average" : 0.0,
"std_dev" : 0.0
},
"shard_count" : {
"total" : 3.0,
"min" : 1.0,
"max" : 1.0,
"average" : 1.0,
"std_dev" : 0.0
"forecast_disk_usage" : {
"total" : 42.0,
"min" : 12.0,
"max" : 18.0,
"average" : 14.0,
"std_dev" : 2.8284271247461903
}
}
},
"nodes": {
"node-1": {
"shard_count": 10,
"forecast_write_load": 8.5,
"forecast_disk_usage_bytes": 498435
},
"node-2": {
"shard_count": 15,
"forecast_write_load": 3.25,
"forecast_disk_usage_bytes": 384935
},
"node-3": {
"shard_count": 12,
"forecast_write_load": 6.0,
"forecast_disk_usage_bytes": 648766
}
}
},
"routing_table": {
Expand All @@ -95,8 +112,8 @@ The API returns the following result:
"relocating_node_is_desired": false,
"shard_id": 0,
"index": "test",
"forecasted_write_load": 8.0,
"forecasted_shard_size_in_bytes": 1024
"forecast_write_load": 8.0,
"forecast_shard_size_in_bytes": 1024
}
],
"desired": {
Expand All @@ -119,8 +136,8 @@ The API returns the following result:
"relocating_node_is_desired": false,
"shard_id": 1,
"index": "test",
"forecasted_write_load": null,
"forecasted_shard_size_in_bytes": null
"forecast_write_load": null,
"forecast_shard_size_in_bytes": null
}
],
"desired": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,27 @@ setup:
_internal.get_desired_balance: { }

- is_true: 'cluster_balance_stats'
- is_true: 'cluster_balance_stats.data_content.total_shard_size'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.total'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.min'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.max'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.average'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.std_dev'
- is_true: 'cluster_balance_stats.data_content.total_write_load'
- is_true: 'cluster_balance_stats.data_content.total_write_load.total'
- is_true: 'cluster_balance_stats.data_content.total_write_load.min'
- is_true: 'cluster_balance_stats.data_content.total_write_load.max'
- is_true: 'cluster_balance_stats.data_content.total_write_load.average'
- is_true: 'cluster_balance_stats.data_content.total_write_load.std_dev'
- is_true: 'cluster_balance_stats.data_content.shard_count'
- is_true: 'cluster_balance_stats.data_content.shard_count.total'
- is_true: 'cluster_balance_stats.data_content.shard_count.min'
- is_true: 'cluster_balance_stats.data_content.shard_count.max'
- is_true: 'cluster_balance_stats.data_content.shard_count.average'
- is_true: 'cluster_balance_stats.data_content.shard_count.std_dev'
- is_true: 'cluster_balance_stats.tiers'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.total'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.min'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.max'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.average'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.std_dev'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.total'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.min'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.max'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.average'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.std_dev'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.total'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.min'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.max'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.average'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.std_dev'
- is_true: 'cluster_balance_stats.nodes'
- is_true: 'cluster_balance_stats.nodes.test-cluster-0'
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.shard_count' : 0 }
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.forecast_write_load': 0.0 }
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.forecast_disk_usage_bytes' : 0 }
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,30 @@ setup:
_internal.get_desired_balance: { }

- is_true: 'cluster_balance_stats'
- is_true: 'cluster_balance_stats.data_content.total_shard_size'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.total'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.min'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.max'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.average'
- is_true: 'cluster_balance_stats.data_content.total_shard_size.std_dev'
- is_true: 'cluster_balance_stats.data_content.total_write_load'
- is_true: 'cluster_balance_stats.data_content.total_write_load.total'
- is_true: 'cluster_balance_stats.data_content.total_write_load.min'
- is_true: 'cluster_balance_stats.data_content.total_write_load.max'
- is_true: 'cluster_balance_stats.data_content.total_write_load.average'
- is_true: 'cluster_balance_stats.data_content.total_write_load.std_dev'
- is_true: 'cluster_balance_stats.data_content.shard_count'
- is_true: 'cluster_balance_stats.data_content.shard_count.total'
- is_true: 'cluster_balance_stats.data_content.shard_count.min'
- is_true: 'cluster_balance_stats.data_content.shard_count.max'
- is_true: 'cluster_balance_stats.data_content.shard_count.average'
- is_true: 'cluster_balance_stats.data_content.shard_count.std_dev'
- is_true: 'cluster_balance_stats.tiers'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.total'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.min'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.max'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.average'
- is_true: 'cluster_balance_stats.tiers.data_content.shard_count.std_dev'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.total'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.min'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.max'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.average'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_write_load.std_dev'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.total'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.min'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.max'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.average'
- is_true: 'cluster_balance_stats.tiers.data_content.forecast_disk_usage.std_dev'
- is_true: 'cluster_balance_stats.nodes'
- is_true: 'cluster_balance_stats.nodes.test-cluster-0'
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.shard_count' : 0 }
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.forecast_write_load': 0.0 }
- gte: { 'cluster_balance_stats.nodes.test-cluster-0.forecast_disk_usage_bytes' : 0 }

---
"Test get desired balance for single shard":
Expand Down Expand Up @@ -81,8 +87,8 @@ setup:
- is_true: 'routing_table.test.0.current.0.node_is_desired'
- is_false: 'routing_table.test.0.current.0.relocating_node'
- is_false: 'routing_table.test.0.current.0.relocating_node_is_desired'
- is_false: 'routing_table.test.0.current.0.forecasted_write_load'
- is_false: 'routing_table.test.0.current.0.forecasted_shard_size_in_bytes'
- is_false: 'routing_table.test.0.current.0.forecast_write_load'
- is_false: 'routing_table.test.0.current.0.forecast_shard_size_in_bytes'
- match: { routing_table.test.0.desired.total: 1 }
- gte: { routing_table.test.0.desired.unassigned: 0 }
- gte: { routing_table.test.0.desired.ignored: 0 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ public record ShardView(
boolean relocatingNodeIsDesired,
int shardId,
String index,
@Nullable Double forecastedWriteLoad,
@Nullable Long forecastedShardSizeInBytes
@Nullable Double forecastWriteLoad,
@Nullable Long forecastShardSizeInBytes
) implements Writeable, ToXContentObject {

private static final TransportVersion ADD_FORECASTS_VERSION = TransportVersion.V_8_7_0;
Expand Down Expand Up @@ -223,8 +223,8 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(shardId);
out.writeString(index);
if (out.getTransportVersion().onOrAfter(ADD_FORECASTS_VERSION)) {
out.writeOptionalDouble(forecastedWriteLoad);
out.writeOptionalLong(forecastedShardSizeInBytes);
out.writeOptionalDouble(forecastWriteLoad);
out.writeOptionalLong(forecastShardSizeInBytes);
} else {
out.writeMissingWriteable(AllocationId.class);
}
Expand All @@ -241,8 +241,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
.field("relocating_node_is_desired", relocatingNodeIsDesired)
.field("shard_id", shardId)
.field("index", index)
.field("forecasted_write_load", forecastedWriteLoad)
.field("forecasted_shard_size_in_bytes", forecastedShardSizeInBytes)
.field("forecast_write_load", forecastWriteLoad)
.field("forecast_shard_size_in_bytes", forecastShardSizeInBytes)
.endObject();
}
}
Expand Down

0 comments on commit 513dc2f

Please sign in to comment.