Good setup for self-hosting GraphHopper + price estimate

Hi, I am considering switching to GraphHopper to handle routing (and probably map matching) for my web application with the following requirements:

  • world-wide coverage
  • with elevation data
  • up-to-date OSM data
  • several routing profiles: foot, car and a few flavors of bike (road, gravel, etc)
  • currently 25k daily requests but consistently increasing

As I have no experience with setting up and running a server, I need some advice about:

  • the type of server to rent (and maybe provider)
  • how to automate OSM data updates and preprocessing for GraphHopper
  • how much would such a configuration cost

Thanks in advance

For all of those profiles and elevation data, I suspect you’d need 256GB of RAM. I only use one profile myself (foot) and just about get away with 64GB, so can’t say for sure though. The number of requests shouldn’t be an issue on a reasonably spec’d server.

Can I assume you also don’t want any downtime whilst you reprocess the latest OSM data? If so, then you’ll likely need a second server of the same specification, and you’d run them in an A/B fashion. So in January you’d serve all traffic from server A, and on server B you’d process the latest OSM data. Then in February you’d flip traffic to be served from server B, and do OSM processing on server A. And so on. This way you achieve zero downtime.

All of this comes with some administrative cost/burden though. So if you have no experience with setting up and administering servers, you’ll need someone to help out with this for sure.

Regarding the server itself: Definitely use a bare metal server. You could either buy one (there’s plenty of second hand options with lots of RAM - RAM is key - on ebay), or you can rent them. If you want to rent a bare metal server (referred to as a “dedicated server” in the hosting world) then you should look at places like Hetzner, OVH, Leaseweb for reasonable prices on large amounts of RAM. Another good one is Heymman (Heymman Servers) but they rarely have stock. It goes without saying, but avoid AWS/GCP/Azure/Linode/DigitalOcean for this - you will pay a fortune for the amount of RAM you require.

Hope this helps,


1 Like

There are cases where you do not need “big RAM” as you can run GH also via memory mapped config (MMAP). E.g. I just tried a 170GB graph with a couple of profiles and even a query through Europe is easily under 0.1s although I used only -Xmx20GB for the JVM and physical memory is 128GB. It is indeed slower even 2x to 5x times (depending on your SSD + CPU speed) but as queries are usually <0.05s this does not matter much for the user. (Note, that when using MMAP config you will need to warm up the GraphHopper instance with a few queries otherwise the first requests in an area will be very slow.)

Also you often do not need to support long-distant routes and then you wouldn’t need a CH preparation for this profile (reducing disk/memory usage and preparation time).

Furthermore I would not mix “import processing” and “request serving” servers. You can use one strong import server and 2 request servers that do not have to be that strong. But this is probably only of a bigger concern if reliability (less hiccups and 100% uptime) is critical for you. Because if one of the two servers is doing the import and the other goes down you have an availability problem :slight_smile:

So the cost really depends on your quality / speed / SLA / budget requirements.

Interesting - thanks!

Thanks a lot for answering my very beginner questions!
I have tried to gather some information about running such a service and here is what I have until now:

  • automate OSM updates and data pre-processing with cron jobs
  • use systemd to restart the service on reboot
  • use nginx to handle the incoming HTTP requests
  • run GraphHopper in a Docker container ?

Does this make sense? Are there some other big steps to consider?
A few other questions:

  • how to swap between the IPs of the serve currently serving requests? I guess it is not hardcoded on client side
  • can GraphHopper’s vehicle profiles bike, gravelbike, mtb be obtained with a single bike instance and custom models? (same for foot, hike)
  • I’ve stumbled upon Contabo ( which seem to have quite low server prices. Any thoughts about it?

Thanks again

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.