DAWN-118 ⁃ Modify P2P to use scatter/gather for reads
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.
Is this change about making things faster or using less space?
Does this change represent pre-mature optimization?
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.
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.
➤ 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
➤ Dhanesh Valappil commented:
Tested a few p2p scenarios and looks good