GraphHopper.com | Forum | GitHub | Maps | Blog

Refresh/Update cache folder


#1

Hi,

It’s been a while since my last confession :-).
I’m opening this discussion since I’m now migrating my code from .Net 4.5 to .Net Core which should be cross platform (I should’ve used Java to begin with but I’m too stubborn I guess).
When running on windows I use windows service to run the Java process so that the GH process will always be up.
This means that I need to stop the service, update the cache and start the service again every time I need to update the data.
This is less than ideal.
It would be ideal if I could send a request to GH to either change the cache location or refresh current cache.
The current work around we use is to create a new GH cache in a different folder while GH is running, stop GH window service, swap between the cache folders and start GH again in order to reduce the down time as much as possible.
Is there a better way to do it using the HTTP interface? I’ll be surprised if I’m the only one who needs this feature…

Just for reference I use elastic search (that I update on the same time basis) that also uses java and HTTP and everything is possible using the HTTP API which I think is a far better cross platform and cross language approach.


Minimize downtime when regenerating graph-cache
#2

See this issue https://github.com/graphhopper/graphhopper/issues/211

swap between the cache folders and start GH again in order to reduce the down time as much as possible.

At least two independent processes are recommended for production (no down time). Not only for a hot fallback but also the running process ‘does not like’ the heavy import process in the background.


#3

Thanks for the quick response.
This however does not meet my needs.
The code in the issue is written in Java which means that if I write in any other language that is not Java I won’t be able to enjoy it.
an API call like …/refresh?cache= would be great since I’m already creating a secondary cache without stopping the current process with the following command:
java -cp “*” com.graphhopper.tools.Import config=config-example.properties datareader.file={osmFilePath} graph.location={GH_NEW_CACHE_FOLDER}
After that I kill the process, rename GH folder from current to old and rename new to current folder.

But I rather keep the process alive at all times and that the process itself will restart the service from within if possible.