-
Notifications
You must be signed in to change notification settings - Fork 115
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
GRPC Streaming Batching #1633
GRPC Streaming Batching #1633
Changes from 7 commits
e413e5c
7974fe1
edb122c
3aeb36b
e23f3cb
536dffe
7d40694
434e4d3
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 |
---|---|---|
|
@@ -21,8 +21,11 @@ type Flags struct { | |
GrpcEnable bool | ||
|
||
// Grpc Streaming | ||
GrpcStreamingEnabled bool | ||
VEOracleEnabled bool // Slinky Vote Extensions | ||
GrpcStreamingEnabled bool | ||
GrpcStreamingFlushIntervalMs uint32 | ||
GrpcStreamingMaxBufferSize uint32 | ||
|
||
VEOracleEnabled bool // Slinky Vote Extensions | ||
} | ||
|
||
// List of CLI flags. | ||
|
@@ -37,7 +40,9 @@ const ( | |
GrpcEnable = "grpc.enable" | ||
|
||
// Grpc Streaming | ||
GrpcStreamingEnabled = "grpc-streaming-enabled" | ||
GrpcStreamingEnabled = "grpc-streaming-enabled" | ||
GrpcStreamingFlushIntervalMs = "grpc-streaming-flush-interval-ms" | ||
GrpcStreamingMaxBufferSize = "grpc-streaming-max-buffer-size" | ||
|
||
// Slinky VEs enabled | ||
VEOracleEnabled = "slinky-vote-extension-oracle-enabled" | ||
|
@@ -50,8 +55,11 @@ const ( | |
DefaultNonValidatingFullNode = false | ||
DefaultDdErrorTrackingFormat = false | ||
|
||
DefaultGrpcStreamingEnabled = false | ||
DefaultVEOracleEnabled = true | ||
DefaultGrpcStreamingEnabled = false | ||
DefaultGrpcStreamingFlushIntervalMs = 50 | ||
DefaultGrpcStreamingMaxBufferSize = 10000 | ||
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. is 10k reasonable here? should we go higher in case of spikes in traffic? 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. i guess if we are doing 10ms, 10k should be enough 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. i'll use these for now and then tune later based on metrics |
||
|
||
DefaultVEOracleEnabled = true | ||
) | ||
|
||
// AddFlagsToCmd adds flags to app initialization. | ||
|
@@ -85,6 +93,16 @@ func AddFlagsToCmd(cmd *cobra.Command) { | |
DefaultGrpcStreamingEnabled, | ||
"Whether to enable grpc streaming for full nodes", | ||
) | ||
cmd.Flags().Uint32( | ||
GrpcStreamingFlushIntervalMs, | ||
DefaultGrpcStreamingFlushIntervalMs, | ||
"Flush interval (in ms) for grpc streaming", | ||
) | ||
cmd.Flags().Uint32( | ||
GrpcStreamingMaxBufferSize, | ||
DefaultGrpcStreamingMaxBufferSize, | ||
"Maximum buffer size before grpc streaming cancels all connections", | ||
) | ||
cmd.Flags().Bool( | ||
VEOracleEnabled, | ||
DefaultVEOracleEnabled, | ||
|
@@ -104,6 +122,12 @@ func (f *Flags) Validate() error { | |
if !f.GrpcEnable { | ||
return fmt.Errorf("grpc.enable must be set to true - grpc streaming requires gRPC server") | ||
} | ||
if f.GrpcStreamingMaxBufferSize == 0 { | ||
return fmt.Errorf("grpc streaming buffer size must be positive number") | ||
} | ||
if f.GrpcStreamingFlushIntervalMs == 0 { | ||
return fmt.Errorf("grpc streaming flush interval must be positive number") | ||
} | ||
} | ||
return nil | ||
} | ||
|
@@ -124,8 +148,11 @@ func GetFlagValuesFromOptions( | |
GrpcAddress: config.DefaultGRPCAddress, | ||
GrpcEnable: true, | ||
|
||
GrpcStreamingEnabled: DefaultGrpcStreamingEnabled, | ||
VEOracleEnabled: true, | ||
GrpcStreamingEnabled: DefaultGrpcStreamingEnabled, | ||
GrpcStreamingFlushIntervalMs: DefaultGrpcStreamingFlushIntervalMs, | ||
GrpcStreamingMaxBufferSize: DefaultGrpcStreamingMaxBufferSize, | ||
|
||
VEOracleEnabled: true, | ||
} | ||
|
||
// Populate the flags if they exist. | ||
|
@@ -171,6 +198,18 @@ func GetFlagValuesFromOptions( | |
} | ||
} | ||
|
||
if option := appOpts.Get(GrpcStreamingFlushIntervalMs); option != nil { | ||
if v, err := cast.ToUint32E(option); err == nil { | ||
result.GrpcStreamingFlushIntervalMs = v | ||
} | ||
} | ||
|
||
if option := appOpts.Get(GrpcStreamingMaxBufferSize); option != nil { | ||
if v, err := cast.ToUint32E(option); err == nil { | ||
result.GrpcStreamingMaxBufferSize = v | ||
} | ||
} | ||
|
||
if option := appOpts.Get(VEOracleEnabled); option != nil { | ||
if v, err := cast.ToBoolE(option); err == nil { | ||
result.VEOracleEnabled = v | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Consider adding error handling for GRPC streaming manager initialization.
Committable suggestion