|
1 | 1 | # Performance Tricks |
2 | 2 |
|
3 | | - |
4 | 3 | These instructions are designed to improve the performance of Erigon 3, particularly for synchronization and memory management, on cloud drives and other systems with specific performance characteristics. |
5 | 4 |
|
6 | | - |
7 | 5 | ## Increase Sync Speed |
8 | 6 |
|
9 | | -* Set `--sync.loop.block.limit=10_000` and `--batchSize=2g` to speed up the synchronization process. |
10 | | -```bash |
11 | | ---sync.loop.block.limit=10_000 --batchSize=2g |
12 | | -``` |
13 | 7 | * Increase download speed with flag ```--torrent.download.rate=[value]``` setting your max speed (default value is 128MB). For example: |
14 | 8 | ```bash |
15 | 9 | --torrent.download.rate=512mb |
16 | 10 | ``` |
17 | 11 |
|
18 | | -## Optimize for Cloud Drives |
19 | | - |
20 | | -* Set `SNAPSHOT_MADV_RND=false` to enable the operating system's cache prefetching for better performance on cloud drives with good throughput but bad latency. |
21 | | -```bash |
22 | | -SNAPSHOT_MADV_RND=false |
23 | | -``` |
24 | | - |
25 | 12 | ## Lock Latest State in RAM |
26 | 13 |
|
27 | | -* Use `vmtouch -vdlw /mnt/erigon/snapshots/domain/*bt` to lock the latest state in RAM, preventing it from being evicted due to high historical RPC traffic. |
| 14 | +* Use `vmtouch -vdlw /mnt/erigon/snapshots/domain/*bt` to lock the "latest state indices" in RAM, preventing it from being evicted due to high historical RPC traffic. |
28 | 15 | ```bash |
29 | 16 | vmtouch -vdlw /mnt/erigon/snapshots/domain/*bt |
30 | 17 | ``` |
31 | 18 |
|
32 | | -* Run `ls /mnt/erigon/snapshots/domain/*.kv | parallel vmtouch -vdlw` to apply the same locking to all relevant files. |
33 | | - |
34 | | -## Handle Memory Allocation Issues |
35 | | - |
36 | | -* If you encounter issues with memory allocation, run the following to flush any pending write operations and free up memory: |
| 19 | +* Or same for "whole latest sate": `ls /mnt/erigon/snapshots/domain/*.kv | parallel vmtouch -vdlw` |
| 20 | +* If you encounter "cannot allocate memory" issues with above commands, then free memory by next command and re-try: |
37 | 21 | ```bash |
38 | | -sync && sudo sysctl vm.drop_caches=3 |
| 22 | +sync && sudo sysctl vm.drop_caches=3 && echo 1 > /proc/sys/vm/compact_memory |
39 | 23 | ``` |
40 | 24 |
|
41 | | -* Alternatively, set: |
| 25 | +## Optimize for Cloud Drives |
42 | 26 |
|
| 27 | +* Cloud Drives (gp3, pd-ssd) have good throughput but bad latency. So, we don't recommend them to Erigon. But still can set `SNAPSHOT_MADV_RND=false` to enable the operating system's cache prefetching - but it will lead to huge IO if RAM is small. |
43 | 28 | ```bash |
44 | | -echo 1 > /proc/sys/vm/compact_memory |
| 29 | +SNAPSHOT_MADV_RND=false |
45 | 30 | ``` |
46 | | - |
47 | | -to help with memory allocation. |
0 commit comments