Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yamux as first streamMuxer #4845

Closed
wants to merge 2 commits into from
Closed

Add yamux as first streamMuxer #4845

wants to merge 2 commits into from

Conversation

dapplion
Copy link
Contributor

@dapplion dapplion commented Dec 5, 2022

Motivation

Description

Add yamux as first streamMuxer

TODO

Leaving as draft, since before merging we must assert:

  • Lodestar can interop in Mainnet correctly
  • Memory consumption + CPU performance is similar
  • Gossip throughput in the same
  • Gossip scoring appears similar

@dapplion dapplion requested a review from a team as a code owner December 5, 2022 08:10
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 6638ef4 Previous: 914397a Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 714.40 us/op 845.89 us/op 0.84
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 49.884 us/op 45.153 us/op 1.10
BLS verify - blst-native 1.2214 ms/op 1.2076 ms/op 1.01
BLS verifyMultipleSignatures 3 - blst-native 2.4875 ms/op 2.4460 ms/op 1.02
BLS verifyMultipleSignatures 8 - blst-native 5.3500 ms/op 5.4891 ms/op 0.97
BLS verifyMultipleSignatures 32 - blst-native 19.354 ms/op 19.884 ms/op 0.97
BLS aggregatePubkeys 32 - blst-native 26.075 us/op 27.093 us/op 0.96
BLS aggregatePubkeys 128 - blst-native 101.30 us/op 104.69 us/op 0.97
getAttestationsForBlock 62.081 ms/op 104.17 ms/op 0.60
isKnown best case - 1 super set check 263.00 ns/op 291.00 ns/op 0.90
isKnown normal case - 2 super set checks 250.00 ns/op 343.00 ns/op 0.73
isKnown worse case - 16 super set checks 265.00 ns/op 308.00 ns/op 0.86
CheckpointStateCache - add get delete 5.8070 us/op 6.0100 us/op 0.97
validate gossip signedAggregateAndProof - struct 2.8065 ms/op 2.7972 ms/op 1.00
validate gossip attestation - struct 1.3298 ms/op 1.3284 ms/op 1.00
pickEth1Vote - no votes 1.3529 ms/op 1.3962 ms/op 0.97
pickEth1Vote - max votes 12.409 ms/op 12.342 ms/op 1.01
pickEth1Vote - Eth1Data hashTreeRoot value x2048 9.3495 ms/op 10.884 ms/op 0.86
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 17.114 ms/op 18.117 ms/op 0.94
pickEth1Vote - Eth1Data fastSerialize value x2048 743.76 us/op 751.86 us/op 0.99
pickEth1Vote - Eth1Data fastSerialize tree x2048 8.2309 ms/op 5.8203 ms/op 1.41
bytes32 toHexString 621.00 ns/op 730.00 ns/op 0.85
bytes32 Buffer.toString(hex) 407.00 ns/op 426.00 ns/op 0.96
bytes32 Buffer.toString(hex) from Uint8Array 615.00 ns/op 638.00 ns/op 0.96
bytes32 Buffer.toString(hex) + 0x 403.00 ns/op 423.00 ns/op 0.95
Object access 1 prop 0.18800 ns/op 0.20100 ns/op 0.94
Map access 1 prop 0.16500 ns/op 0.16800 ns/op 0.98
Object get x1000 6.5490 ns/op 6.5210 ns/op 1.00
Map get x1000 0.65700 ns/op 0.61800 ns/op 1.06
Object set x1000 67.928 ns/op 54.201 ns/op 1.25
Map set x1000 51.049 ns/op 44.184 ns/op 1.16
Return object 10000 times 0.24530 ns/op 0.25300 ns/op 0.97
Throw Error 10000 times 4.2632 us/op 4.4482 us/op 0.96
fastMsgIdFn sha256 / 200 bytes 3.5160 us/op 3.6720 us/op 0.96
fastMsgIdFn h32 xxhash / 200 bytes 300.00 ns/op 329.00 ns/op 0.91
fastMsgIdFn h64 xxhash / 200 bytes 451.00 ns/op 405.00 ns/op 1.11
fastMsgIdFn sha256 / 1000 bytes 11.806 us/op 11.568 us/op 1.02
fastMsgIdFn h32 xxhash / 1000 bytes 452.00 ns/op 420.00 ns/op 1.08
fastMsgIdFn h64 xxhash / 1000 bytes 544.00 ns/op 457.00 ns/op 1.19
fastMsgIdFn sha256 / 10000 bytes 105.69 us/op 102.11 us/op 1.04
fastMsgIdFn h32 xxhash / 10000 bytes 1.9920 us/op 1.8660 us/op 1.07
fastMsgIdFn h64 xxhash / 10000 bytes 1.4450 us/op 1.3290 us/op 1.09
enrSubnets - fastDeserialize 64 bits 1.6390 us/op 1.2960 us/op 1.26
enrSubnets - ssz BitVector 64 bits 569.00 ns/op 555.00 ns/op 1.03
enrSubnets - fastDeserialize 4 bits 180.00 ns/op 195.00 ns/op 0.92
enrSubnets - ssz BitVector 4 bits 540.00 ns/op 595.00 ns/op 0.91
prioritizePeers score -10:0 att 32-0.1 sync 2-0 103.98 us/op 94.917 us/op 1.10
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 131.28 us/op 145.27 us/op 0.90
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 198.22 us/op 231.11 us/op 0.86
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 362.03 us/op 380.61 us/op 0.95
prioritizePeers score 0:0 att 64-1 sync 4-1 410.05 us/op 363.52 us/op 1.13
array of 16000 items push then shift 1.6821 us/op 1.7166 us/op 0.98
LinkedList of 16000 items push then shift 9.3170 ns/op 13.585 ns/op 0.69
array of 16000 items push then pop 118.19 ns/op 111.64 ns/op 1.06
LinkedList of 16000 items push then pop 9.4520 ns/op 9.3860 ns/op 1.01
array of 24000 items push then shift 2.3856 us/op 2.6602 us/op 0.90
LinkedList of 24000 items push then shift 8.8690 ns/op 9.0980 ns/op 0.97
array of 24000 items push then pop 88.598 ns/op 80.086 ns/op 1.11
LinkedList of 24000 items push then pop 9.1840 ns/op 9.0810 ns/op 1.01
intersect bitArray bitLen 8 13.761 ns/op 14.025 ns/op 0.98
intersect array and set length 8 94.115 ns/op 87.467 ns/op 1.08
intersect bitArray bitLen 128 44.958 ns/op 44.819 ns/op 1.00
intersect array and set length 128 1.3204 us/op 1.1509 us/op 1.15
Buffer.concat 32 items 3.1220 us/op 2.8890 us/op 1.08
Uint8Array.set 32 items 3.0790 us/op 2.3460 us/op 1.31
pass gossip attestations to forkchoice per slot 2.3607 ms/op 3.4145 ms/op 0.69
computeDeltas 3.0710 ms/op 3.1924 ms/op 0.96
computeProposerBoostScoreFromBalances 1.7652 ms/op 2.0602 ms/op 0.86
altair processAttestation - 250000 vs - 7PWei normalcase 2.4625 ms/op 2.8820 ms/op 0.85
altair processAttestation - 250000 vs - 7PWei worstcase 3.9145 ms/op 3.5607 ms/op 1.10
altair processAttestation - setStatus - 1/6 committees join 140.70 us/op 143.37 us/op 0.98
altair processAttestation - setStatus - 1/3 committees join 285.43 us/op 275.46 us/op 1.04
altair processAttestation - setStatus - 1/2 committees join 375.03 us/op 369.96 us/op 1.01
altair processAttestation - setStatus - 2/3 committees join 472.56 us/op 463.32 us/op 1.02
altair processAttestation - setStatus - 4/5 committees join 655.22 us/op 664.53 us/op 0.99
altair processAttestation - setStatus - 100% committees join 753.45 us/op 746.56 us/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase 17.714 ms/op 19.047 ms/op 0.93
altair processBlock - 250000 vs - 7PWei normalcase hashState 28.744 ms/op 28.955 ms/op 0.99
altair processBlock - 250000 vs - 7PWei worstcase 57.484 ms/op 51.024 ms/op 1.13
altair processBlock - 250000 vs - 7PWei worstcase hashState 67.355 ms/op 69.115 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei normalcase 2.5362 ms/op 2.4457 ms/op 1.04
phase0 processBlock - 250000 vs - 7PWei worstcase 31.977 ms/op 30.571 ms/op 1.05
altair processEth1Data - 250000 vs - 7PWei normalcase 509.68 us/op 495.67 us/op 1.03
vc - 250000 eb 1 eth1 1 we 0 wn 0 - smpl 15 7.9980 us/op 8.2560 us/op 0.97
vc - 250000 eb 0.95 eth1 0.1 we 0.05 wn 0 - smpl 219 27.280 us/op 25.614 us/op 1.07
vc - 250000 eb 0.95 eth1 0.3 we 0.05 wn 0 - smpl 42 11.396 us/op 10.024 us/op 1.14
vc - 250000 eb 0.95 eth1 0.7 we 0.05 wn 0 - smpl 18 11.185 us/op 7.5810 us/op 1.48
vc - 250000 eb 0.1 eth1 0.1 we 0 wn 0 - smpl 1020 105.92 us/op 94.531 us/op 1.12
vc - 250000 eb 0.03 eth1 0.03 we 0 wn 0 - smpl 11777 731.37 us/op 647.25 us/op 1.13
vc - 250000 eb 0.01 eth1 0.01 we 0 wn 0 - smpl 16384 909.76 us/op 909.67 us/op 1.00
vc - 250000 eb 0 eth1 0 we 0 wn 0 - smpl 16384 895.22 us/op 895.02 us/op 1.00
vc - 250000 eb 0 eth1 0 we 0 wn 0 nocache - smpl 16384 2.3834 ms/op 2.2905 ms/op 1.04
vc - 250000 eb 0 eth1 1 we 0 wn 0 - smpl 16384 1.7652 ms/op 1.4706 ms/op 1.20
vc - 250000 eb 0 eth1 1 we 0 wn 0 nocache - smpl 16384 3.8031 ms/op 3.9399 ms/op 0.97
Tree 40 250000 create 320.38 ms/op 300.23 ms/op 1.07
Tree 40 250000 get(125000) 191.03 ns/op 177.53 ns/op 1.08
Tree 40 250000 set(125000) 1.0034 us/op 909.48 ns/op 1.10
Tree 40 250000 toArray() 20.068 ms/op 17.038 ms/op 1.18
Tree 40 250000 iterate all - toArray() + loop 18.800 ms/op 16.738 ms/op 1.12
Tree 40 250000 iterate all - get(i) 69.399 ms/op 75.918 ms/op 0.91
MutableVector 250000 create 10.130 ms/op 10.489 ms/op 0.97
MutableVector 250000 get(125000) 6.3230 ns/op 6.2800 ns/op 1.01
MutableVector 250000 set(125000) 259.60 ns/op 327.22 ns/op 0.79
MutableVector 250000 toArray() 2.9329 ms/op 3.2947 ms/op 0.89
MutableVector 250000 iterate all - toArray() + loop 3.1812 ms/op 3.1065 ms/op 1.02
MutableVector 250000 iterate all - get(i) 1.5210 ms/op 1.5149 ms/op 1.00
Array 250000 create 2.8362 ms/op 2.8336 ms/op 1.00
Array 250000 clone - spread 1.1859 ms/op 1.0866 ms/op 1.09
Array 250000 get(125000) 0.60400 ns/op 0.55000 ns/op 1.10
Array 250000 set(125000) 0.69100 ns/op 0.62100 ns/op 1.11
Array 250000 iterate all - loop 83.940 us/op 103.70 us/op 0.81
effectiveBalanceIncrements clone Uint8Array 300000 35.737 us/op 33.761 us/op 1.06
effectiveBalanceIncrements clone MutableVector 300000 383.00 ns/op 343.00 ns/op 1.12
effectiveBalanceIncrements rw all Uint8Array 300000 166.62 us/op 167.73 us/op 0.99
effectiveBalanceIncrements rw all MutableVector 300000 85.708 ms/op 80.406 ms/op 1.07
phase0 afterProcessEpoch - 250000 vs - 7PWei 114.80 ms/op 115.59 ms/op 0.99
phase0 beforeProcessEpoch - 250000 vs - 7PWei 38.786 ms/op 44.374 ms/op 0.87
altair processEpoch - mainnet_e81889 313.10 ms/op 327.69 ms/op 0.96
mainnet_e81889 - altair beforeProcessEpoch 53.526 ms/op 64.758 ms/op 0.83
mainnet_e81889 - altair processJustificationAndFinalization 19.628 us/op 16.968 us/op 1.16
mainnet_e81889 - altair processInactivityUpdates 6.1939 ms/op 5.6659 ms/op 1.09
mainnet_e81889 - altair processRewardsAndPenalties 71.311 ms/op 52.032 ms/op 1.37
mainnet_e81889 - altair processRegistryUpdates 3.2320 us/op 3.0300 us/op 1.07
mainnet_e81889 - altair processSlashings 610.00 ns/op 522.00 ns/op 1.17
mainnet_e81889 - altair processEth1DataReset 948.00 ns/op 550.00 ns/op 1.72
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2503 ms/op 1.1871 ms/op 1.05
mainnet_e81889 - altair processSlashingsReset 4.6810 us/op 4.7680 us/op 0.98
mainnet_e81889 - altair processRandaoMixesReset 6.4120 us/op 4.5870 us/op 1.40
mainnet_e81889 - altair processHistoricalRootsUpdate 1.1460 us/op 623.00 ns/op 1.84
mainnet_e81889 - altair processParticipationFlagUpdates 3.3150 us/op 2.4610 us/op 1.35
mainnet_e81889 - altair processSyncCommitteeUpdates 854.00 ns/op 494.00 ns/op 1.73
mainnet_e81889 - altair afterProcessEpoch 125.13 ms/op 114.44 ms/op 1.09
phase0 processEpoch - mainnet_e58758 368.61 ms/op 334.45 ms/op 1.10
mainnet_e58758 - phase0 beforeProcessEpoch 150.70 ms/op 117.71 ms/op 1.28
mainnet_e58758 - phase0 processJustificationAndFinalization 19.257 us/op 15.274 us/op 1.26
mainnet_e58758 - phase0 processRewardsAndPenalties 62.663 ms/op 54.821 ms/op 1.14
mainnet_e58758 - phase0 processRegistryUpdates 7.6800 us/op 9.5280 us/op 0.81
mainnet_e58758 - phase0 processSlashings 748.00 ns/op 509.00 ns/op 1.47
mainnet_e58758 - phase0 processEth1DataReset 856.00 ns/op 501.00 ns/op 1.71
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 1.0033 ms/op 1.0167 ms/op 0.99
mainnet_e58758 - phase0 processSlashingsReset 4.5910 us/op 3.1730 us/op 1.45
mainnet_e58758 - phase0 processRandaoMixesReset 5.2050 us/op 4.5380 us/op 1.15
mainnet_e58758 - phase0 processHistoricalRootsUpdate 571.00 ns/op 584.00 ns/op 0.98
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.8370 us/op 3.8880 us/op 1.24
mainnet_e58758 - phase0 afterProcessEpoch 99.503 ms/op 96.909 ms/op 1.03
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2455 ms/op 1.1840 ms/op 1.05
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.5846 ms/op 1.4358 ms/op 1.10
altair processInactivityUpdates - 250000 normalcase 24.646 ms/op 20.912 ms/op 1.18
altair processInactivityUpdates - 250000 worstcase 26.490 ms/op 22.639 ms/op 1.17
phase0 processRegistryUpdates - 250000 normalcase 9.6880 us/op 6.5020 us/op 1.49
phase0 processRegistryUpdates - 250000 badcase_full_deposits 272.77 us/op 248.18 us/op 1.10
phase0 processRegistryUpdates - 250000 worstcase 0.5 129.19 ms/op 108.71 ms/op 1.19
altair processRewardsAndPenalties - 250000 normalcase 63.055 ms/op 53.260 ms/op 1.18
altair processRewardsAndPenalties - 250000 worstcase 69.429 ms/op 58.626 ms/op 1.18
phase0 getAttestationDeltas - 250000 normalcase 6.8588 ms/op 6.6073 ms/op 1.04
phase0 getAttestationDeltas - 250000 worstcase 6.6785 ms/op 6.5168 ms/op 1.02
phase0 processSlashings - 250000 worstcase 3.3492 ms/op 3.4836 ms/op 0.96
altair processSyncCommitteeUpdates - 250000 179.33 ms/op 165.56 ms/op 1.08
BeaconState.hashTreeRoot - No change 305.00 ns/op 268.00 ns/op 1.14
BeaconState.hashTreeRoot - 1 full validator 51.774 us/op 49.608 us/op 1.04
BeaconState.hashTreeRoot - 32 full validator 551.56 us/op 511.39 us/op 1.08
BeaconState.hashTreeRoot - 512 full validator 5.3155 ms/op 4.9866 ms/op 1.07
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 63.433 us/op 61.729 us/op 1.03
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 936.67 us/op 855.16 us/op 1.10
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 11.560 ms/op 11.079 ms/op 1.04
BeaconState.hashTreeRoot - 1 balances 49.026 us/op 48.330 us/op 1.01
BeaconState.hashTreeRoot - 32 balances 467.19 us/op 467.55 us/op 1.00
BeaconState.hashTreeRoot - 512 balances 4.2208 ms/op 4.3086 ms/op 0.98
BeaconState.hashTreeRoot - 250000 balances 78.318 ms/op 74.045 ms/op 1.06
aggregationBits - 2048 els - zipIndexesInBitList 15.858 us/op 16.767 us/op 0.95
regular array get 100000 times 32.988 us/op 33.186 us/op 0.99
wrappedArray get 100000 times 32.630 us/op 33.156 us/op 0.98
arrayWithProxy get 100000 times 15.389 ms/op 15.618 ms/op 0.99
ssz.Root.equals 551.00 ns/op 573.00 ns/op 0.96
byteArrayEquals 555.00 ns/op 566.00 ns/op 0.98
shuffle list - 16384 els 6.8144 ms/op 6.9260 ms/op 0.98
shuffle list - 250000 els 98.801 ms/op 100.54 ms/op 0.98
processSlot - 1 slots 9.1770 us/op 8.6240 us/op 1.06
processSlot - 32 slots 1.3502 ms/op 1.3724 ms/op 0.98
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 199.11 us/op 197.04 us/op 1.01
getCommitteeAssignments - req 1 vs - 250000 vc 2.9218 ms/op 2.9179 ms/op 1.00
getCommitteeAssignments - req 100 vs - 250000 vc 4.1640 ms/op 4.1226 ms/op 1.01
getCommitteeAssignments - req 1000 vs - 250000 vc 4.5302 ms/op 4.4498 ms/op 1.02
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.7100 ns/op 4.6800 ns/op 1.01
state getBlockRootAtSlot - 250000 vs - 7PWei 563.68 ns/op 702.34 ns/op 0.80
computeProposers - vc 250000 10.295 ms/op 10.946 ms/op 0.94
computeEpochShuffling - vc 250000 102.27 ms/op 102.38 ms/op 1.00
getNextSyncCommittee - vc 250000 171.62 ms/op 177.23 ms/op 0.97

by benchmarkbot/action

@twoeths
Copy link
Contributor

twoeths commented Dec 6, 2022

I've tested this branch on feat2 mainnet node, there's gossip peer scoring issue that cause the node to have lower mesh peers

  • this branch

Screen Shot 2022-12-06 at 14 43 21

  • feat1 (same to unstable)

Screen Shot 2022-12-06 at 14 44 16

@twoeths
Copy link
Contributor

twoeths commented Jan 16, 2023

all metrics look good except for the memory issue, we resolved with #5001

rebasing to latest unstable and deployed to feat for the last test

@wemeetagain wemeetagain marked this pull request as ready for review February 10, 2023 22:04
@wemeetagain
Copy link
Member

marking as ready for review, @tuyennhv feel free to 👍 when you're comfortable

@philknows philknows added this to the v1.5.0 milestone Feb 12, 2023
@philknows philknows removed this from the v1.5.0 milestone Apr 5, 2023
@dapplion
Copy link
Contributor Author

@dapplion dapplion closed this Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants