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

Optimize atree to reduce Flow's mtrie size and reduce number of reads #292

Closed
Tracked by #1744
fxamacker opened this issue Mar 3, 2023 · 2 comments
Closed
Tracked by #1744
Assignees
Labels
E&V Team Execution / Verification / Edge Team enhancement New feature or request Epic

Comments

@fxamacker
Copy link
Member

fxamacker commented Mar 3, 2023

Issue To Be Solved

We should make Execution Nodes use less memory without sacrificing performance. Also, given the same user data growth rate, we should reduce the rate of Execution Node system requirements growth.

Suggested Solution and Implementation

Solution requires changes to onflow/atree, onflow/cadence, onflow/flow-go, and data migration.

See also:

Atree Inlining & Deduplication

Before/After Comparison Using Aug 14, 2024 Devnet State

Mtrie Nodes and Atree Payloads Atree Payload Sizes (bytes)

Total Counts

Before After Change
mtrie nodes 1,182,195,945 343,949,052 -838,246,893
atree payloads 455,399,623 102,283,931 -353,115,692

Total Sizes

Before After Change
mtrie nodes 113.49 GB 33.02 GB -80.47 GB
atree payloads 87.74 GB 69.28 GB -18.46 GB
combined 201.23 GB 102.30 GB -98.93 GB
Before After
count 455,399,623 102,283,931
mean 192.7 677.4
std 996.4 2,065.7
min 13 22
25% 88 199
50% 139 665
75% 206 1,043
99% 876 1,267
99.5% 1,078 1,453
max 5,853,892 5,853,892

Atree inlining and data deduplication on testnet indicates:

  • Reduced memory usage by about 1/2 (on testnet) but results may be more modest on mainnet 👈
  • Block execution speed was also 7% faster according to test results shared by @j1010001
  • Significantly reduced number of payloads
  • Significantly reduced number of nodes (non-payloads)
  • Significantly reduced total combined size of all payloads
  • Reduced data growth rate (given same data)
  • Also expected to benefit other db and software (even if not on EN) if they store/index/cache payloads

NOTE: Impact on testnet and mainnet will differ, depending on actual usage, data, etc.

Impact on memory and storage size

image

image

These charts should probably be updated when time allows.

Impact on payload count and node count

image

image

These charts should probably be updated when time allows.

@fxamacker fxamacker added the enhancement New feature or request label Mar 3, 2023
@fxamacker fxamacker self-assigned this Mar 3, 2023
@fxamacker fxamacker added the Epic label Mar 8, 2023
@fxamacker fxamacker changed the title Optimize atree to reduce Flow's mtrie size Optimize atree to reduce Flow's mtrie size and reduce number of reads Mar 9, 2023
@j1010001 j1010001 added the E&V Team Execution / Verification / Edge Team label Mar 22, 2023
@j1010001
Copy link
Member

j1010001 commented May 23, 2024

Complete TPS throughput test before closing:

Test 1 - non-inlined state

  • Spin up an EN
  • remove exec results for ~100K blocks
  • re-execute blocks on a non-inline state - capture TPS + block exec time

Test 2 - atree-inlined state

  • migrate the state with Atree inlining
  • remove exec results for ~100K blocks
  • re-execute blocks on a atree-inlined state - capture TPS + block exec time

Doc that contains necessary steps: https://www.notion.so/flowfoundation/Execution-Fork-Handbook-a8b70533978c44c5963bc68af99a536d

@fxamacker
Copy link
Member Author

@j1010001 thanks again for providing testnet memory reduction screenshot we can share on GitHub!

Closing this as completed. Please re-open if needed! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E&V Team Execution / Verification / Edge Team enhancement New feature or request Epic
Projects
None yet
Development

No branches or pull requests

2 participants