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

Fix OOM issue in processRegistryUpdates #3025

Merged
merged 1 commit into from
Aug 26, 2021
Merged

Fix OOM issue in processRegistryUpdates #3025

merged 1 commit into from
Aug 26, 2021

Conversation

dapplion
Copy link
Contributor

Motivation

WeakRef keeps a strong reference to its constructor value until the event loop ticks. Without this sleep(0) all the SubTree(s) created updating the validators registry won't be garabage collected causing an OOM crash. Tracking issue nodejs/node#39902

Description

Yield to the event loop on every benchmark fn() run

@codeclimate
Copy link

codeclimate bot commented Aug 26, 2021

Code Climate has analyzed commit 64481d5 and detected 0 issues on this pull request.

View more on Code Climate.

@github-actions
Copy link
Contributor

Performance Report

✔️ no performance regression detected

Full benchmark results
Benchmark suite Current: 5309583 Previous: 545b2e5 Ratio
state hashTreeRoot - No change 887.00 ns/op 758.00 ns/op 1.17
state hashTreeRoot - 1 full validator 827.00 ns/op 795.00 ns/op 1.04
state hashTreeRoot - 32 full validator 834.00 ns/op 804.00 ns/op 1.04
state hashTreeRoot - 512 full validator 838.00 ns/op 735.00 ns/op 1.14
state hashTreeRoot - 1 validator.effectiveBalance 860.00 ns/op 805.00 ns/op 1.07
state hashTreeRoot - 32 validator.effectiveBalance 858.00 ns/op 819.00 ns/op 1.05
state hashTreeRoot - 512 validator.effectiveBalance 863.00 ns/op 834.00 ns/op 1.03
state hashTreeRoot - 1 balances 878.00 ns/op 839.00 ns/op 1.05
state hashTreeRoot - 32 balances 850.00 ns/op 883.00 ns/op 0.96
state hashTreeRoot - 512 balances 837.00 ns/op 853.00 ns/op 0.98
state hashTreeRoot - 250000 balances 834.00 ns/op 838.00 ns/op 1.00
processSlot - 1 slots 62.578 us/op 70.952 us/op 0.88
processSlot - 32 slots 3.0190 ms/op 3.5282 ms/op 0.86
getCommitteeAssignments - req 1 vs - 250000 vc 6.1314 ms/op 5.3444 ms/op 1.15
getCommitteeAssignments - req 100 vs - 250000 vc 8.4822 ms/op 7.5623 ms/op 1.12
getCommitteeAssignments - req 1000 vs - 250000 vc 8.9545 ms/op 8.0795 ms/op 1.11
altair processBlock - 250000 vs - 7PWei normalcase 101.69 ms/op 106.03 ms/op 0.96
altair processBlock - 250000 vs - 7PWei worstcase 264.62 ms/op 295.33 ms/op 0.90
altair processEpoch - pyrmont_e62330 784.02 ms/op 744.88 ms/op 1.05
pyrmont_e62330 - altair beforeProcessEpoch 79.179 ms/op 125.48 ms/op 0.63
pyrmont_e62330 - altair processJustificationAndFinalization 124.55 us/op 156.39 us/op 0.80
pyrmont_e62330 - altair processInactivityUpdates 80.276 ms/op 79.958 ms/op 1.00
pyrmont_e62330 - altair processRewardsAndPenalties 179.55 ms/op 158.60 ms/op 1.13
pyrmont_e62330 - altair processRegistryUpdates 10.104 us/op 7.4640 us/op 1.35
pyrmont_e62330 - altair processSlashings 704.00 ns/op 1.3870 us/op 0.51
pyrmont_e62330 - altair processEth1DataReset 719.00 ns/op 797.00 ns/op 0.90
pyrmont_e62330 - altair processEffectiveBalanceUpdates 19.367 ms/op 18.125 ms/op 1.07
pyrmont_e62330 - altair processSlashingsReset 12.357 us/op 14.599 us/op 0.85
pyrmont_e62330 - altair processRandaoMixesReset 20.237 us/op 40.189 us/op 0.50
pyrmont_e62330 - altair processHistoricalRootsUpdate 987.00 ns/op 1.0150 us/op 0.97
pyrmont_e62330 - altair processParticipationFlagUpdates 56.316 ms/op 53.134 ms/op 1.06
pyrmont_e62330 - altair processSyncCommitteeUpdates 950.00 ns/op 813.00 ns/op 1.17
pyrmont_e62330 - altair afterProcessEpoch 222.93 ms/op 211.85 ms/op 1.05
altair processInactivityUpdates - 250000 normalcase 329.23 ms/op 307.14 ms/op 1.07
altair processInactivityUpdates - 250000 worstcase 323.22 ms/op 304.83 ms/op 1.06
altair processParticipationFlagUpdates - 250000 anycase 101.79 ms/op 112.09 ms/op 0.91
altair processRewardsAndPenalties - 250000 normalcase 335.47 ms/op 293.24 ms/op 1.14
altair processRewardsAndPenalties - 250000 worstcase 399.42 ms/op 354.39 ms/op 1.13
altair processSyncCommitteeUpdates - 250000 464.00 ms/op 473.16 ms/op 0.98
Tree 40 250000 create 679.72 ms/op 732.72 ms/op 0.93
Tree 40 250000 get(125000) 1.4892 us/op 1.5913 us/op 0.94
Tree 40 250000 set(125000) 1.6576 us/op 1.7636 us/op 0.94
Tree 40 250000 toArray() 43.081 ms/op 44.695 ms/op 0.96
Tree 40 250000 iterate all - toArray() + loop 43.246 ms/op 43.274 ms/op 1.00
Tree 40 250000 iterate all - get(i) 440.09 ms/op 445.48 ms/op 0.99
MutableVector 250000 create 25.462 ms/op 25.436 ms/op 1.00
MutableVector 250000 get(125000) 16.843 ns/op 14.828 ns/op 1.14
MutableVector 250000 set(125000) 4.2743 us/op 4.0177 us/op 1.06
MutableVector 250000 toArray() 10.079 ms/op 9.9162 ms/op 1.02
MutableVector 250000 iterate all - toArray() + loop 10.428 ms/op 8.3941 ms/op 1.24
MutableVector 250000 iterate all - get(i) 4.8356 ms/op 3.7675 ms/op 1.28
Array 250000 create 6.7501 ms/op 5.5920 ms/op 1.21
Array 250000 clone - spread 3.2296 ms/op 2.4201 ms/op 1.33
Array 250000 get(125000) 1.3210 ns/op 0.81700 ns/op 1.62
Array 250000 set(125000) 1.3200 ns/op 0.91000 ns/op 1.45
Array 250000 iterate all - loop 193.89 us/op 142.30 us/op 1.36
aggregationBits - 2048 els - readonlyValues 355.44 us/op 282.40 us/op 1.26
aggregationBits - 2048 els - zipIndexesInBitList 34.686 us/op 36.648 us/op 0.95
ssz.Root.equals 1.9060 us/op 1.4220 us/op 1.34
ssz.Root.equals with valueOf() 2.4190 us/op 1.7250 us/op 1.40
byteArrayEquals with valueOf() 2.5790 us/op 1.7260 us/op 1.49
phase0 processBlock - 250000 vs - 7PWei normalcase 17.760 ms/op 18.266 ms/op 0.97
phase0 processBlock - 250000 vs - 7PWei worstcase 106.44 ms/op 121.43 ms/op 0.88
phase0 afterProcessEpoch - 250000 vs - 7PWei 280.85 ms/op 225.05 ms/op 1.25
phase0 beforeProcessEpoch - 250000 vs - 7PWei 785.88 ms/op 888.57 ms/op 0.88
phase0 processEpoch - mainnet_e58758 1.2058 s/op 1.2346 s/op 0.98
mainnet_e58758 - phase0 beforeProcessEpoch 625.85 ms/op 687.55 ms/op 0.91
mainnet_e58758 - phase0 processJustificationAndFinalization 120.59 us/op 138.77 us/op 0.87
mainnet_e58758 - phase0 processRewardsAndPenalties 293.03 ms/op 273.91 ms/op 1.07
mainnet_e58758 - phase0 processRegistryUpdates 103.10 us/op 119.19 us/op 0.86
mainnet_e58758 - phase0 processSlashings 959.00 ns/op 1.2500 us/op 0.77
mainnet_e58758 - phase0 processEth1DataReset 742.00 ns/op 778.00 ns/op 0.95
mainnet_e58758 - phase0 processEffectiveBalanceUpdates 31.451 ms/op 29.728 ms/op 1.06
mainnet_e58758 - phase0 processSlashingsReset 24.152 us/op 19.972 us/op 1.21
mainnet_e58758 - phase0 processRandaoMixesReset 21.281 us/op 24.665 us/op 0.86
mainnet_e58758 - phase0 processHistoricalRootsUpdate 815.00 ns/op 1.0230 us/op 0.80
mainnet_e58758 - phase0 processParticipationRecordUpdates 26.769 us/op 15.121 us/op 1.77
mainnet_e58758 - phase0 afterProcessEpoch 223.42 ms/op 202.35 ms/op 1.10
phase0 processEffectiveBalanceUpdates - 250000 normalcase 47.094 ms/op 41.276 ms/op 1.14
phase0 processEffectiveBalanceUpdates - 250000 worstcase 0.5 6.5750 s/op 6.7862 s/op 0.97
phase0 processRegistryUpdates - 250000 normalcase 108.05 us/op 682.95 us/op 0.16
phase0 processRegistryUpdates - 250000 badcase_full_deposits 7.7947 ms/op 11.754 ms/op 0.66
phase0 processRegistryUpdates - 250000 worstcase 0.5 3.4817 s/op 6.5816 s/op 0.53
phase0 getAttestationDeltas - 250000 normalcase 57.036 ms/op 101.60 ms/op 0.56
phase0 getAttestationDeltas - 250000 worstcase 57.297 ms/op 50.668 ms/op 1.13
phase0 processSlashings - 250000 worstcase 7.3720 us/op 9.4140 us/op 0.78
shuffle list - 16384 els 15.275 ms/op 13.907 ms/op 1.10
shuffle list - 250000 els 219.94 ms/op 204.23 ms/op 1.08
getPubkeys - index2pubkey - req 1000 vs - 250000 vc 2.8106 ms/op 2.5697 ms/op 1.09
getPubkeys - validatorsArr - req 1000 vs - 250000 vc 503.19 us/op 494.87 us/op 1.02
getPubkeys - persistent - req 1000 vs - 250000 vc 21.459 us/op 17.358 us/op 1.24
BLS verify - blst-native 2.2099 ms/op 2.5237 ms/op 0.88
BLS verifyMultipleSignatures 3 - blst-native 4.5061 ms/op 5.0696 ms/op 0.89
BLS verifyMultipleSignatures 8 - blst-native 9.7960 ms/op 11.015 ms/op 0.89
BLS verifyMultipleSignatures 32 - blst-native 35.416 ms/op 41.402 ms/op 0.86
BLS aggregatePubkeys 32 - blst-native 47.136 us/op 57.202 us/op 0.82
BLS aggregatePubkeys 128 - blst-native 185.44 us/op 211.81 us/op 0.88
getAttestationsForBlock 92.548 ms/op 95.533 ms/op 0.97
CheckpointStateCache - add get delete 24.844 us/op 27.121 us/op 0.92
validate gossip signedAggregateAndProof - struct 5.2970 ms/op 6.0407 ms/op 0.88
validate gossip signedAggregateAndProof - treeBacked 5.2657 ms/op 5.8381 ms/op 0.90
validate gossip attestation - struct 2.4660 ms/op 2.7625 ms/op 0.89
validate gossip attestation - treeBacked 2.4464 ms/op 3.0366 ms/op 0.81

by benchmarkbot/action

@dapplion dapplion merged commit 9fb1c42 into master Aug 26, 2021
@dapplion dapplion deleted the dapplion/perf-oom branch August 26, 2021 19:52
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.

1 participant