Skip to content
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

Watch random scheduler #15431

Merged
merged 2 commits into from
Mar 10, 2023
Merged

Conversation

serathius
Copy link
Member

Address step 1 from #15402 (comment)
cc @ahrtr @ptabor

@serathius serathius force-pushed the watch-random-scheduler branch 2 times, most recently from 89fb3c2 to c28a160 Compare March 8, 2023 14:52
@serathius serathius force-pushed the watch-random-scheduler branch 7 times, most recently from ad22de0 to 781de33 Compare March 9, 2023 09:35
@@ -224,6 +224,7 @@ func configureHttpServer(srv *http.Server, cfg config.ServerConfig) error {
// todo (ahrtr): should we support configuring other parameters in the future as well?
return http2.ConfigureServer(srv, &http2.Server{
MaxConcurrentStreams: cfg.MaxConcurrentStreams,
NewWriteScheduler: http2.NewRandomWriteScheduler,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a flag here? By default, it still uses priority writer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't understand. http2.NewRandomWriteScheduler is different than http2.NewPriorityWriteScheduler

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for unclear comment.

For the MaxConcurrentStreams, the user can use --max-concurrent-streams to config etcd http2 server.
So I was thinking if the pr can support to use config to choose scheduler writer, as it is behavior change.

If the response size is less than max frame size (by default 1MiB), the priority writer is not too bad in low traffic scenario.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random is always better than Priority as we didn't set any priorities. Without priorities it works like LIFO which is the worst algorithm for grpc you could imagine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIFO is completely not compatible with existence of watches (that are at the end of the handling queue).
I think it's better to avoid having too many flags that are difficult to understand.
This setting changed so many times in live-time of 3.4.x, that If any depended on the exact semantic, we would learn about it earlier.

}

func continuouslyExecuteGetAll(ctx context.Context, t *testing.T, g *errgroup.Group, c *clientv3.Client) {
mux := sync.RWMutex{}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we can use atomic package here.

Copy link
Member Author

@serathius serathius Mar 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is test, doesn't need to be super performant. Mutexes are simpler to get right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I was thinking that it is running in resource-limited vm. It might be useful to prevent flaky. Thanks for the reply.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being able to run tests on variety of hardware is important. I would not go further with performance requirements than running on free Github workers.

@serathius
Copy link
Member Author

@@ -224,6 +224,7 @@ func configureHttpServer(srv *http.Server, cfg config.ServerConfig) error {
// todo (ahrtr): should we support configuring other parameters in the future as well?
return http2.ConfigureServer(srv, &http2.Server{
MaxConcurrentStreams: cfg.MaxConcurrentStreams,
NewWriteScheduler: http2.NewRandomWriteScheduler,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIFO is completely not compatible with existence of watches (that are at the end of the handling queue).
I think it's better to avoid having too many flags that are difficult to understand.
This setting changed so many times in live-time of 3.4.x, that If any depended on the exact semantic, we would learn about it earlier.

@@ -224,6 +224,7 @@ func configureHttpServer(srv *http.Server, cfg config.ServerConfig) error {
// todo (ahrtr): should we support configuring other parameters in the future as well?
return http2.ConfigureServer(srv, &http2.Server{
MaxConcurrentStreams: cfg.MaxConcurrentStreams,
NewWriteScheduler: http2.NewRandomWriteScheduler,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comment above the flag, describing why it's critical for any reasonable performance out of etcd grpc APIs and pointing on the issue.

tests/e2e/watch_delay_test.go Show resolved Hide resolved
tests/e2e/watch_delay_test.go Show resolved Hide resolved
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@serathius serathius force-pushed the watch-random-scheduler branch from 781de33 to 62fe431 Compare March 10, 2023 10:39
… when sharing the same connection

Signed-off-by: Marek Siarkowicz <[email protected]>
@serathius serathius force-pushed the watch-random-scheduler branch from 62fe431 to f3533f2 Compare March 10, 2023 11:42
@serathius serathius merged commit 659c74e into etcd-io:main Mar 10, 2023
@ahrtr ahrtr mentioned this pull request Mar 13, 2023
@serathius serathius deleted the watch-random-scheduler branch June 15, 2023 20:38
@ahrtr ahrtr mentioned this pull request Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants