That awkward moment when I was able to run three docker containers on a 512MB server:
1. DotNet core web service
2. MySQL
3. OpenVPN

BUT I cannot run:
1. NodeJs web service
2. MongoDB container

Spent two hours configuring the damn server to get hit by this T_T

  • 5
    Node and mongo eat ram a lot :(
  • 4
    @gitcherry They do? D: I've been setting up node and mongodb on 512mb servers for years. Only problem I've had was with npm. I even have an array of bots and Web services on my personal server and mongodb (in a docker container). Maybe I've been doing something wrong?._.
  • 1
    No it is fine but you have to manually limit them and they perform worse. Node by default wants to allocate atleast 2g ram and will crash if gc is not limited by options
  • 1
    I also run a dotnet core application on a debian server, and I was surprised this thing is working with 512 RAM just fine, but there were countless bugs in dotnet core itself I had to fix first (like it crashes only because it detected a deprecated library, bug is still not fixed to this day and it's so old already)
  • 0
    @monkehparade the thing is I still have to run a vue website, so this makes them two node containers I don't think the server will handle them :\
  • 0
    @gitcherry actually after checking mongo took only 100MB or more, which is basically like MySQL but node is the problem here :\
  • 0
    @gitcherry so you're saying I need to configure it to run for less RAM? I took a 2GB server now, but I want to run multiple node containers, will this cause me trouble?
  • 1
    @cave ya those things can be a pain, but tbh I rarely face them, not sure if I'm not going deep like you are or I just happen to be lucky lol
  • 1
    @gitpush you can run as many as you want but node will allocate heap ram and you have to limit the overall alocated heap size with the --max-old-space-size flag. The default is 2g ram and will reash with out of memory exception sooner or later
  • 1
    @gitcherry well I faced same thing with my new server it turned out nodemon is the issue, the service was running but then running out of memory for some reason, switched the start command to use node bundle.js and now all is working flawlessly. Gonna try the setup on the old server and see
  • 1
    @gitpush i have 4 nodejs and a databse running on 1g ram with the old space flag set to 128 or 256. The problem with setting it lower is that the gc will work a little harder. However they work fine almost a year now. Without the flag ram runs out in 2 days
  • 1
    @gitcherry well it is for a personal project, I'll take your notes into consideration but for the meantime I'll use something else on the server and remove that old 512MB one, but its good to know about the flag for future work, thanks man :D
  • 1
    Can't you set some swap space though? I find 1/2GB can be a lifesaver sometimes on tiny VMs. Not sure how that applies to Docker though.

    Also, what's the point of a whole container just for OpenVPN? Seems a bit overkill, considering how lightweight it is...
  • 0
    @endor openvpn container takes only 3MB from RAM not much.
    As for swap I'll see how to do that with docker
Add Comment