Skip to content

Commit

Permalink
added settings for IO Admission control
Browse files Browse the repository at this point in the history
Signed-off-by: Rajiv Kumar Vaidyanathan <[email protected]>
  • Loading branch information
rajiv-kv committed Mar 20, 2024
1 parent d542070 commit 52a5068
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Remote reindex: Add support for configurable retry mechanism ([#12561](https://github.com/opensearch-project/OpenSearch/pull/12561))
- [Admission Control] Integrate IO Usage Tracker to the Resource Usage Collector Service and Emit IO Usage Stats ([#11880](https://github.com/opensearch-project/OpenSearch/pull/11880))
- Tracing for deep search path ([#12103](https://github.com/opensearch-project/OpenSearch/pull/12103))
- Integrate with CPU admission controller for cluster-manager Read API's. ([#12496](https://github.com/opensearch-project/OpenSearch/pull/12496))

### Dependencies
- Bump `log4j-core` from 2.18.0 to 2.19.0
Expand Down Expand Up @@ -119,6 +118,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Tiered caching] Add Stale keys Management and CacheCleaner to IndicesRequestCache ([#12625](https://github.com/opensearch-project/OpenSearch/pull/12625))
- [Tiered caching] Add serializer integration to allow ehcache disk cache to use non-primitive values ([#12709](https://github.com/opensearch-project/OpenSearch/pull/12709))
- [Admission Control] Integrated IO Based AdmissionController to AdmissionControl Framework ([#12583](https://github.com/opensearch-project/OpenSearch/pull/12583))
- Integrate with admission controller for cluster-manager Read API. ([#12496](https://github.com/opensearch-project/OpenSearch/pull/12496))

### Dependencies
- Bump `peter-evans/find-comment` from 2 to 3 ([#12288](https://github.com/opensearch-project/OpenSearch/pull/12288))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,20 +706,18 @@ public void apply(Settings value, Settings current, Settings previous) {
IndicesService.CLUSTER_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING,
IndicesService.CLUSTER_REMOTE_INDEX_RESTRICT_ASYNC_DURABILITY_SETTING,
IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING,
IndicesService.CLUSTER_REMOTE_STORE_PATH_PREFIX_TYPE_SETTING,

// Admission Control Settings
AdmissionControlSettings.ADMISSION_CONTROL_TRANSPORT_LAYER_MODE,
CpuBasedAdmissionControllerSettings.CPU_BASED_ADMISSION_CONTROLLER_TRANSPORT_LAYER_MODE,
CpuBasedAdmissionControllerSettings.INDEXING_CPU_USAGE_LIMIT,
CpuBasedAdmissionControllerSettings.SEARCH_CPU_USAGE_LIMIT,
CpuBasedAdmissionControllerSettings.CLUSTER_ADMIN_CPU_USAGE_LIMIT,

IoBasedAdmissionControllerSettings.IO_BASED_ADMISSION_CONTROLLER_TRANSPORT_LAYER_MODE,
IoBasedAdmissionControllerSettings.SEARCH_IO_USAGE_LIMIT,
IoBasedAdmissionControllerSettings.INDEXING_IO_USAGE_LIMIT,
IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING,
IndicesService.CLUSTER_REMOTE_STORE_PATH_PREFIX_TYPE_SETTING,
IndicesService.CLUSTER_INDEX_RESTRICT_REPLICATION_TYPE_SETTING,
IoBasedAdmissionControllerSettings.CLUSTER_ADMIN_IO_USAGE_LIMIT,

// Concurrent segment search settings
SearchService.CLUSTER_CONCURRENT_SEGMENT_SEARCH_SETTING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ private long getIoRejectionThreshold(AdmissionControlActionType admissionControl
return this.settings.getSearchIOUsageLimit();
case INDEXING:
return this.settings.getIndexingIOUsageLimit();
case CLUSTER_ADMIN:
return this.settings.getClusterAdminIOUsageLimit();
default:
throw new IllegalArgumentException(
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static class Defaults {
private AdmissionControlMode transportLayerMode;
private Long searchIOUsageLimit;
private Long indexingIOUsageLimit;
private Long clusterAdminIOUsageLimit;

/**
* Feature level setting to operate in shadow-mode or in enforced-mode. If enforced field is set
Expand Down Expand Up @@ -63,13 +64,25 @@ public static class Defaults {
Setting.Property.NodeScope
);

/**
* This setting used to set the IO limits for the indexing requests by default it will use default IO usage limit
*/
public static final Setting<Long> CLUSTER_ADMIN_IO_USAGE_LIMIT = Setting.longSetting(
"admission_control.cluster_admin.io_usage.limit",
Defaults.IO_USAGE_LIMIT,
Setting.Property.Dynamic,
Setting.Property.NodeScope
);

public IoBasedAdmissionControllerSettings(ClusterSettings clusterSettings, Settings settings) {
this.transportLayerMode = IO_BASED_ADMISSION_CONTROLLER_TRANSPORT_LAYER_MODE.get(settings);
clusterSettings.addSettingsUpdateConsumer(IO_BASED_ADMISSION_CONTROLLER_TRANSPORT_LAYER_MODE, this::setTransportLayerMode);
this.searchIOUsageLimit = SEARCH_IO_USAGE_LIMIT.get(settings);
this.indexingIOUsageLimit = INDEXING_IO_USAGE_LIMIT.get(settings);
this.clusterAdminIOUsageLimit = CLUSTER_ADMIN_IO_USAGE_LIMIT.get(settings);
clusterSettings.addSettingsUpdateConsumer(INDEXING_IO_USAGE_LIMIT, this::setIndexingIOUsageLimit);
clusterSettings.addSettingsUpdateConsumer(SEARCH_IO_USAGE_LIMIT, this::setSearchIOUsageLimit);
clusterSettings.addSettingsUpdateConsumer(CLUSTER_ADMIN_IO_USAGE_LIMIT, this::setClusterAdminIOUsageLimit);
}

public void setIndexingIOUsageLimit(Long indexingIOUsageLimit) {
Expand All @@ -80,6 +93,10 @@ public void setSearchIOUsageLimit(Long searchIOUsageLimit) {
this.searchIOUsageLimit = searchIOUsageLimit;
}

public void setClusterAdminIOUsageLimit(Long clusterAdminIOUsageLimit) {
this.clusterAdminIOUsageLimit = clusterAdminIOUsageLimit;
}

public AdmissionControlMode getTransportLayerAdmissionControllerMode() {
return transportLayerMode;
}
Expand All @@ -95,4 +112,8 @@ public Long getIndexingIOUsageLimit() {
public Long getSearchIOUsageLimit() {
return searchIOUsageLimit;
}

public Long getClusterAdminIOUsageLimit() {
return clusterAdminIOUsageLimit;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public void testDefaultSettings() {
assertEquals(ioBasedAdmissionControllerSettings.getTransportLayerAdmissionControllerMode(), AdmissionControlMode.DISABLED);
assertEquals(ioBasedAdmissionControllerSettings.getIndexingIOUsageLimit().longValue(), percent);
assertEquals(ioBasedAdmissionControllerSettings.getSearchIOUsageLimit().longValue(), percent);
assertEquals(ioBasedAdmissionControllerSettings.getClusterAdminIOUsageLimit().longValue(), percent);

}

public void testGetConfiguredSettings() {
Expand Down Expand Up @@ -134,6 +136,10 @@ public void testUpdateAfterGetConfiguredSettings() {
assertEquals(ioBasedAdmissionControllerSettings.getTransportLayerAdmissionControllerMode(), AdmissionControlMode.ENFORCED);
assertEquals(ioBasedAdmissionControllerSettings.getSearchIOUsageLimit().longValue(), searchPercent);
assertEquals(ioBasedAdmissionControllerSettings.getIndexingIOUsageLimit().longValue(), percent);
assertEquals(
ioBasedAdmissionControllerSettings.getClusterAdminIOUsageLimit().longValue(),
IoBasedAdmissionControllerSettings.Defaults.IO_USAGE_LIMIT
);

Settings updatedSettings = Settings.builder()
.put(
Expand All @@ -146,6 +152,10 @@ public void testUpdateAfterGetConfiguredSettings() {
assertEquals(ioBasedAdmissionControllerSettings.getTransportLayerAdmissionControllerMode(), AdmissionControlMode.MONITOR);
assertEquals(ioBasedAdmissionControllerSettings.getSearchIOUsageLimit().longValue(), searchPercent);
assertEquals(ioBasedAdmissionControllerSettings.getIndexingIOUsageLimit().longValue(), indexingPercent);
assertEquals(
ioBasedAdmissionControllerSettings.getClusterAdminIOUsageLimit().longValue(),
IoBasedAdmissionControllerSettings.Defaults.IO_USAGE_LIMIT
);

searchPercent = 70;
updatedSettings = Settings.builder()
Expand All @@ -156,5 +166,20 @@ public void testUpdateAfterGetConfiguredSettings() {
clusterService.getClusterSettings().applySettings(updatedSettings);
assertEquals(ioBasedAdmissionControllerSettings.getSearchIOUsageLimit().longValue(), searchPercent);
assertEquals(ioBasedAdmissionControllerSettings.getIndexingIOUsageLimit().longValue(), indexingPercent);
assertEquals(
ioBasedAdmissionControllerSettings.getClusterAdminIOUsageLimit().longValue(),
IoBasedAdmissionControllerSettings.Defaults.IO_USAGE_LIMIT
);

long adminPercent = 98;
updatedSettings = Settings.builder()
.put(updatedSettings)
.put(IoBasedAdmissionControllerSettings.CLUSTER_ADMIN_IO_USAGE_LIMIT.getKey(), adminPercent)
.build();
clusterService.getClusterSettings().applySettings(updatedSettings);
assertEquals(ioBasedAdmissionControllerSettings.getSearchIOUsageLimit().longValue(), searchPercent);
assertEquals(ioBasedAdmissionControllerSettings.getIndexingIOUsageLimit().longValue(), indexingPercent);
assertEquals(ioBasedAdmissionControllerSettings.getClusterAdminIOUsageLimit().longValue(), adminPercent);

}
}

0 comments on commit 52a5068

Please sign in to comment.