Although in actual production there will be no sub-substreams above 100 levels, this is indeed a problem. After regression testing, the current code will show a significant throughput drop when it is around 800.
master branch: CPU consumption of distribute_to_substream function accounts for more than 50%
patch branch: CPU consumption problem of distribute_to_substream function cannot be clearly observed, about 2.5%
This is a classic continuous memory and segmented memory overhead problem. In a test scenario under full pressure, such memory issues will be triggered frequently and cause huge overhead.
The throughput problem reappeared because of this commit https://github.com/nervosnetwork/tentacle/commit/1ea53e989c8a33313ccda69f093f23b35948d3d0
test case: https://github.com/nervosnetwork/tentacle/pull/213
Although in actual production there will be no sub-substreams above 100 levels, this is indeed a problem. After regression testing, the current code will show a significant throughput drop when it is around 800.
perf
./target/release/examples/throughput_test 800
master branch: CPU consumption of
distribute_to_substream
function accounts for more than 50% patch branch: CPU consumption problem ofdistribute_to_substream
function cannot be clearly observed, about 2.5%This is a classic continuous memory and segmented memory overhead problem. In a test scenario under full pressure, such memory issues will be triggered frequently and cause huge overhead.