-
Notifications
You must be signed in to change notification settings - Fork 186
Optimize connector client configuration #4508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ce38354
e54226f
79bc8e1
1712802
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ plugin/build/ | |
| .DS_Store | ||
| */bin/ | ||
| **/*.factorypath | ||
| **/out | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,17 +35,17 @@ public class ConnectorClientConfig implements ToXContentObject, Writeable { | |
| public static final String MAX_RETRY_TIMES_FIELD = "max_retry_times"; | ||
| public static final String RETRY_BACKOFF_POLICY_FIELD = "retry_backoff_policy"; | ||
|
|
||
| public static final Integer MAX_CONNECTION_DEFAULT_VALUE = Integer.valueOf(30); | ||
| public static final Integer CONNECTION_TIMEOUT_DEFAULT_VALUE = Integer.valueOf(30000); | ||
| public static final Integer READ_TIMEOUT_DEFAULT_VALUE = Integer.valueOf(30000); | ||
| public static final Integer RETRY_BACKOFF_MILLIS_DEFAULT_VALUE = 200; | ||
| public static final Integer RETRY_TIMEOUT_SECONDS_DEFAULT_VALUE = 30; | ||
| public static final Integer MAX_RETRY_TIMES_DEFAULT_VALUE = 0; | ||
| public static final int MAX_CONNECTION_DEFAULT_VALUE = 30; | ||
| public static final int CONNECTION_TIMEOUT_DEFAULT_VALUE = 1000; | ||
| public static final int READ_TIMEOUT_DEFAULT_VALUE = 10; | ||
| public static final int RETRY_BACKOFF_MILLIS_DEFAULT_VALUE = 200; | ||
| public static final int RETRY_TIMEOUT_SECONDS_DEFAULT_VALUE = 30; | ||
| public static final int MAX_RETRY_TIMES_DEFAULT_VALUE = 0; | ||
| public static final RetryBackoffPolicy RETRY_BACKOFF_POLICY_DEFAULT_VALUE = RetryBackoffPolicy.CONSTANT; | ||
| public static final Version MINIMAL_SUPPORTED_VERSION_FOR_RETRY = Version.V_2_15_0; | ||
| private Integer maxConnections; | ||
| private Integer connectionTimeout; | ||
| private Integer readTimeout; | ||
| private Integer connectionTimeoutMillis; | ||
| private Integer readTimeoutSeconds; | ||
| private Integer retryBackoffMillis; | ||
|
Comment on lines
+47
to
49
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we use milliseconds for both?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, sounds very confusing to use different way to configure these timeouts
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In documentation, we specified that connection timeout is in millisecond and read timeout in second: https://docs.opensearch.org/latest/ml-commons-plugin/remote-models/blueprints/#configuration-parameters, changing this could break existing customer configurations.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. opensearch-project/documentation-website#9460 based on this issue, the documentation was changed. Let's make the values consistent. I don't have preference about seconds vs miliseconds. But keep this consistent please. Thanks.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I can change this to milliseconds but this could be a breaking change for existing customer connector configurations, e.g. user configuring to 3s now become 3 milliseconds which basically means all remote model calls fails, @ylwu-amzn , please also confirm on this. |
||
| private Integer retryTimeoutSeconds; | ||
| private Integer maxRetryTimes; | ||
|
|
@@ -54,16 +54,16 @@ public class ConnectorClientConfig implements ToXContentObject, Writeable { | |
| @Builder(toBuilder = true) | ||
| public ConnectorClientConfig( | ||
| Integer maxConnections, | ||
| Integer connectionTimeout, | ||
| Integer readTimeout, | ||
| Integer connectionTimeoutMillis, | ||
| Integer readTimeoutSeconds, | ||
| Integer retryBackoffMillis, | ||
| Integer retryTimeoutSeconds, | ||
| Integer maxRetryTimes, | ||
| RetryBackoffPolicy retryBackoffPolicy | ||
| ) { | ||
| this.maxConnections = maxConnections; | ||
| this.connectionTimeout = connectionTimeout; | ||
| this.readTimeout = readTimeout; | ||
| this.connectionTimeoutMillis = connectionTimeoutMillis; | ||
| this.readTimeoutSeconds = readTimeoutSeconds; | ||
| this.retryBackoffMillis = retryBackoffMillis; | ||
| this.retryTimeoutSeconds = retryTimeoutSeconds; | ||
| this.maxRetryTimes = maxRetryTimes; | ||
|
|
@@ -73,8 +73,8 @@ public ConnectorClientConfig( | |
| public ConnectorClientConfig(StreamInput input) throws IOException { | ||
| Version streamInputVersion = input.getVersion(); | ||
| this.maxConnections = input.readOptionalInt(); | ||
| this.connectionTimeout = input.readOptionalInt(); | ||
| this.readTimeout = input.readOptionalInt(); | ||
| this.connectionTimeoutMillis = input.readOptionalInt(); | ||
| this.readTimeoutSeconds = input.readOptionalInt(); | ||
| if (streamInputVersion.onOrAfter(MINIMAL_SUPPORTED_VERSION_FOR_RETRY)) { | ||
| this.retryBackoffMillis = input.readOptionalInt(); | ||
| this.retryTimeoutSeconds = input.readOptionalInt(); | ||
|
|
@@ -87,8 +87,8 @@ public ConnectorClientConfig(StreamInput input) throws IOException { | |
|
|
||
| public ConnectorClientConfig() { | ||
| this.maxConnections = MAX_CONNECTION_DEFAULT_VALUE; | ||
| this.connectionTimeout = CONNECTION_TIMEOUT_DEFAULT_VALUE; | ||
| this.readTimeout = READ_TIMEOUT_DEFAULT_VALUE; | ||
| this.connectionTimeoutMillis = CONNECTION_TIMEOUT_DEFAULT_VALUE; | ||
| this.readTimeoutSeconds = READ_TIMEOUT_DEFAULT_VALUE; | ||
| this.retryBackoffMillis = RETRY_BACKOFF_MILLIS_DEFAULT_VALUE; | ||
| this.retryTimeoutSeconds = RETRY_TIMEOUT_SECONDS_DEFAULT_VALUE; | ||
| this.maxRetryTimes = MAX_RETRY_TIMES_DEFAULT_VALUE; | ||
|
|
@@ -99,8 +99,8 @@ public ConnectorClientConfig() { | |
| public void writeTo(StreamOutput out) throws IOException { | ||
| Version streamOutputVersion = out.getVersion(); | ||
| out.writeOptionalInt(maxConnections); | ||
| out.writeOptionalInt(connectionTimeout); | ||
| out.writeOptionalInt(readTimeout); | ||
| out.writeOptionalInt(connectionTimeoutMillis); | ||
| out.writeOptionalInt(readTimeoutSeconds); | ||
| if (streamOutputVersion.onOrAfter(MINIMAL_SUPPORTED_VERSION_FOR_RETRY)) { | ||
| out.writeOptionalInt(retryBackoffMillis); | ||
| out.writeOptionalInt(retryTimeoutSeconds); | ||
|
|
@@ -120,11 +120,11 @@ public XContentBuilder toXContent(XContentBuilder xContentBuilder, Params params | |
| if (maxConnections != null) { | ||
| builder.field(MAX_CONNECTION_FIELD, maxConnections); | ||
| } | ||
| if (connectionTimeout != null) { | ||
| builder.field(CONNECTION_TIMEOUT_FIELD, connectionTimeout); | ||
| if (connectionTimeoutMillis != null) { | ||
| builder.field(CONNECTION_TIMEOUT_FIELD, connectionTimeoutMillis); | ||
| } | ||
| if (readTimeout != null) { | ||
| builder.field(READ_TIMEOUT_FIELD, readTimeout); | ||
| if (readTimeoutSeconds != null) { | ||
| builder.field(READ_TIMEOUT_FIELD, readTimeoutSeconds); | ||
| } | ||
| if (retryBackoffMillis != null) { | ||
| builder.field(RETRY_BACKOFF_MILLIS_FIELD, retryBackoffMillis); | ||
|
|
@@ -190,8 +190,8 @@ public static ConnectorClientConfig parse(XContentParser parser) throws IOExcept | |
| return ConnectorClientConfig | ||
| .builder() | ||
| .maxConnections(maxConnections) | ||
| .connectionTimeout(connectionTimeout) | ||
| .readTimeout(readTimeout) | ||
| .connectionTimeoutMillis(connectionTimeout) | ||
| .readTimeoutSeconds(readTimeout) | ||
| .retryBackoffMillis(retryBackoffMillis) | ||
| .retryTimeoutSeconds(retryTimeoutSeconds) | ||
| .maxRetryTimes(maxRetryTimes) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.