Reducing memory requirements by filtering out pbf file nodes


Thank you so much for this amazing service!

I am currently hosting it on Azure and was looking for ways to save up money.
For France (4GB pbf) with 3 profiles (car, bike regular & hiking) I am currently paying 150$+ a month (Azure Container Instances: 3* (1vCPU + 12GB RAM)).

Since the rule of thumb is to allocate 2*(pbf file size) in RAM, I tried to see if filtering out nodes not needed for directions in the pbf file would help reduce the RAM requirements. I did something like this:
osmium tags-filter osm-file-full.pbf nwr/highway nwr/route -o osm-file.pbf
and was able to go from 4GB to 880MB. My hypothesis was then that 2GB should now be ok. I tried with 6GB (since i knew the normal file would require 8) and got java.lang.OutOfMemoryError: Java heap space.

Am I then to assume that filtering out nodes in the pbf file cannot help (since the graph is only using routes / highways tags anyway)? If so, any tips for reducing the server hosting bill (I would like to host the full planet at some point)?

Thank you in advance!


yes, filtering nodes and ways from the pbf beforehand will reduce parsing time, but not graph size, since as you correctly states ors mostly only uses highway=* nodes and ways (and some others).

Regarding reducing a server hosting bill, maybe @adam has some ideas?

Best regards