eos icon indicating copy to clipboard operation
eos copied to clipboard

DAWN-118 ⁃ Modify P2P to use scatter/gather for reads

Open blockone-syncclient opened this issue 9 years ago • 5 comments

Modify the P2P code to do the following:

  • Use a sequence of fixed size buffers to store data read from the TCP socket
  • Grow and shrink the chain of buffers as necessary
  • Use a boost pool to manage the individual buffers

This change should result in better memory usage for eosd and make it easier to do further time/space optimizations.

ATC

There is no externally visible functional changes related to this issue, so normal regression testing with a multi-node network is all that is required.

blockone-syncclient avatar Nov 01 '17 19:11 blockone-syncclient

Is this change about making things faster or using less space?

Does this change represent pre-mature optimization?

bytemaster avatar Nov 13 '17 14:11 bytemaster

space reduction is one issue, but this also addresses a situation Matthew had encountered, which is the case where a signed block message exceeded the fixed buffer size. With the fixed buffers we are sunk if that occurs. Prior to this patch we didn't have a strategy to support fractional message reads.

So maybe in the context of STAT this is premature optimization, but I believe it improves overall robustness and scalability.

pmesnier avatar Nov 13 '17 15:11 pmesnier

I typed a longer message but Phil beat me to most of it.

My last change eliminated the fixed buffer size and this one uses scatter/gather to avoid large individual buffers (which are required for each connection). They are really both part of the larger changes Phil discussed and allow us to scale better for connections, message size, and message frequency.

PaulCalabrese avatar Nov 13 '17 15:11 PaulCalabrese

➤ Dhanesh Valappil commented:

I am not too sure how exactly should this be tested. As the changes are in p2p layer, will do basic tests on p2p communication and syncs

blockone-syncclient avatar Nov 15 '17 16:11 blockone-syncclient

➤ Dhanesh Valappil commented:

Tested a few p2p scenarios and looks good

blockone-syncclient avatar Nov 15 '17 17:11 blockone-syncclient