Skip to content

Simplify LB policy refcounting.#13857

Merged
markdroth merged 1 commit intogrpc:masterfrom
markdroth:lb_policy_ref_simplification
Jan 9, 2018
Merged

Simplify LB policy refcounting.#13857
markdroth merged 1 commit intogrpc:masterfrom
markdroth:lb_policy_ref_simplification

Conversation

@markdroth
Copy link
Copy Markdown
Member

@markdroth markdroth commented Dec 21, 2017

This PR eliminates the two types of refs for LB policies (strong vs. weak) and replaces them with a single type of reference.

To make this work, we ensure that there is only one external owner of the LB policy, which is responsible for explicitly calling glb_lb_policy_shutdown_locked(). Prior to this PR, there were two external owners of an LB policy, both in the client_channel filter: the filter's channel_data struct was the primary owner, but we were also holding a reference in the filter's call_data so that when we switch to a new LB policy, we don't shut down the old policy until it has finished the picks that were already in flight with that old LB policy. This PR eliminates the reference held by the call_data struct and provides a different solution for switching LB policies: now, when the old LB policy is shut down, if there is a new LB policy created, it hands off any pending picks to the new LB policy.

In order to make it easier for one LB policy to hand off picks to another, I moved all parameters used in a pick to a single struct, called grpc_lb_policy_pick_state. This wound up having a very nice side effect, which is that this struct can double as the pending_pick struct inside the PF and RR policies, thus eliminating some unnecessary allocations. The logic in the grpclb policy was more complex, so a wrapper struct was still needed there, but even in that case, the logic is much simpler now (e.g., I was able to combine the pending_pick and wrapped_rr_closure structs), and I've eliminated some unnecessary allocations there too.

While I was working on the grpclb code, I also changed it to not hold a ref the RR policy for each pick. Since we no longer have any cases where the RR policy will be shut down out from under us, these references are no longer necessary. I was also able to greatly simplify the pending_pings struct.

