Skip to content

Commit

Permalink
Set default threshold value to 10 ms
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Alfonsi <[email protected]>
  • Loading branch information
Peter Alfonsi committed Mar 11, 2024
1 parent 8606d9b commit 7ead34e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.opensearch.common.settings.Setting;
import org.opensearch.common.unit.TimeValue;

import java.util.concurrent.TimeUnit;

import static org.opensearch.common.settings.Setting.Property.Dynamic;
import static org.opensearch.common.settings.Setting.Property.NodeScope;

Expand Down Expand Up @@ -43,8 +45,10 @@ public class TieredSpilloverCacheSettings {
*/
public static final Setting.AffixSetting<TimeValue> TIERED_SPILLOVER_DISK_TOOKTIME_THRESHOLD = Setting.suffixKeySetting(
TieredSpilloverCache.TieredSpilloverCacheFactory.TIERED_SPILLOVER_CACHE_NAME + ".disk.took_time.threshold",
(key) -> Setting.timeSetting(key, TimeValue.ZERO, NodeScope, Dynamic)
(key) -> Setting.timeSetting(key, new TimeValue(10, TimeUnit.MILLISECONDS), NodeScope, Dynamic)
);
// 10 ms was chosen as a safe value based on proof of concept, where we saw disk latencies in this range.
// Will be tuned further with future benchmarks.

/**
* Default constructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ public void testComputeIfAbsentWithFactoryBasedCacheCreation() throws Exception
.setPolicyInfoWrapperFunction(new Function<String, CachePolicyInfoWrapper>() {
@Override
public CachePolicyInfoWrapper apply(String s) {
return new CachePolicyInfoWrapper(10_000L);
return new CachePolicyInfoWrapper(20_000_000L);
}
}) // Values will always appear to have taken 10_000 ns = 10 ms to compute
}) // Values will always appear to have taken 20_000_000 ns = 20 ms to compute
.build(),
CacheType.INDICES_REQUEST_CACHE,
Map.of(
Expand Down

0 comments on commit 7ead34e

Please sign in to comment.