0

Now before I will get pointed to search.

I've already searched

And the partial solution to my problem is:

    mem_limit: "500M"    # Only this amount of ram can be used
    memswap_limit: "10G" # If ram usage exceeded then use swap with this limit

And this works perectly:

enter image description here

What's the problem

The problem is that i'm trying to self-host the openrouteservice (https://hub.docker.com/r/giscience/openrouteservice).

It's based on Java, and it's working with the pbf files of open street map. The problem is that these files are big so for example:

  • Europe: Poland = 1.8Gb

Now upon importing that file it gets stuffed inside RAM, and I don't want that. I want to use swap.

The container itself has java configuration present (I'm not familiar with Java, but did some research too):

"JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms400m -Xmx9g"

Problem is that I'd need to have for now 2gb ram in container, the container is limited to use 500Mb because I want the rest to go into swap, but java dies since the container has limit of 500mb and java is not aware of that swap allocation.

I see 2 solutions but I can't find a way to approach any of them (after hours of researching / testing):

  • force java to use swap, but there doesn't seem to be any option for that,
  • fake the container ram to make it think "hey I got 10gb for You java!", while it would still use swap, so it would probably need internally (inside container) to inform java "hey, got some free ram for you!" (which would be swap ofc).

Anyone got any idea for that?

The code / docker image / project I'm using is not mine, I only want to get rid of the huge memory overload. I don't need the project to be super fast. I just need it to work without such huge memory usage, becuase If I will eventually want to import whole europe map then it would require 30+gb ram.

Volmarg Reiso
  • 437
  • 4
  • 11
  • Not a question about programming or software development. Try https://superuser.com/ or https://serverfault.com/ – scai Apr 05 '23 at 09:31

0 Answers0