4

I'm trying to get monerod up and running on a VPS with 1gb of RAM. My understanding is that once the chain is synced, monerod's memory usage should be quite reasonable. However, during the initial blockchain sync process, it is outgrowing the 1gb limit.

A search on here and on reddit turned up a recommendation to use ulimit. However, when I type: ulimit -v 1000000 to constrain the virtual memory to 1gb of RAM, monerod won't even start, complaining that there isn't enough memory to do its initial allocation.

1gb of RAM is supposed to be within the minimal requirements for Monero, so what is the correct way to constrain memory usage?

2
  • The new version, 0.11.0.0, helps a bit with memory usage, but it doesn't totally solve the problem. Even after the blockchain is totally synced, monerod quickly runs afoul of the 1gb RAM limit when a wallet connects to the server that is behind and needs to download several thousand blocks. So the question remains: Is there a way to force monerod to stay within the 1gb RAM limit?
    – puzzler
    Commented Sep 8, 2017 at 5:45
  • maybe you can use cgroups or timeout, mentioned here: unix.stackexchange.com/questions/44985/…
    – ITwrx
    Commented Jan 27, 2018 at 3:20

1 Answer 1

1

During sync, Monero will add chunks of 200 blocks at a time. The speedup gained from this quickly goes into diminishing returns as the chunk size grows, but the memory usage grows linearly, so it's possible to decrease that chunk size with the --block-sync-size N parameter. A plausible value for N is 20 instead of 200, and the speed will be similar (if you're memory starved, it could even be faster since your machine might stop swapping if it was doing so with the defaults).

7
  • I've tried as low as --block-sync-size 1, and it still uses more than 1gb of RAM. Is there any way to force monerod to stay within a certain memory usage?
    – puzzler
    Commented Aug 8, 2017 at 19:49
  • Does it really need it, though ? Monerod mmaps the blockchain, and will use as much RAM as is available, but does not need it per se. If other programs need RAM, that mmaped data will be given to other programs. --block-sync-size will decrease the "really needed" amount, but monerod will still eat up what it can in a reversible way.
    – user36303
    Commented Aug 8, 2017 at 20:54
  • This "use as much RAM as available" is the crux of the problem. In practice, what happens is that it uses more than the 1gb of RAM permitted by my VPS, and then the VPS kills the monerod process. I need some way to communicate to monerod not to use more than 1gb of RAM. One post recommended using ulimit, but when I use ulimit to set the virtual memory to 1gb of RAM, monerod won't even start up, saying it doesn't have enough memory to do its initial allocation. This flies in the face of the claim that 1gb of RAM should be sufficient.
    – puzzler
    Commented Aug 8, 2017 at 23:56
  • Sure, because monerod needs maybe 20 to 40 GB of virtual memory, with the current database.
    – user36303
    Commented Aug 9, 2017 at 8:37
  • So is there something I should be limiting other than "virtual memory" via ulimit or via some other mechanism in order to get monerod to run in 1GB?
    – puzzler
    Commented Aug 9, 2017 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.