In a subsequent PR, I will convert the LB policy code to use a C++ API similar to the one I wrote for the resolver (see #13684).

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -736 [None]                                                                 -6.91Ki  -0.1%
  -6.3%    -928 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -928  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.30Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.30Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -606 glb_shutdown_locked                                                       -606  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
      -9.6%     -40 [Unmapped]                                                                 -40  -9.6%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.2% -1.78Ki TOTAL                                                                  -7.98Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

const grpc_lb_policy_pick_args inputs = {
calld->pick.initial_metadata =
calld->initial_metadata_batch->payload->send_initial_metadata
.send_initial_metadata,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the trailing comma should be a semicolon.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Doh! Thanks for catching this. Fixed.

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -736 [None]                                                                 -6.91Ki  -0.1%
  -6.3%    -928 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -928  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.30Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.30Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -606 glb_shutdown_locked                                                       -606  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
      -9.6%     -40 [Unmapped]                                                                 -40  -9.6%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.2% -1.78Ki TOTAL                                                                  -7.98Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +7%

@grpc grpc deleted a comment from markdroth Dec 21, 2017
Copy link
Copy Markdown
Contributor

@dgquintas dgquintas left a comment

Choose a reason for hiding this comment

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

This PR looks great, really makes things simpler. Thanks Mark!

typedef struct glb_lb_policy glb_lb_policy;

/// Linked list of pending pick requests. It stores all information needed to
//// eventually call (Round Robin's) pick() on them. They mainly stay pending
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: three slashes should be enough :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed.

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -736 [None]                                                                 -6.91Ki  -0.1%
  -6.3%    -928 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -928  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.30Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.30Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -606 glb_shutdown_locked                                                       -606  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
      -9.6%     -40 [Unmapped]                                                                 -40  -9.6%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.2% -1.78Ki TOTAL                                                                  -7.98Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -736 [None]                                                                 -6.91Ki  -0.1%
  -6.3%    -928 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -928  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.30Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.30Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -606 glb_shutdown_locked                                                       -606  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
      -9.6%     -40 [Unmapped]                                                                 -40  -9.6%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.2% -1.78Ki TOTAL                                                                  -7.98Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -672 [None]                                                                 -6.95Ki  -0.1%
  -6.2%    -928 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -928  -6.2%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.36Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.36Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -606 glb_shutdown_locked                                                       -606  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
      -9.3%     -40 [Unmapped]                                                                 -40  -9.3%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.1% -1.72Ki TOTAL                                                                  -8.01Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +7%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

Copy link
Copy Markdown
Contributor

@AspirinSJL AspirinSJL left a comment

Choose a reason for hiding this comment

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

I roughly read the changes and understood the main idea.

@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -688 [None]                                                                 -6.93Ki  -0.1%
  -6.3%    -944 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -944  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.36Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.36Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -590 glb_shutdown_locked                                                       -590  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
     -11.7%     -48 [Unmapped]                                                                 -48 -11.7%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.1% -1.75Ki TOTAL                                                                  -8.01Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

@markdroth markdroth force-pushed the lb_policy_ref_simplification branch from 6eea1dc to c0febd3 Compare January 9, 2018 18:25
@grpc-testing
Copy link
Copy Markdown

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

libgrpc.so

     VM SIZE                                                                              FILE SIZE
 ++++++++++++++ GROWING                                                                ++++++++++++++
  +2.0%     +96 src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc     +96  +2.0%
      [NEW]    +481 pf_shutdown_locked                                                        +481  [NEW]
      [NEW]    +274 pf_cancel_pick_locked                                                     +274  [NEW]
      [NEW]    +103 pf_pick_locked                                                            +103  [NEW]
       +32%     +34 [Unmapped]                                                                 +34   +32%
      +1.1%     +16 pf_connectivity_changed_locked                                             +16  +1.1%
      +1.0%      +3 pf_cancel_picks_locked                                                      +3  +1.0%

 -------------- SHRINKING                                                              --------------
  -0.1%    -688 [None]                                                                 -6.94Ki  -0.1%
  -6.3%    -944 src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc            -944  -6.3%
      [DEL] -1.57Ki rr_handover_locked(glb_lb_policy*) [clone .part.8]                     -1.57Ki  [DEL]
      [DEL] -1.36Ki query_for_backends_locked(glb_lb_policy*) [clone .part.11]             -1.36Ki  [DEL]
      [DEL]    -708 glb_pick_locked                                                           -708  [DEL]
      [DEL]    -693 pick_from_internal_rr_locked                                              -693  [DEL]
      [DEL]    -590 glb_shutdown_locked                                                       -590  [DEL]
      [DEL]    -433 wrapped_rr_closure                                                        -433  [DEL]
      [DEL]    -314 glb_cancel_pick_locked                                                    -314  [DEL]
      [DEL]    -150 add_pending_pick                                                          -150  [DEL]
     -55.4%    -134 glb_ping_one_locked                                                       -134 -55.4%
      [DEL]    -119 glb_rr_connectivity_changed_locked                                        -119  [DEL]
      [DEL]    -113 initial_metadata_add_lb_token                                             -113  [DEL]
     -11.7%     -48 [Unmapped]                                                                 -48 -11.7%
 -22.5%    -144 src/core/ext/filters/client_channel/lb_policy.cc                          -144 -22.5%
      [DEL]     -60 grpc_lb_policy_weak_unref                                                  -60  [DEL]
     -43.2%     -51 grpc_lb_policy_unref                                                       -51 -43.2%
     -13.1%     -19 [Unmapped]                                                                 -19 -13.1%
      [DEL]     -19 shutdown_locked                                                            -19  [DEL]
      [DEL]      -7 grpc_lb_policy_weak_ref                                                     -7  [DEL]
      [DEL]      -6 grpc_lb_policy_pick_locked                                                  -6  [DEL]
      [DEL]      -6 grpc_lb_policy_cancel_pick_locked                                           -6  [DEL]
     -10.0%      -1 grpc_lb_policy_ref                                                          -1 -10.0%
  -0.8%    -112 src/core/ext/filters/client_channel/client_channel.cc                     -112  -0.8%
     -46.2%     -74 pick_callback_done_locked                                                  -74 -46.2%
      -8.5%     -61 pick_callback_start_locked                                                 -61  -8.5%
     -16.0%     -59 cc_destroy_call_elem                                                       -59 -16.0%
      -0.7%      -1 pick_callback_cancel_locked                                                 -1  -0.7%

  -0.1% -1.75Ki TOTAL                                                                  -8.02Ki  -0.1%


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

libgrpc++.so

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

  [ = ]       0        0  [ = ]



@grpc-testing
Copy link
Copy Markdown

[trickle] No significant performance differences

@markdroth markdroth merged commit 1acc1fc into grpc:master Jan 9, 2018
@markdroth markdroth deleted the lb_policy_ref_simplification branch January 9, 2018 18:58
@grpc-testing
Copy link
Copy Markdown

[microbenchmarks] Performance differences noted:
Benchmark                                                       call_initial_size-median
--------------------------------------------------------------  --------------------------
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/0/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/1/1      +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/32768/1  +7%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/4096/1   +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/512/1    +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/64/1     +8%
BM_StreamingPingPong<MinTCP, NoOpMutator, NoOpMutator>/8/1      +8%

@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants