MMAP_RO Data access

Hello guys,

I’m searching for new ways to improve the availability of my Graphhopper instance.

I run a whole planet map in k8s, and I’ve been running it with RAM_STORE so far, and besides the long time to get up and running, it runs well.

I’m trying to test alternatives to reduce the time to get up and running, and one of theses scenarios I change the data_access from RAM_STORE to MMAP_RO (My intention is to run many instances connected to the same import, if possible), and I’m receiving the following error:

# k logs -f mlp-graphhopper-5d4d8469d-ddxwk
## using java 21.0.1 (64bit) from /opt/java/openjdk
## Executing server. JAVA_OPTS=-Xmx150g -Xms32g -XX:+UseG1GC -XX:MaxGCPauseMillis=100 -XX:+HeapDumpOnOutOfMemoryError
2026-06-02 22:13:43.366 [main] INFO  org.eclipse.jetty.util.log - Logging initialized @886ms to org.eclipse.jetty.util.log.Slf4jLog
2026-06-02 22:13:43.402 [main] INFO  i.d.server.DefaultServerFactory - Registering jersey handler with root path prefix: /
2026-06-02 22:13:43.403 [main] INFO  i.d.server.DefaultServerFactory - Registering admin handler with root path prefix: /
2026-06-02 22:13:43.488 [main] INFO  c.g.routing.lm.LMPreparationHandler - Loaded built-in landmark splitting collection from jar:file:/graphhopper/graphhopper-web-9.0-SNAPSHOT.jar!/com/graphhopper/routing/lm/map.geo.json
2026-06-02 22:13:43.536 [main] INFO  io.dropwizard.assets.AssetsBundle - Registering AssetBundle with name: assets for path /maps/*
2026-06-02 22:13:43.537 [main] INFO  io.dropwizard.assets.AssetsBundle - Registering AssetBundle with name: webjars for path /webjars/*
2026-06-02 22:13:43.539 [main] INFO  io.dropwizard.server.ServerFactory - Starting GraphHopperApplication
                        _     _
   __ _ _ __ __ _ _ __ | |__ | |__   ___  _ __  _ __   ___ _ __
  / _` | '__/ _` | '_ \| '_ \| '_ \ / _ \| '_ \| '_ \ / _ \ '__|
 | (_| | | | (_| | |_) | | | | | | | (_) | |_) | |_) |  __/ |
  \__, |_|  \__,_| .__/|_| |_|_| |_|\___/| .__/| .__/ \___|_|
  |___/          |_|                     |_|   |_|
2026-06-02 22:13:43.578 [main] INFO  o.e.jetty.setuid.SetUIDListener - Opened application@1a28b346{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2026-06-02 22:13:43.579 [main] INFO  o.e.jetty.setuid.SetUIDListener - Opened admin@25e49cb2{HTTP/1.1, (http/1.1)}{localhost:8990}
2026-06-02 22:13:43.580 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.4.53.v20231009; built: 2023-10-09T12:29:09.265Z; git: 27bde00a0b95a1d5bbee0eae7984f891d2d0f8c9; jvm 21.0.1+12-LTS
[1.675s][warning][os,thread] Attempt to deallocate stack guard pages failed (0x00007c8769a16000-0x00007c8769a1a000).
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 65536 bytes for committing reserved memory.
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00007c87143a0000, 65536, 0) failed; error='Not enough space' (errno=12)
# An error report file with more information is saved as:
# /graphhopper/hs_err_pid1.log
[1.790s][warning][os       ] Loading hsdis library failed

My container have exactly the same resources it used to when I ran RAM_STORE.

My configurations are:
-Xmx150g -Xms32g (JVM) | request: 120Gi, limit: 160Gi (container memory)

I also tried with
-Xmx32g -Xms8g (JVM) | request: 120Gi, limit: 160Gi (container memory)
-Xmx20g -Xms10g (JVM) | request: 120Gi, limit: 160Gi (container memory)

My VM have 240Gb of RAM, and I may upgrade it to 480GB (I prefer to avoid the upgrade due to costs) so RAM is not a problem.

All the times I tried to run with MMAP_RO, I gaves the same errors message.

I undestand that MMAP, does not need to load all the import to memory, so I could run it with lower resources. But it’s not working anyway.

Any ideia of what may be happening??

Did you also try MMAP (without _RO)? How big is your -gh folder? Also you could try to remove the Xms parameter. Note that MMAP uses off-heap memory, so you only need a small Xmx value. If it is too large the JVM might even occupy too much memory so there is not enough off-heap memory left.

Hey @easbar my -gh folder is 118Gb.

I tried other data access types, and I had the same problem. So I investigated a little further, and discovered that this problem is related to the vm kernel i’m running my gh.

I had to set the following config sysctl -w vm.max_map_count=2097152 and then I was able to run my gh with mmap for the planet pbf

1 Like