[go: up one dir, main page]

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

On server, include receiving HTTP/2 settings in handshake timeout #13336

Merged
merged 19 commits into from
Dec 4, 2017

Conversation

markdroth
Copy link
Member

I think this is right, but I'd like confirmation both that (a) it should do the right thing and (b) it's the right way to implement this.

Also, I'd welcome suggestions on how to test this. My first thought was to use the bad_client framework, but it looks like bad_client directly creates a chttp2 transport rather than using the handshaking code from chttp2_server.cc, which is where the handshake timeout is enforced. Would it make sense to modify it to use the handshaking code? Or should I just write an independent test that does something similar? Alternative suggestions welcome.

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                              ++++++++++++++
  +0.1%    +289 [None]                                                               +14.9Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                   +528   +25%
      [NEW]    +176 on_timeout                                                              +176  [NEW]
       +34%    +129 on_handshake_done                                                       +129   +34%
       +31%     +80 on_accept                                                                +80   +31%
      [NEW]     +71 server_connection_state_unref                                            +71  [NEW]
      [NEW]     +51 on_receive_settings                                                      +51  [NEW]
       +54%     +21 [Unmapped]                                                               +21   +54%
  +0.2%     +51 src/core/ext/transport/chttp2/transport/chttp2_transport.cc              +51  +0.2%
       +27%     +19 grpc_chttp2_transport_start_reading                                      +19   +27%
      +0.5%     +16 grpc_create_chttp2_transport                                             +16  +0.5%
      +4.3%     +10 perform_transport_op_locked                                              +10  +4.3%
      +0.9%      +6 [Unmapped]                                                                +6  +0.9%
  +2.3%     +50 src/core/ext/transport/chttp2/transport/frame_settings.cc                +50  +2.3%
      +4.1%     +50 grpc_chttp2_settings_parser_parse                                        +50  +4.1%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc      +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                  +2  +0.5%

  +0.1%    +920 TOTAL                                                                +15.5Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] Performance differences noted:
Benchmark                                                                     cpu_time    real_time
----------------------------------------------------------------------------  ----------  -----------
BM_PumpStreamClientToServer<InProcess>/32768                                  -8%         -8%
BM_PumpStreamServerToClient<InProcess>/32768                                  -5%         -5%
BM_StreamingPingPongMsgs<InProcess, NoOpMutator, NoOpMutator>/262144          +4%         +4%
BM_StreamingPingPongMsgs<InProcess, NoOpMutator, NoOpMutator>/32768           +6%         +6%
BM_StreamingPingPongMsgs<MinInProcessCHTTP2, NoOpMutator, NoOpMutator>/32768  +4%         +4%

@markdroth
Copy link
Member Author

Noah, can you please take a look at this, since Craig is out?

Unless you have a better suggestion, I'm thinking of changing the bad_client framework to use the handshaker code so that I can add a test for this functionality.

Thanks!

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                            FILE SIZE
 ++++++++++++++ GROWING                                                              ++++++++++++++
  +0.1%    +321 [None]                                                               +14.9Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                   +528   +25%
      [NEW]    +176 on_timeout                                                              +176  [NEW]
       +34%    +129 on_handshake_done                                                       +129   +34%
       +31%     +80 on_accept                                                                +80   +31%
      [NEW]     +71 server_connection_state_unref                                            +71  [NEW]
      [NEW]     +51 on_receive_settings                                                      +51  [NEW]
       +54%     +21 [Unmapped]                                                               +21   +54%
  +0.2%     +51 src/core/ext/transport/chttp2/transport/chttp2_transport.cc              +51  +0.2%
       +27%     +19 grpc_chttp2_transport_start_reading                                      +19   +27%
      +0.5%     +16 grpc_create_chttp2_transport                                             +16  +0.5%
      +4.3%     +10 perform_transport_op_locked                                              +10  +4.3%
      +0.9%      +6 [Unmapped]                                                                +6  +0.9%
  +2.3%     +50 src/core/ext/transport/chttp2/transport/frame_settings.cc                +50  +2.3%
      +4.1%     +50 grpc_chttp2_settings_parser_parse                                        +50  +4.1%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc      +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                  +2  +0.5%

  +0.1%    +952 TOTAL                                                                +15.5Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

@ncteisen
Copy link
Contributor

Let's talk tomorrow (or after break) about how best to test this. I think we are in need of a method or framework (maybe) to test chttp2 edge cases. I am running into that problem trying to test a fix for #13062. That PR will end up doing a similar thing to this, and I will build off this.

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +294 [None]                                                                +15.6Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +176 on_timeout                                                               +176  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +54%     +21 [Unmapped]                                                                +21   +54%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
       +15%     +37 perform_transport_op_locked                                               +37   +15%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +896 TOTAL                                                                 +16.2Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++

 -------------- SHRINK --------------
  [ = ]       0 [None]     -48  -0.0%

  [ = ]       0 TOTAL      -48  -0.0%



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

@markdroth
Copy link
Member Author

I've added a test here that I think verifies that the change works as required. PTAL. Thanks!

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +294 [None]                                                                +19.5Ki  +0.4%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +176 on_timeout                                                               +176  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +54%     +21 [Unmapped]                                                                +21   +54%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
       +15%     +37 perform_transport_op_locked                                               +37   +15%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +896 TOTAL                                                                 +20.1Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
Corrupt JSON data (indicates timeout or crash): 
    bm_fullstack_unary_ping_pong.BM_UnaryPingPong_InProcessCHTTP2_NoOpMutator_NoOpMutator__0_64.opt.old: 1


