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

Fix server-side keepalive shutdown process #10494

Merged
merged 2 commits into from
Apr 14, 2017

Conversation

y-zeng
Copy link
Contributor

@y-zeng y-zeng commented Apr 6, 2017

#9468 added client-side keepalive timers, #9902 extended them to servers. But these timers were not canceled explicitly on servers when channels were closed by close_transport_locked. They were canceled in the cancellation path of the bandwidth estimator.
This PR cancels keepalive timers explicitly on servers, so that the cancellation of keepalive timers won't rely on the cancellation of the bandwidth estimator.

@grpc-kokoro
Copy link

No significant performance differences

@y-zeng y-zeng requested a review from sreecha April 6, 2017 21:55
@@ -543,6 +543,10 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
exec_ctx, &t->keepalive_ping_timer,
gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), t->keepalive_time),
&t->init_keepalive_ping_locked, gpr_now(GPR_CLOCK_MONOTONIC));
} else {
/* Use GRPC_CHTTP2_KEEPALIVE_STATE_DYING to indicate there are no inflight
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth adding a new state here - since this seems to be in initializing code path.. perhaps something like GRPC_CHTTP2_KEEPALIVE_STATE_NONE or GRPC_CHTTP2_KEEPALIVE_STATE_IDLE or something like that ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for the review. Added GRPC_CHTTP2_KEEPALIVE_STATE_DISABLED to indicate the keepalive timers are not set.

Copy link
Contributor

@sreecha sreecha left a comment

Choose a reason for hiding this comment

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

It might help if you add some description to this PR as to what was the issue..
I see that the main change here is to cancel the timers even on server (we previously only seem to be doing this on clients). I am not very clear about the design (i.e why was it only on clients previously?..and what changed recently that makes it okay to execute that code on both server and client) etc..

@y-zeng y-zeng force-pushed the fix_server_keepalive branch from ea1b39f to aaa779e Compare April 13, 2017 02:01
@y-zeng
Copy link
Contributor Author

y-zeng commented Apr 13, 2017

Added more context in the description. It should be canceled on both the client and server. #9902 forgot to cancel it on server, but luckily the cancellation path of bandwidth estimator helped to cancel it, so it did not cause any trouble (also not caught by our tests 😵 ) .

@sreecha
Copy link
Contributor

sreecha commented Apr 13, 2017

Thanks Yuchen. LGTM

@grpc-kokoro
Copy link

Performance differences noted:
Benchmark                                                                         cpu_time    real_time
------------------------------------------------------------------------------  ----------  -----------
BM_ErrorCreateAndSetStatus                                                          +75.50       +75.50
BM_ErrorStringOnNewError<ErrorWithGrpcStatus>                                      +261.00      +261.00
BM_PollEmptyPollset_SpeedOfLight/1/0                                                 +7.50        +7.50
BM_PollEmptyPollset_SpeedOfLight/1/100                                               +7.50        +7.50
BM_PollEmptyPollset_SpeedOfLight/1/1000                                              +8.50        +8.50
BM_PollEmptyPollset_SpeedOfLight/1/9.76562k                                          +7.50        +7.50
BM_PollEmptyPollset_SpeedOfLight/1/97.6562k                                          +8.00        +8.00
BM_PollEmptyPollset_SpeedOfLight/10/1                                                +9.50        +9.50
BM_PollEmptyPollset_SpeedOfLight/1000/1                                              +7.50        +7.50
BM_StreamCreateSendInitialMetadataDestroy<RepresentativeClientInitialMetadata>     +342.50      +342.50
BM_TransportEmptyOp                                                                 +11.50       +11.50
BM_TransportStreamRecv/128M                                                     +297601.00   +297600.50
BM_TransportStreamRecv/16M                                                       +35076.00    +35075.50
BM_TransportStreamRecv/256k                                                        +583.00      +583.00
BM_TransportStreamRecv/2M                                                         +4288.00     +4288.50
BM_TransportStreamRecv/32k                                                         +165.00      +165.00
BM_TransportStreamRecv/4k                                                           +91.50       +91.50
BM_TransportStreamRecv/64                                                           +89.00       +89.50
BM_TransportStreamSend/0                                                            +47.50       +47.50
BM_TransportStreamSend/1                                                            +45.00       +45.00
BM_TransportStreamSend/128M                                                      +98201.00    +98203.00
BM_TransportStreamSend/16M                                                       +12727.50    +12727.50
BM_TransportStreamSend/256k                                                        +240.50      +240.50
BM_TransportStreamSend/2M                                                         +1440.00     +1439.00
BM_TransportStreamSend/32k                                                          +76.00       +76.00
BM_TransportStreamSend/4k                                                           +52.50       +52.50
BM_TransportStreamSend/512                                                          +46.00       +46.00
BM_TransportStreamSend/64                                                           +61.00       +61.00
BM_TransportStreamSend/8                                                            +59.00       +59.00

@grpc-kokoro
Copy link

No significant performance differences

@sreecha sreecha assigned y-zeng and unassigned sreecha Apr 13, 2017
@y-zeng
Copy link
Contributor Author

y-zeng commented Apr 14, 2017

Known issues:
Basic Tests Linux: #9147

@y-zeng y-zeng merged commit b9f9dcd into grpc:master Apr 14, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants