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

Split lodestar-api by APIs #4158

Merged
merged 4 commits into from
Jun 15, 2022
Merged

Split lodestar-api by APIs #4158

merged 4 commits into from
Jun 15, 2022

Conversation

dapplion
Copy link
Contributor

Motivation

#3969 introduces a new pseudo-namespace in the api client. The current organization does not allow different API "targets". The beacon, keymanager and builder APIs are served by different servers so it's best to separate them

Description

  • Split lodestar-api by APIs or servers that serve them
  • Add placeholder for builder API client
import {getClient} from "@lodestar/api/beacon"
import {getClient} from "@lodestar/api/builder"
import {getClient} from "@lodestar/api/keymanager"

@dapplion dapplion requested a review from a team as a code owner June 14, 2022 20:27
wemeetagain
wemeetagain previously approved these changes Jun 14, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jun 14, 2022

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: de238cd Previous: 04155c6 Ratio
altair processAttestation - 250000 vs - 7PWei normalcase 4.7051 ms/op 4.0161 ms/op 1.17
altair processAttestation - 250000 vs - 7PWei worstcase 7.2149 ms/op 6.7037 ms/op 1.08
altair processAttestation - setStatus - 1/6 committees join 240.22 us/op 229.21 us/op 1.05
altair processAttestation - setStatus - 1/3 committees join 459.19 us/op 448.76 us/op 1.02
altair processAttestation - setStatus - 1/2 committees join 629.28 us/op 633.27 us/op 0.99
altair processAttestation - setStatus - 2/3 committees join 861.05 us/op 819.90 us/op 1.05
altair processAttestation - setStatus - 4/5 committees join 1.1759 ms/op 1.1415 ms/op 1.03
altair processAttestation - setStatus - 100% committees join 1.3246 ms/op 1.3337 ms/op 0.99
altair processBlock - 250000 vs - 7PWei normalcase 30.562 ms/op 30.245 ms/op 1.01
altair processBlock - 250000 vs - 7PWei normalcase hashState 39.692 ms/op 39.702 ms/op 1.00
altair processBlock - 250000 vs - 7PWei worstcase 93.058 ms/op 90.865 ms/op 1.02
altair processBlock - 250000 vs - 7PWei worstcase hashState 136.42 ms/op 119.97 ms/op 1.14
phase0 processBlock - 250000 vs - 7PWei normalcase 4.2791 ms/op 4.0791 ms/op 1.05
phase0 processBlock - 250000 vs - 7PWei worstcase 56.762 ms/op 53.849 ms/op 1.05
altair processEth1Data - 250000 vs - 7PWei normalcase 905.21 us/op 864.10 us/op 1.05
Tree 40 250000 create 939.27 ms/op 926.14 ms/op 1.01
Tree 40 250000 get(125000) 358.54 ns/op 344.16 ns/op 1.04
Tree 40 250000 set(125000) 3.0700 us/op 3.1733 us/op 0.97
Tree 40 250000 toArray() 37.942 ms/op 38.279 ms/op 0.99
Tree 40 250000 iterate all - toArray() + loop 37.617 ms/op 38.907 ms/op 0.97
Tree 40 250000 iterate all - get(i) 134.96 ms/op 137.02 ms/op 0.98
MutableVector 250000 create 28.474 ms/op 22.130 ms/op 1.29
MutableVector 250000 get(125000) 15.481 ns/op 15.632 ns/op 0.99
MutableVector 250000 set(125000) 692.96 ns/op 743.26 ns/op 0.93
MutableVector 250000 toArray() 6.6366 ms/op 8.8235 ms/op 0.75
MutableVector 250000 iterate all - toArray() + loop 6.8836 ms/op 8.7047 ms/op 0.79
MutableVector 250000 iterate all - get(i) 3.5126 ms/op 4.1283 ms/op 0.85
Array 250000 create 5.7467 ms/op 8.1163 ms/op 0.71
Array 250000 clone - spread 2.8114 ms/op 4.8372 ms/op 0.58
Array 250000 get(125000) 1.3050 ns/op 2.0200 ns/op 0.65
Array 250000 set(125000) 1.3290 ns/op 2.0040 ns/op 0.66
Array 250000 iterate all - loop 149.25 us/op 199.84 us/op 0.75
effectiveBalanceIncrements clone Uint8Array 300000 281.35 us/op 114.22 us/op 2.46
effectiveBalanceIncrements clone MutableVector 300000 799.00 ns/op 849.00 ns/op 0.94
effectiveBalanceIncrements rw all Uint8Array 300000 304.95 us/op 303.24 us/op 1.01
effectiveBalanceIncrements rw all MutableVector 300000 213.75 ms/op 203.03 ms/op 1.05
phase0 afterProcessEpoch - 250000 vs - 7PWei 216.40 ms/op 237.24 ms/op 0.91
phase0 beforeProcessEpoch - 250000 vs - 7PWei 78.054 ms/op 78.661 ms/op 0.99
altair processEpoch - mainnet_e81889 650.90 ms/op 668.04 ms/op 0.97
mainnet_e81889 - altair beforeProcessEpoch 160.79 ms/op 198.28 ms/op 0.81
mainnet_e81889 - altair processJustificationAndFinalization 69.972 us/op 36.075 us/op 1.94
mainnet_e81889 - altair processInactivityUpdates 13.513 ms/op 14.181 ms/op 0.95
mainnet_e81889 - altair processRewardsAndPenalties 101.51 ms/op 102.16 ms/op 0.99
mainnet_e81889 - altair processRegistryUpdates 14.158 us/op 7.3350 us/op 1.93
mainnet_e81889 - altair processSlashings 2.9290 us/op 2.0010 us/op 1.46
mainnet_e81889 - altair processEth1DataReset 3.7940 us/op 1.9870 us/op 1.91
mainnet_e81889 - altair processEffectiveBalanceUpdates 2.5136 ms/op 2.6388 ms/op 0.95
mainnet_e81889 - altair processSlashingsReset 28.212 us/op 15.101 us/op 1.87
mainnet_e81889 - altair processRandaoMixesReset 23.512 us/op 12.522 us/op 1.88
mainnet_e81889 - altair processHistoricalRootsUpdate 3.7580 us/op 1.9710 us/op 1.91
mainnet_e81889 - altair processParticipationFlagUpdates 15.911 us/op 6.0880 us/op 2.61
mainnet_e81889 - altair processSyncCommitteeUpdates 3.5350 us/op 1.7900 us/op 1.97
mainnet_e81889 - altair afterProcessEpoch 208.89 ms/op 228.35 ms/op 0.91
phase0 processEpoch - mainnet_e58758 668.69 ms/op 611.86 ms/op 1.09
mainnet_e58758 - phase0 beforeProcessEpoch 295.42 ms/op 266.24 ms/op 1.11
mainnet_e58758 - phase0 processJustificationAndFinalization 57.500 us/op 33.658 us/op 1.71
mainnet_e58758 - phase0 processRewardsAndPenalties 91.225 ms/op 136.56 ms/op 0.67
mainnet_e58758 - phase0 processRegistryUpdates 30.497 us/op 16.503 us/op 1.85
mainnet_e58758 - phase0 processSlashings 2.8090 us/op 1.6920 us/op 1.66
mainnet_e58758 - phase0 processEth1DataReset 3.1900 us/op 1.7180 us/op 1.86
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 2.5998 ms/op 2.5263 ms/op 1.03
mainnet_e58758 - phase0 processSlashingsReset 16.346 us/op 8.8550 us/op 1.85
mainnet_e58758 - phase0 processRandaoMixesReset 25.859 us/op 12.529 us/op 2.06
mainnet_e58758 - phase0 processHistoricalRootsUpdate 3.8170 us/op 2.0200 us/op 1.89
mainnet_e58758 - phase0 processParticipationRecordUpdates 23.028 us/op 10.291 us/op 2.24
mainnet_e58758 - phase0 afterProcessEpoch 177.87 ms/op 187.78 ms/op 0.95
phase0 processEffectiveBalanceUpdates - 250000 normalcase 2.7095 ms/op 3.3754 ms/op 0.80
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 2.9604 ms/op 3.8326 ms/op 0.77
altair processInactivityUpdates - 250000 normalcase 48.463 ms/op 37.949 ms/op 1.28
altair processInactivityUpdates - 250000 worstcase 50.874 ms/op 46.783 ms/op 1.09
phase0 processRegistryUpdates - 250000 normalcase 25.644 us/op 14.784 us/op 1.73
phase0 processRegistryUpdates - 250000 badcase_full_deposits 516.10 us/op 512.48 us/op 1.01
phase0 processRegistryUpdates - 250000 worstcase 0.5 306.26 ms/op 241.42 ms/op 1.27
altair processRewardsAndPenalties - 250000 normalcase 106.38 ms/op 144.11 ms/op 0.74
altair processRewardsAndPenalties - 250000 worstcase 115.28 ms/op 96.539 ms/op 1.19
phase0 getAttestationDeltas - 250000 normalcase 14.764 ms/op 15.890 ms/op 0.93
phase0 getAttestationDeltas - 250000 worstcase 14.547 ms/op 17.582 ms/op 0.83
phase0 processSlashings - 250000 worstcase 6.8070 ms/op 6.3285 ms/op 1.08
altair processSyncCommitteeUpdates - 250000 343.49 ms/op 327.68 ms/op 1.05
BeaconState.hashTreeRoot - No change 695.00 ns/op 627.00 ns/op 1.11
BeaconState.hashTreeRoot - 1 full validator 78.792 us/op 74.846 us/op 1.05
BeaconState.hashTreeRoot - 32 full validator 833.03 us/op 798.84 us/op 1.04
BeaconState.hashTreeRoot - 512 full validator 9.3443 ms/op 7.9017 ms/op 1.18
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 111.22 us/op 95.438 us/op 1.17
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 1.5600 ms/op 1.1294 ms/op 1.38
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 20.284 ms/op 18.720 ms/op 1.08
BeaconState.hashTreeRoot - 1 balances 82.021 us/op 77.199 us/op 1.06
BeaconState.hashTreeRoot - 32 balances 755.31 us/op 699.27 us/op 1.08
BeaconState.hashTreeRoot - 512 balances 8.0646 ms/op 5.9973 ms/op 1.34
BeaconState.hashTreeRoot - 250000 balances 109.62 ms/op 111.73 ms/op 0.98
aggregationBits - 2048 els - zipIndexesInBitList 33.380 us/op 34.065 us/op 0.98
regular array get 100000 times 63.901 us/op 78.974 us/op 0.81
wrappedArray get 100000 times 61.018 us/op 79.550 us/op 0.77
arrayWithProxy get 100000 times 37.188 ms/op 35.475 ms/op 1.05
ssz.Root.equals 636.00 ns/op 556.00 ns/op 1.14
byteArrayEquals 638.00 ns/op 546.00 ns/op 1.17
shuffle list - 16384 els 12.248 ms/op 13.485 ms/op 0.91
shuffle list - 250000 els 179.68 ms/op 195.72 ms/op 0.92
processSlot - 1 slots 17.404 us/op 14.236 us/op 1.22
processSlot - 32 slots 2.4235 ms/op 2.0824 ms/op 1.16
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 495.84 us/op 443.19 us/op 1.12
getCommitteeAssignments - req 1 vs - 250000 vc 5.5264 ms/op 6.2875 ms/op 0.88
getCommitteeAssignments - req 100 vs - 250000 vc 8.0481 ms/op 8.7116 ms/op 0.92
getCommitteeAssignments - req 1000 vs - 250000 vc 9.0929 ms/op 9.2544 ms/op 0.98
computeProposers - vc 250000 19.933 ms/op 19.597 ms/op 1.02
computeEpochShuffling - vc 250000 186.48 ms/op 200.03 ms/op 0.93
getNextSyncCommittee - vc 250000 335.91 ms/op 327.78 ms/op 1.02
pass gossip attestations to forkchoice per slot 3.7465 ms/op 3.7974 ms/op 0.99
computeDeltas 4.1470 ms/op 3.7555 ms/op 1.10
computeProposerBoostScoreFromBalances 910.61 us/op 1.0805 ms/op 0.84
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.5119 ms/op 2.3979 ms/op 1.05
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 101.17 us/op 108.28 us/op 0.93
BLS verify - blst-native 2.2709 ms/op 2.1889 ms/op 1.04
BLS verifyMultipleSignatures 3 - blst-native 4.5639 ms/op 4.5774 ms/op 1.00
BLS verifyMultipleSignatures 8 - blst-native 10.698 ms/op 9.5262 ms/op 1.12
BLS verifyMultipleSignatures 32 - blst-native 36.991 ms/op 34.686 ms/op 1.07
BLS aggregatePubkeys 32 - blst-native 48.817 us/op 46.129 us/op 1.06
BLS aggregatePubkeys 128 - blst-native 193.01 us/op 183.60 us/op 1.05
getAttestationsForBlock 79.671 ms/op 73.389 ms/op 1.09
isKnown best case - 1 super set check 550.00 ns/op 585.00 ns/op 0.94
isKnown normal case - 2 super set checks 529.00 ns/op 506.00 ns/op 1.05
isKnown worse case - 16 super set checks 515.00 ns/op 520.00 ns/op 0.99
CheckpointStateCache - add get delete 13.727 us/op 11.628 us/op 1.18
validate gossip signedAggregateAndProof - struct 5.3040 ms/op 4.8472 ms/op 1.09
validate gossip attestation - struct 2.4428 ms/op 2.3269 ms/op 1.05
altair verifyImport mainnet_s3766816:31 7.7350 s/op 7.3181 s/op 1.06
pickEth1Vote - no votes 2.6277 ms/op 2.4194 ms/op 1.09
pickEth1Vote - max votes 33.591 ms/op 29.323 ms/op 1.15
pickEth1Vote - Eth1Data hashTreeRoot value x2048 18.138 ms/op 13.961 ms/op 1.30
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 27.796 ms/op 24.222 ms/op 1.15
pickEth1Vote - Eth1Data fastSerialize value x2048 1.9353 ms/op 1.7692 ms/op 1.09
pickEth1Vote - Eth1Data fastSerialize tree x2048 24.374 ms/op 20.970 ms/op 1.16
bytes32 toHexString 1.4830 us/op 1.2360 us/op 1.20
bytes32 Buffer.toString(hex) 896.00 ns/op 815.00 ns/op 1.10
bytes32 Buffer.toString(hex) from Uint8Array 1.2280 us/op 1.1510 us/op 1.07
bytes32 Buffer.toString(hex) + 0x 902.00 ns/op 832.00 ns/op 1.08
Object access 1 prop 0.47800 ns/op 0.41700 ns/op 1.15
Map access 1 prop 0.35000 ns/op 0.33900 ns/op 1.03
Object get x1000 17.723 ns/op 20.404 ns/op 0.87
Map get x1000 1.0620 ns/op 1.2690 ns/op 0.84
Object set x1000 134.26 ns/op 136.27 ns/op 0.99
Map set x1000 89.463 ns/op 79.510 ns/op 1.13
Return object 10000 times 0.45060 ns/op 0.42510 ns/op 1.06
Throw Error 10000 times 7.4280 us/op 6.7404 us/op 1.10
enrSubnets - fastDeserialize 64 bits 3.6290 us/op 3.0260 us/op 1.20
enrSubnets - ssz BitVector 64 bits 942.00 ns/op 831.00 ns/op 1.13
enrSubnets - fastDeserialize 4 bits 532.00 ns/op 437.00 ns/op 1.22
enrSubnets - ssz BitVector 4 bits 946.00 ns/op 838.00 ns/op 1.13
prioritizePeers score -10:0 att 32-0.1 sync 2-0 122.75 us/op 106.96 us/op 1.15
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 159.69 us/op 139.95 us/op 1.14
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 303.10 us/op 240.52 us/op 1.26
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 662.53 us/op 529.81 us/op 1.25
prioritizePeers score 0:0 att 64-1 sync 4-1 598.00 us/op 529.10 us/op 1.13
RateTracker 1000000 limit, 1 obj count per request 221.72 ns/op 224.56 ns/op 0.99
RateTracker 1000000 limit, 2 obj count per request 166.18 ns/op 167.40 ns/op 0.99
RateTracker 1000000 limit, 4 obj count per request 140.11 ns/op 140.18 ns/op 1.00
RateTracker 1000000 limit, 8 obj count per request 126.50 ns/op 123.96 ns/op 1.02
RateTracker with prune 6.1640 us/op 5.0040 us/op 1.23
array of 16000 items push then shift 5.7919 us/op 3.7222 us/op 1.56
LinkedList of 16000 items push then shift 31.589 ns/op 27.724 ns/op 1.14
array of 16000 items push then pop 282.98 ns/op 292.97 ns/op 0.97
LinkedList of 16000 items push then pop 25.619 ns/op 23.484 ns/op 1.09
array of 24000 items push then shift 8.9354 us/op 5.3921 us/op 1.66
LinkedList of 24000 items push then shift 31.697 ns/op 29.317 ns/op 1.08
array of 24000 items push then pop 260.92 ns/op 238.73 ns/op 1.09
LinkedList of 24000 items push then pop 25.605 ns/op 24.132 ns/op 1.06
intersect bitArray bitLen 8 13.863 ns/op 13.916 ns/op 1.00
intersect array and set length 8 221.51 ns/op 193.63 ns/op 1.14
intersect bitArray bitLen 128 77.093 ns/op 71.799 ns/op 1.07
intersect array and set length 128 2.6486 us/op 2.6073 us/op 1.02

by benchmarkbot/action

g11tech
g11tech previously approved these changes Jun 15, 2022
@dapplion dapplion dismissed stale reviews from g11tech and wemeetagain via 219746d June 15, 2022 05:50
@dapplion dapplion merged commit 9feb5bd into unstable Jun 15, 2022
@dapplion dapplion deleted the dapplion/api-multi branch June 15, 2022 06:59
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.

3 participants