[microbenchmarks] Performance differences noted:
Benchmark                                            cpu_time    real_time
---------------------------------------------------  ----------  -----------
BM_PumpStreamClientToServer<InProcess>/32768         +4%         +4%
BM_PumpStreamClientToServer<InProcessCHTTP2>/262144  +4%         +4%

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +294 [None]                                                                +19.5Ki  +0.4%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +176 on_timeout                                                               +176  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +54%     +21 [Unmapped]                                                                +21   +54%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
       +15%     +37 perform_transport_op_locked                                               +37   +15%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +896 TOTAL                                                                 +20.1Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE        FILE SIZE
 ++++++++++++++  ++++++++++++++

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +294 [None]                                                                +19.5Ki  +0.4%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +162 on_timeout                                                               +162  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +90%     +35 [Unmapped]                                                                +35   +90%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
       +15%     +37 perform_transport_op_locked                                               +37   +15%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +896 TOTAL                                                                 +20.1Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]     +72  +0.0%

  [ = ]       0 TOTAL      +72  +0.0%



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] Performance differences noted:
Benchmark                                           cpu_time    real_time
--------------------------------------------------  ----------  -----------
BM_PumpStreamServerToClient<InProcessCHTTP2>/32768  -6%         -6%

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.0%    +294 [None]                                                                +15.6Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +162 on_timeout                                                               +162  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +90%     +35 [Unmapped]                                                                +35   +90%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
      [NEW] +3.43Ki grpc_create_chttp2_transport                                          +3.43Ki  [NEW]
      [NEW]    +100 grpc_chttp2_transport_start_reading                                      +100  [NEW]
       +15%     +37 perform_transport_op_locked                                               +37   +15%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +896 TOTAL                                                                 +16.2Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]     +72  +0.0%

  [ = ]       0 TOTAL      +72  +0.0%



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

close_transport_locked(exec_ctx, t, close_transport);
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
close_transport_locked(exec_ctx, t, op->disconnect_with_error);
if (t->notify_on_receive_settings != nullptr) {
Copy link
Member

Choose a reason for hiding this comment

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

why isn't this in close_transport_locked?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that does look like a better place for it. Done.

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +326 [None]                                                                +19.6Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +162 on_timeout                                                               +162  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +90%     +35 [Unmapped]                                                                +35   +90%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
      [NEW] +3.45Ki grpc_create_chttp2_transport                                          +3.45Ki  [NEW]
      [NEW]    +100 grpc_chttp2_transport_start_reading                                      +100  [NEW]
      +4.5%     +32 close_transport_locked                                                    +32  +4.5%
      +0.5%      +3 [Unmapped]                                                                 +3  +0.5%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +928 TOTAL                                                                 +20.2Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]     +72  +0.0%

  [ = ]       0 TOTAL      +72  +0.0%



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
****************************************************************

libgrpc.so

     VM SIZE                                                                             FILE SIZE
 ++++++++++++++ GROWING                                                               ++++++++++++++
  +0.1%    +326 [None]                                                                +19.6Ki  +0.3%
   +25%    +528 src/core/ext/transport/chttp2/server/chttp2_server.cc                    +528   +25%
      [NEW]    +162 on_timeout                                                               +162  [NEW]
       +34%    +129 on_handshake_done                                                        +129   +34%
       +31%     +80 on_accept                                                                 +80   +31%
      [NEW]     +71 server_connection_state_unref                                             +71  [NEW]
      [NEW]     +51 on_receive_settings                                                       +51  [NEW]
       +90%     +35 [Unmapped]                                                                +35   +90%
  +1.8%     +39 src/core/ext/transport/chttp2/transport/frame_settings.cc                 +39  +1.8%
      +3.2%     +39 grpc_chttp2_settings_parser_parse                                         +39  +3.2%
  +0.1%     +25 src/core/ext/transport/chttp2/transport/chttp2_transport.cc               +25  +0.1%
      [NEW] +3.45Ki grpc_create_chttp2_transport                                          +3.45Ki  [NEW]
      [NEW]    +100 grpc_chttp2_transport_start_reading                                      +100  [NEW]
      +4.5%     +32 close_transport_locked                                                    +32  +4.5%
      +0.5%      +3 [Unmapped]                                                                 +3  +0.5%
  +1.6%      +8 src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc      +8  +1.6%
      +1.6%      +8 grpc_insecure_channel_create_from_fd                                       +8  +1.6%
  +0.5%      +2 src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc       +2  +0.5%
      +0.5%      +2 grpc_server_add_insecure_channel_from_fd                                   +2  +0.5%

  +0.1%    +928 TOTAL                                                                 +20.2Ki  +0.3%


****************************************************************

libgrpc++.so

     VM SIZE              FILE SIZE
 ++++++++++++++ GROWIN ++++++++++++++
  [ = ]       0 [None]     +72  +0.0%

  [ = ]       0 TOTAL      +72  +0.0%



@grpc-testing
Copy link
[trickle] No significant performance differences

@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

1 similar comment
@grpc-testing
Copy link
[microbenchmarks] No significant performance differences

@markdroth
Copy link
Member Author

Known failures: #13148 #12917 #12510

@markdroth markdroth merged commit 6fa206d into grpc:master Dec 4, 2017
@markdroth markdroth deleted the server_connection_timeout branch December 4, 2017 22:28
markdroth added a commit to markdroth/grpc that referenced this pull request Dec 5, 2017
mehrdada added a commit that referenced this pull request Dec 5, 2017
markdroth added a commit to markdroth/grpc that referenced this pull request Dec 5, 2017
markdroth added a commit that referenced this pull request Dec 5, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 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.

5 participants