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

refactor: class HttpMetricsServer as close only #5586

Merged
merged 1 commit into from
May 30, 2023

Conversation

dapplion
Copy link
Contributor

Motivation

Lodestar does not support start stop syntax in general. It's unnecessary for downstream classes to expose such behavior

Description

HttpMetricsServer as close only class

@dapplion dapplion requested a review from a team as a code owner May 30, 2023 16:05
@dapplion dapplion force-pushed the dapplion/http-metrics-close branch from 621a8c0 to 1334538 Compare May 30, 2023 16:13
@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 3a16ca8 Previous: 0e93c07 Ratio
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 583.28 us/op 640.28 us/op 0.91
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 51.911 us/op 63.761 us/op 0.81
BLS verify - blst-native 1.2415 ms/op 1.2962 ms/op 0.96
BLS verifyMultipleSignatures 3 - blst-native 2.5365 ms/op 2.6832 ms/op 0.95
BLS verifyMultipleSignatures 8 - blst-native 5.3166 ms/op 5.6610 ms/op 0.94
BLS verifyMultipleSignatures 32 - blst-native 19.779 ms/op 20.766 ms/op 0.95
BLS aggregatePubkeys 32 - blst-native 26.228 us/op 27.811 us/op 0.94
BLS aggregatePubkeys 128 - blst-native 101.88 us/op 107.41 us/op 0.95
getAttestationsForBlock 68.544 ms/op 72.310 ms/op 0.95
isKnown best case - 1 super set check 263.00 ns/op 281.00 ns/op 0.94
isKnown normal case - 2 super set checks 264.00 ns/op 277.00 ns/op 0.95
isKnown worse case - 16 super set checks 273.00 ns/op 275.00 ns/op 0.99
CheckpointStateCache - add get delete 6.4600 us/op 6.0650 us/op 1.07
validate gossip signedAggregateAndProof - struct 2.8712 ms/op 2.9474 ms/op 0.97
validate gossip attestation - struct 1.4364 ms/op 1.3884 ms/op 1.03
pickEth1Vote - no votes 1.4758 ms/op 1.4234 ms/op 1.04
pickEth1Vote - max votes 14.988 ms/op 12.097 ms/op 1.24
pickEth1Vote - Eth1Data hashTreeRoot value x2048 10.861 ms/op 10.259 ms/op 1.06
pickEth1Vote - Eth1Data hashTreeRoot tree x2048 15.887 ms/op 19.529 ms/op 0.81
pickEth1Vote - Eth1Data fastSerialize value x2048 794.20 us/op 807.13 us/op 0.98
pickEth1Vote - Eth1Data fastSerialize tree x2048 11.154 ms/op 6.8405 ms/op 1.63
bytes32 toHexString 775.00 ns/op 622.00 ns/op 1.25
bytes32 Buffer.toString(hex) 445.00 ns/op 454.00 ns/op 0.98
bytes32 Buffer.toString(hex) from Uint8Array 632.00 ns/op 669.00 ns/op 0.94
bytes32 Buffer.toString(hex) + 0x 439.00 ns/op 448.00 ns/op 0.98
Object access 1 prop 0.19400 ns/op 0.20200 ns/op 0.96
Map access 1 prop 0.16500 ns/op 0.19600 ns/op 0.84
Object get x1000 6.8650 ns/op 9.7890 ns/op 0.70
Map get x1000 0.66700 ns/op 0.71100 ns/op 0.94
Object set x1000 62.975 ns/op 77.106 ns/op 0.82
Map set x1000 45.830 ns/op 58.241 ns/op 0.79
Return object 10000 times 0.24680 ns/op 0.28010 ns/op 0.88
Throw Error 10000 times 4.6942 us/op 4.6199 us/op 1.02
fastMsgIdFn sha256 / 200 bytes 3.5550 us/op 3.6590 us/op 0.97
fastMsgIdFn h32 xxhash / 200 bytes 317.00 ns/op 329.00 ns/op 0.96
fastMsgIdFn h64 xxhash / 200 bytes 490.00 ns/op 504.00 ns/op 0.97
fastMsgIdFn sha256 / 1000 bytes 11.772 us/op 12.339 us/op 0.95
fastMsgIdFn h32 xxhash / 1000 bytes 446.00 ns/op 465.00 ns/op 0.96
fastMsgIdFn h64 xxhash / 1000 bytes 552.00 ns/op 552.00 ns/op 1.00
fastMsgIdFn sha256 / 10000 bytes 104.42 us/op 108.36 us/op 0.96
fastMsgIdFn h32 xxhash / 10000 bytes 1.9680 us/op 2.0750 us/op 0.95
fastMsgIdFn h64 xxhash / 10000 bytes 1.3450 us/op 1.5170 us/op 0.89
enrSubnets - fastDeserialize 64 bits 1.3500 us/op 1.9060 us/op 0.71
enrSubnets - ssz BitVector 64 bits 583.00 ns/op 640.00 ns/op 0.91
enrSubnets - fastDeserialize 4 bits 207.00 ns/op 217.00 ns/op 0.95
enrSubnets - ssz BitVector 4 bits 596.00 ns/op 644.00 ns/op 0.93
prioritizePeers score -10:0 att 32-0.1 sync 2-0 120.05 us/op 126.30 us/op 0.95
prioritizePeers score 0:0 att 32-0.25 sync 2-0.25 155.09 us/op 164.16 us/op 0.94
prioritizePeers score 0:0 att 32-0.5 sync 2-0.5 182.38 us/op 203.57 us/op 0.90
prioritizePeers score 0:0 att 64-0.75 sync 4-0.75 313.15 us/op 422.18 us/op 0.74
prioritizePeers score 0:0 att 64-1 sync 4-1 371.69 us/op 476.65 us/op 0.78
array of 16000 items push then shift 1.6439 us/op 1.8248 us/op 0.90
LinkedList of 16000 items push then shift 8.9010 ns/op 9.8000 ns/op 0.91
array of 16000 items push then pop 113.15 ns/op 128.40 ns/op 0.88
LinkedList of 16000 items push then pop 8.9360 ns/op 9.6050 ns/op 0.93
array of 24000 items push then shift 2.5594 us/op 2.5691 us/op 1.00
LinkedList of 24000 items push then shift 9.8500 ns/op 10.657 ns/op 0.92
array of 24000 items push then pop 94.651 ns/op 102.38 ns/op 0.92
LinkedList of 24000 items push then pop 9.5430 ns/op 9.9410 ns/op 0.96
intersect bitArray bitLen 8 15.113 ns/op 14.109 ns/op 1.07
intersect array and set length 8 106.22 ns/op 124.16 ns/op 0.86
intersect bitArray bitLen 128 46.203 ns/op 48.119 ns/op 0.96
intersect array and set length 128 1.2730 us/op 1.4042 us/op 0.91
Buffer.concat 32 items 3.8080 us/op 3.3310 us/op 1.14
Uint8Array.set 32 items 3.1880 us/op 3.2690 us/op 0.98
transfer serialized Status (84 B) 2.2680 us/op 2.3670 us/op 0.96
copy serialized Status (84 B) 1.8190 us/op 1.8590 us/op 0.98
transfer serialized SignedVoluntaryExit (112 B) 2.3820 us/op 2.3580 us/op 1.01
copy serialized SignedVoluntaryExit (112 B) 1.9610 us/op 1.8390 us/op 1.07
transfer serialized ProposerSlashing (416 B) 2.5810 us/op 2.6480 us/op 0.97
copy serialized ProposerSlashing (416 B) 2.0480 us/op 2.7390 us/op 0.75
transfer serialized Attestation (485 B) 2.7250 us/op 2.7140 us/op 1.00
copy serialized Attestation (485 B) 2.2520 us/op 2.7310 us/op 0.82
transfer serialized AttesterSlashing (33232 B) 2.6510 us/op 2.9150 us/op 0.91
copy serialized AttesterSlashing (33232 B) 5.8370 us/op 10.358 us/op 0.56
transfer serialized Small SignedBeaconBlock (128000 B) 3.0350 us/op 3.6780 us/op 0.83
copy serialized Small SignedBeaconBlock (128000 B) 41.986 us/op 58.115 us/op 0.72
transfer serialized Avg SignedBeaconBlock (200000 B) 3.1700 us/op 4.1850 us/op 0.76
copy serialized Avg SignedBeaconBlock (200000 B) 22.861 us/op 30.531 us/op 0.75
transfer serialized BlobsSidecar (524380 B) 3.4300 us/op 3.8860 us/op 0.88
copy serialized BlobsSidecar (524380 B) 189.23 us/op 90.296 us/op 2.10
transfer serialized Big SignedBeaconBlock (1000000 B) 3.3920 us/op 3.6870 us/op 0.92
copy serialized Big SignedBeaconBlock (1000000 B) 248.86 us/op 354.16 us/op 0.70
pass gossip attestations to forkchoice per slot 2.3399 ms/op 2.6050 ms/op 0.90
computeDeltas 3.0885 ms/op 3.4071 ms/op 0.91
computeProposerBoostScoreFromBalances 1.8101 ms/op 1.8987 ms/op 0.95
altair processAttestation - 250000 vs - 7PWei normalcase 2.3197 ms/op 2.7916 ms/op 0.83
altair processAttestation - 250000 vs - 7PWei worstcase 3.6280 ms/op 4.6365 ms/op 0.78
altair processAttestation - setStatus - 1/6 committees join 140.32 us/op 153.71 us/op 0.91
altair processAttestation - setStatus - 1/3 committees join 281.08 us/op 315.81 us/op 0.89
altair processAttestation - setStatus - 1/2 committees join 368.67 us/op 391.90 us/op 0.94
altair processAttestation - setStatus - 2/3 committees join 453.82 us/op 487.92 us/op 0.93
altair processAttestation - setStatus - 4/5 committees join 660.24 us/op 689.07 us/op 0.96
altair processAttestation - setStatus - 100% committees join 759.50 us/op 816.14 us/op 0.93
altair processBlock - 250000 vs - 7PWei normalcase 18.892 ms/op 18.911 ms/op 1.00
altair processBlock - 250000 vs - 7PWei normalcase hashState 27.524 ms/op 30.878 ms/op 0.89
altair processBlock - 250000 vs - 7PWei worstcase 52.531 ms/op 58.007 ms/op 0.91
altair processBlock - 250000 vs - 7PWei worstcase hashState 71.054 ms/op 83.011 ms/op 0.86
phase0 processBlock - 250000 vs - 7PWei normalcase 1.9941 ms/op 2.3165 ms/op 0.86
phase0 processBlock - 250000 vs - 7PWei worstcase 29.699 ms/op 32.109 ms/op 0.92
altair processEth1Data - 250000 vs - 7PWei normalcase 475.13 us/op 610.89 us/op 0.78
getExpectedWithdrawals 250000 eb:1,eth1:1,we:0,wn:0,smpl:15 8.0810 us/op 10.458 us/op 0.77
getExpectedWithdrawals 250000 eb:0.95,eth1:0.1,we:0.05,wn:0,smpl:219 26.891 us/op 36.086 us/op 0.75
getExpectedWithdrawals 250000 eb:0.95,eth1:0.3,we:0.05,wn:0,smpl:42 11.540 us/op 13.637 us/op 0.85
getExpectedWithdrawals 250000 eb:0.95,eth1:0.7,we:0.05,wn:0,smpl:18 8.0930 us/op 8.8310 us/op 0.92
getExpectedWithdrawals 250000 eb:0.1,eth1:0.1,we:0,wn:0,smpl:1020 97.005 us/op 113.48 us/op 0.85
getExpectedWithdrawals 250000 eb:0.03,eth1:0.03,we:0,wn:0,smpl:11777 647.08 us/op 689.34 us/op 0.94
getExpectedWithdrawals 250000 eb:0.01,eth1:0.01,we:0,wn:0,smpl:16384 915.55 us/op 930.77 us/op 0.98
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,smpl:16384 873.05 us/op 934.30 us/op 0.93
getExpectedWithdrawals 250000 eb:0,eth1:0,we:0,wn:0,nocache,smpl:16384 2.2929 ms/op 2.4540 ms/op 0.93
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,smpl:16384 1.7584 ms/op 1.8628 ms/op 0.94
getExpectedWithdrawals 250000 eb:0,eth1:1,we:0,wn:0,nocache,smpl:16384 3.9325 ms/op 4.3672 ms/op 0.90
Tree 40 250000 create 339.00 ms/op 358.55 ms/op 0.95
Tree 40 250000 get(125000) 192.27 ns/op 198.81 ns/op 0.97
Tree 40 250000 set(125000) 1.0044 us/op 1.2189 us/op 0.82
Tree 40 250000 toArray() 20.213 ms/op 23.206 ms/op 0.87
Tree 40 250000 iterate all - toArray() + loop 20.628 ms/op 23.265 ms/op 0.89
Tree 40 250000 iterate all - get(i) 69.862 ms/op 78.552 ms/op 0.89
MutableVector 250000 create 11.811 ms/op 12.265 ms/op 0.96
MutableVector 250000 get(125000) 6.3370 ns/op 6.5730 ns/op 0.96
MutableVector 250000 set(125000) 262.39 ns/op 322.41 ns/op 0.81
MutableVector 250000 toArray() 2.9610 ms/op 3.8001 ms/op 0.78
MutableVector 250000 iterate all - toArray() + loop 3.0537 ms/op 4.0729 ms/op 0.75
MutableVector 250000 iterate all - get(i) 1.5395 ms/op 1.5826 ms/op 0.97
Array 250000 create 3.2246 ms/op 3.9190 ms/op 0.82
Array 250000 clone - spread 1.2187 ms/op 1.1530 ms/op 1.06
Array 250000 get(125000) 0.59300 ns/op 0.58700 ns/op 1.01
Array 250000 set(125000) 0.64800 ns/op 0.63800 ns/op 1.02
Array 250000 iterate all - loop 83.936 us/op 84.579 us/op 0.99
effectiveBalanceIncrements clone Uint8Array 300000 44.088 us/op 39.672 us/op 1.11
effectiveBalanceIncrements clone MutableVector 300000 375.00 ns/op 336.00 ns/op 1.12
effectiveBalanceIncrements rw all Uint8Array 300000 168.55 us/op 171.40 us/op 0.98
effectiveBalanceIncrements rw all MutableVector 300000 94.742 ms/op 84.757 ms/op 1.12
phase0 afterProcessEpoch - 250000 vs - 7PWei 123.36 ms/op 117.37 ms/op 1.05
phase0 beforeProcessEpoch - 250000 vs - 7PWei 43.025 ms/op 44.826 ms/op 0.96
altair processEpoch - mainnet_e81889 337.00 ms/op 352.39 ms/op 0.96
mainnet_e81889 - altair beforeProcessEpoch 67.647 ms/op 78.095 ms/op 0.87
mainnet_e81889 - altair processJustificationAndFinalization 18.840 us/op 20.276 us/op 0.93
mainnet_e81889 - altair processInactivityUpdates 6.6355 ms/op 8.4725 ms/op 0.78
mainnet_e81889 - altair processRewardsAndPenalties 65.546 ms/op 68.986 ms/op 0.95
mainnet_e81889 - altair processRegistryUpdates 2.8580 us/op 4.2640 us/op 0.67
mainnet_e81889 - altair processSlashings 488.00 ns/op 792.00 ns/op 0.62
mainnet_e81889 - altair processEth1DataReset 514.00 ns/op 768.00 ns/op 0.67
mainnet_e81889 - altair processEffectiveBalanceUpdates 1.2492 ms/op 1.3580 ms/op 0.92
mainnet_e81889 - altair processSlashingsReset 5.0920 us/op 7.8530 us/op 0.65
mainnet_e81889 - altair processRandaoMixesReset 9.3050 us/op 8.8540 us/op 1.05
mainnet_e81889 - altair processHistoricalRootsUpdate 1.6760 us/op 1.9400 us/op 0.86
mainnet_e81889 - altair processParticipationFlagUpdates 5.3970 us/op 5.4760 us/op 0.99
mainnet_e81889 - altair processSyncCommitteeUpdates 452.00 ns/op 1.4160 us/op 0.32
mainnet_e81889 - altair afterProcessEpoch 119.01 ms/op 157.47 ms/op 0.76
phase0 processEpoch - mainnet_e58758 321.02 ms/op 447.90 ms/op 0.72
mainnet_e58758 - phase0 beforeProcessEpoch 116.42 ms/op 170.83 ms/op 0.68
mainnet_e58758 - phase0 processJustificationAndFinalization 15.345 us/op 25.315 us/op 0.61
mainnet_e58758 - phase0 processRewardsAndPenalties 50.141 ms/op 73.268 ms/op 0.68
mainnet_e58758 - phase0 processRegistryUpdates 7.4210 us/op 13.424 us/op 0.55
mainnet_e58758 - phase0 processSlashings 527.00 ns/op 957.00 ns/op 0.55
mainnet_e58758 - phase0 processEth1DataReset 520.00 ns/op 1.2930 us/op 0.40
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 950.81 us/op 1.6842 ms/op 0.56
mainnet_e58758 - phase0 processSlashingsReset 3.0400 us/op 6.6130 us/op 0.46
mainnet_e58758 - phase0 processRandaoMixesReset 4.2190 us/op 7.6050 us/op 0.55
mainnet_e58758 - phase0 processHistoricalRootsUpdate 568.00 ns/op 2.4710 us/op 0.23
mainnet_e58758 - phase0 processParticipationRecordUpdates 4.7410 us/op 12.378 us/op 0.38
mainnet_e58758 - phase0 afterProcessEpoch 99.439 ms/op 110.47 ms/op 0.90
phase0 processEffectiveBalanceUpdates - 250000 normalcase 1.2343 ms/op 1.4184 ms/op 0.87
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 1.4081 ms/op 2.1725 ms/op 0.65
altair processInactivityUpdates - 250000 normalcase 20.312 ms/op 28.880 ms/op 0.70
altair processInactivityUpdates - 250000 worstcase 22.478 ms/op 33.154 ms/op 0.68
phase0 processRegistryUpdates - 250000 normalcase 6.1830 us/op 10.334 us/op 0.60
phase0 processRegistryUpdates - 250000 badcase_full_deposits 322.32 us/op 327.33 us/op 0.98
phase0 processRegistryUpdates - 250000 worstcase 0.5 131.46 ms/op 156.62 ms/op 0.84
altair processRewardsAndPenalties - 250000 normalcase 55.148 ms/op 71.498 ms/op 0.77
altair processRewardsAndPenalties - 250000 worstcase 50.744 ms/op 75.098 ms/op 0.68
phase0 getAttestationDeltas - 250000 normalcase 7.2574 ms/op 8.3123 ms/op 0.87
phase0 getAttestationDeltas - 250000 worstcase 7.5054 ms/op 8.7910 ms/op 0.85
phase0 processSlashings - 250000 worstcase 3.6994 ms/op 3.9353 ms/op 0.94
altair processSyncCommitteeUpdates - 250000 187.31 ms/op 198.52 ms/op 0.94
BeaconState.hashTreeRoot - No change 303.00 ns/op 295.00 ns/op 1.03
BeaconState.hashTreeRoot - 1 full validator 54.642 us/op 57.137 us/op 0.96
BeaconState.hashTreeRoot - 32 full validator 582.59 us/op 604.25 us/op 0.96
BeaconState.hashTreeRoot - 512 full validator 5.0226 ms/op 5.3199 ms/op 0.94
BeaconState.hashTreeRoot - 1 validator.effectiveBalance 67.047 us/op 71.713 us/op 0.93
BeaconState.hashTreeRoot - 32 validator.effectiveBalance 944.66 us/op 1.0170 ms/op 0.93
BeaconState.hashTreeRoot - 512 validator.effectiveBalance 12.699 ms/op 15.330 ms/op 0.83
BeaconState.hashTreeRoot - 1 balances 52.234 us/op 64.946 us/op 0.80
BeaconState.hashTreeRoot - 32 balances 474.33 us/op 593.75 us/op 0.80
BeaconState.hashTreeRoot - 512 balances 4.4674 ms/op 5.9420 ms/op 0.75
BeaconState.hashTreeRoot - 250000 balances 77.481 ms/op 92.608 ms/op 0.84
aggregationBits - 2048 els - zipIndexesInBitList 16.519 us/op 35.411 us/op 0.47
regular array get 100000 times 33.249 us/op 50.660 us/op 0.66
wrappedArray get 100000 times 33.421 us/op 56.842 us/op 0.59
arrayWithProxy get 100000 times 16.361 ms/op 20.718 ms/op 0.79
ssz.Root.equals 571.00 ns/op 662.00 ns/op 0.86
byteArrayEquals 560.00 ns/op 604.00 ns/op 0.93
shuffle list - 16384 els 6.9849 ms/op 7.2725 ms/op 0.96
shuffle list - 250000 els 102.11 ms/op 107.38 ms/op 0.95
processSlot - 1 slots 9.6780 us/op 9.6450 us/op 1.00
processSlot - 32 slots 1.3581 ms/op 1.4927 ms/op 0.91
getEffectiveBalanceIncrementsZeroInactive - 250000 vs - 7PWei 32.204 ms/op 38.239 ms/op 0.84
getCommitteeAssignments - req 1 vs - 250000 vc 2.9457 ms/op 2.9939 ms/op 0.98
getCommitteeAssignments - req 100 vs - 250000 vc 4.1094 ms/op 4.2489 ms/op 0.97
getCommitteeAssignments - req 1000 vs - 250000 vc 4.6380 ms/op 4.6231 ms/op 1.00
RootCache.getBlockRootAtSlot - 250000 vs - 7PWei 4.8500 ns/op 5.1700 ns/op 0.94
state getBlockRootAtSlot - 250000 vs - 7PWei 593.22 ns/op 934.19 ns/op 0.64
computeProposers - vc 250000 10.404 ms/op 12.095 ms/op 0.86
computeEpochShuffling - vc 250000 105.69 ms/op 108.28 ms/op 0.98
getNextSyncCommittee - vc 250000 173.94 ms/op 189.20 ms/op 0.92
computeSigningRoot for AttestationData 13.852 us/op 14.154 us/op 0.98
hash AttestationData serialized data then Buffer.toString(base64) 2.4845 us/op 2.6071 us/op 0.95
toHexString serialized data 1.1445 us/op 1.2656 us/op 0.90
Buffer.toString(base64) 347.89 ns/op 372.89 ns/op 0.93

by benchmarkbot/action

@wemeetagain wemeetagain merged commit d79b869 into unstable May 30, 2023
@wemeetagain wemeetagain deleted the dapplion/http-metrics-close branch May 30, 2023 16:44
@wemeetagain
Copy link
Member

🎉 This PR is included in v1.9.0 🎉

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.

2 participants