[Ethereum] How to do a fast geth sync without consuming too much memory

go-ethereumsynchronization

My problem is this. The recommended advice in order for geth to run a faster initial sync is to use the option --fast plus a non-default value for the option --cache. The option --cache appears to be necessary if you want the fast sync to progress beyond a few percent of the total block sync. For example, a "mere" value of --cache=512 allows geth to fast sync about half of the now over a million ethereum blocks before going down to regular sync, while --cache=768 leads to a fast sync of 700,000 blocks, suggesting a rough ratio of 1 MB RAM per fast sync'd block.

As regular sync is superslow, I'd like the fast sync to progress past the million-block mark. Unfortunately, a value of --cache=1024 leads to an out-of-memory crash. Is there a way to do a fast initial sync without geth consuming gobs of memory?

Best Answer

--cache N is exactly as it sounds. It throws N megabytes right into RAM instead of directly to the disk. The only way to avoid an out of memory error is to free up memory on your machine.

So basically, kill all other programs you have no use for or install more system memory.

Related Topic