Skip to content

Draft: added times of p2p announcement and fetch request to block stats

Andrzej Lisak requested to merge abw_p2p_block_stats into develop

Not to be merged, just as a form of experiment to play with if some p2p optimizations are to be implemented and tested.

Two time_points were added:

  • when block is first seen in some peer inventory (added to _items_to_fetch for the first time)
  • when block is requested to be fetched from a peer (moved to items_requested_from_peer and removed from _items_to_fetch) Unfortunately we don't have other important time point which is on the other side of communication - time when peer starts fulfilling fetch request.

As a result we have two new measurements:

  • stats.exec.inv - time spent waiting in inventory (between announcement and fetch request)
  • stats.exec.req - time spent waiting for request to be filled (includes time it takes to actually send the block through the network)

Flood test shows that the times of block message processing in p2p depend solely on p2p traffic (expected) and partially on block size (also expected). Normally stats.exec.inv is short, but sometimes it shoots up to 200ms for no apparent reason. Incidentally stats.exec.req shortens then, approaching time it actually takes to pass the block through the network. Most of the time this is where most of the time is wasted. My guess is that it might be due async tasks - node can have other work queued up and even though the blocks are prioritized in inventory (I'm not sure if the same is true for fulfilling block fetch requests) it might have to finish prior work first before block related communication can happen. That behavior is the reason of apparent instability in stats.offset measurements (Block Time Offset in log) which is only visible because all blocks in flood test have similar size and the amount of incoming transactions is also quite stable. If tried on mirrornet or mainnet the effect should be less obvious due to variability of block sizes and transaction types.

Merge request reports