-
Notifications
You must be signed in to change notification settings - Fork 700
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
Add KeepAliveParameters to agent client #4157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -43,6 +43,11 @@ var ( | |||||
Endpoint: "dns:///flyteagent.flyte.svc.cluster.local:80", | ||||||
Insecure: true, | ||||||
DefaultTimeout: config.Duration{Duration: 10 * time.Second}, | ||||||
KeepAliveParameters: &KeepAliveParameters{ | ||||||
Time: config.Duration{Duration: 10 * time.Second}, | ||||||
Timeout: config.Duration{Duration: 5 * time.Second}, | ||||||
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.
Suggested change
|
||||||
PermitWithoutStream: true, | ||||||
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. What is the reason we set this to 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.
Suggested change
|
||||||
}, | ||||||
}, | ||||||
} | ||||||
|
||||||
|
@@ -67,6 +72,22 @@ type Config struct { | |||||
AgentForTaskTypes map[string]string `json:"agentForTaskTypes" pflag:"-,"` | ||||||
} | ||||||
|
||||||
// KeepAliveParameters defines keepalive parameters on the client-side. For more details, check https://pkg.go.dev/google.golang.org/grpc/keepalive#ClientParameters | ||||||
type KeepAliveParameters struct { | ||||||
// After a duration of this time if the client doesn't see any activity it | ||||||
// pings the server to see if the transport is still alive. | ||||||
// If set below 10s, a minimum value of 10s will be used instead. | ||||||
Time config.Duration `json:"time"` | ||||||
// After having pinged for keepalive check, the client waits for a duration | ||||||
// of Timeout and if no activity is seen even after that the connection is | ||||||
// closed. | ||||||
Timeout config.Duration `json:"timeout"` | ||||||
// If true, client sends keepalive pings even with no active RPCs. If false, | ||||||
// when there are no active RPCs, Time and Timeout will be ignored and no | ||||||
// keepalive pings will be sent. | ||||||
PermitWithoutStream bool `json:"permitWithoutStream"` | ||||||
} | ||||||
|
||||||
type Agent struct { | ||||||
// Endpoint points to an agent gRPC endpoint | ||||||
Endpoint string `json:"endpoint"` | ||||||
|
@@ -82,6 +103,9 @@ type Agent struct { | |||||
|
||||||
// DefaultTimeout gives the default RPC timeout if a more specific one is not defined in Timeouts; if neither DefaultTimeout nor Timeouts is defined for an operation, RPC timeout will not be enforced | ||||||
DefaultTimeout config.Duration `json:"defaultTimeout"` | ||||||
|
||||||
// KeepAliveParameters defines keepalive parameters for the gRPC client | ||||||
KeepAliveParameters *KeepAliveParameters `json:"keepAliveParameters"` | ||||||
} | ||||||
|
||||||
func GetConfig() *Config { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think we keep existing defaults defined by https://pkg.go.dev/google.golang.org/grpc/keepalive#ClientParameters unchanged, and only give a value for
Time
? Also 10s seems a bit aggressive. In a large setup, the overhead of DNS resolution is not negligible, plus 10s might be even smaller than DNS cache timeout so in many cases the refresh won't give any new IPs. In our backend production setup, we default this to 5 minutes, just for reference.