Skip to content
  • yacovm's avatar
    [FAB-5157] Optimize peer selection of channel batches · 6c3cb99d
    yacovm authored
    
    
    In gossip whenever a batch of channel-scoped messages
    (either leadership, blocks, stateInfo, etc.) is sent to remote peers,
    a function goes over all existing alive peers and then selects from
    them a subset of peers. This is done in gossipInChan function
    
    In case of leadership messages, the subset is taken from the entire
    membership set without an upper bound (we gossip leadership messages
    to all peers in the channel), and in case of non-leadership messages
    the subset is taken with an upper bound equal to the propogation
    fanout (configurable).
    
    Finding peers that are eligible to receive any channel-related data
    involves cryptographical computations and is non-negligible
    (measured ~ 25ms in a network of 8 peers)
    
    The 2 possibilities (leadership and non-leadership) are calculated even
    though each method invocation of gossipInChan receives only 1 type of message.
    Therefore, it would be beneficial performance wise to just calculate the
    option that is relevant to that method invocation and not calculate
    both options each time.
    
    This commit addresses this by calculating the peers to send according to
    the type of message in the invocation.
    
    Change-Id: If6940182f83ef046c1d1f7186a71946128591e69
    Signed-off-by: default avataryacovm <yacovm@il.ibm.com>
    6c3cb99d