Any way to optimize the memory usage of Era? #842
-
Team or ProjectNo response Module Affected
Rust Versionnightly-2024-08-01 Operating System
Issue DescriptionWe are running the external nodes for Era, seems the external node consumes lots of memory (>30GB), is there a way to optimize the memory usage of the external node. We have external node for cronos zkevm, zklink and the Zero chain too, these chains cost 4-8GB memory, so could we have a technical answer where does the >30GB memory consumes in Era? Expected Behaviorthe external node cost much less memory Current Behaviorthe external node cost >30GB memory Repository Link (if applicable)No response Additional DetailsNo response Prior Research
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
The high memory usage of the ZKsync Era external node, often exceeding 30GB, is primarily due to the complex operations and data structures required to support the zkEVM and its associated functionalities. Unlike simpler EVM-based chains, ZKsync Era's architecture involves more intensive computation and state management to ensure the security and efficiency of zero-knowledge proofs. Here are a few technical insights into why ZKsync Era nodes may require more memory:
Currently, there isn't a documented method to significantly reduce the memory usage without potentially compromising performance or security. However, you can ensure that your node is running on an optimized configuration and that unnecessary services or processes are disabled to minimize memory usage. For more detailed technical support and potential optimizations, you might want to engage directly with the ZKsync developers community on GitHub discussions. They could provide more specific advice or updates on memory optimization efforts. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for submitting this question! I'll try to figure that out and get back to you asap. |
Beta Was this translation helpful? Give feedback.
-
The high memory usage (>30GB) for Era external nodes is primarily due to the Merkle tree. Specifically, a significant amount of RAM is consumed by indexes and Bloom filters for RocksDB, which are loaded into memory at node startup and pinned there by default. To optimize memory usage, you can configure the following parameters:
These settings can be applied via environment variables or file-based configurations, depending on your setup. You can refer to the relevant configuration code here. Additional optimizations:
Note: These recommendations are based on profiling conducted ~6 months ago, so results may vary slightly depending on the current state of the software. |
Beta Was this translation helpful? Give feedback.
@windycrypto
The high memory usage (>30GB) for Era external nodes is primarily due to the Merkle tree. Specifically, a significant amount of RAM is consumed by indexes and Bloom filters for RocksDB, which are loaded into memory at node startup and pinned there by default.
To optimize memory usage, you can configure the following parameters:
merkle_tree_block_cache_size_mb
: Set this to at least 4GB.merkle_tree_include_indices_and_filters_in_block_cache
: Set this totrue
.These settings can be applied via environment variables or file-based configurations, depending on your setup. You can refer to the relevant configuration code here.
Additional optimizations: