|
| 1 | +# Deploy Guide |
| 2 | + |
| 3 | +This guide is written for everyone interested in deploying graphhopper on a server. |
| 4 | + |
| 5 | +## Basics |
| 6 | + |
| 7 | +For simplicity you could just start jetty from maven and schedule it as background job: |
| 8 | +`export GH_FOREGROUND=false && export JETTY_PORT=11111 && ./graphhopper.sh web europe_germany_berlin.pbf`. |
| 9 | +Then the service will be accessible on port 11111. |
| 10 | + |
| 11 | +For production usage you can install the latest jetty (8 or 9) as a service but we prefer to have it bundled as a |
| 12 | +simple jar. Tomcat should work too. To create a war file do `mvn clean install war:war` and copy it from the target/ |
| 13 | +folder to your jetty installation. Then copy web/config.properties also there and change this properties |
| 14 | +file to point to the required graphhopper folder. Increase the Xmx/Xms values of your jetty server e.g. |
| 15 | +for world wide coverage with a hierarchical graph do the following in bin/jetty.sh |
| 16 | +``` |
| 17 | +bash |
| 18 | +export JAVA=java-home/bin/java |
| 19 | +export JAVA_OPTIONS="-server -Xconcurrentio -Xmx17000m -Xms17000m" |
| 20 | +``` |
| 21 | + |
| 22 | +Important notes: |
| 23 | + |
| 24 | + * jsonp support needs to be enabled in the config.properties |
| 25 | + * none-hierarchical graphs should be limited to a certain distance otherwise you'll require lots of RAM per request! See [#104](https://github.com/graphhopper/graphhopper/issues/104) |
| 26 | + * if you have strange speed problems which could be related to low memory you can try to [entire disable swap](http://askubuntu.com/questions/103915/how-do-i-configure-swappiness). Or just try it out via `sudo swapoff -a`. Swapping out is very harmful to Java programs especially when the GC kicks in. |
| 27 | + |
| 28 | +### API Tokens |
| 29 | + |
| 30 | +By default, graphhopper uses [Omniscale](http://omniscale.com/) as layer service. |
| 31 | +Either you get a plan there or you have to remove Omniscale from the [JavaScript file](https://github.com/graphhopper/graphhopper/blob/master/web/src/main/webapp/js/main.js). |
| 32 | + |
| 33 | +## World Wide |
| 34 | + |
| 35 | +GraphHopper is able to handle coverage for the whole [Openstreetmap road network](http://planet.osm.org/). |
| 36 | +It needs approximately 22GB RAM for the import (CAR only) and ~1 hour (plus ~5h for contraction). |
| 37 | +If you can accept slower import times this can be reduced to 14GB RAM - you'll need to set osmreader.dataaccess=MMAP |
| 38 | + |
| 39 | +Then, to run the web service with this world wide graph 'only' 15GB are necessary. Without contraction hierarchy |
| 40 | +this would be about 9GB. |
| 41 | + |
| 42 | +With CH the service is able to handle about 180 queries per second (from localhost to localhost this was 300qps). |
| 43 | +Measured for CAR routing, real world requests, at least 100km long, on a linux machine with 8 cores and 32GB, |
| 44 | +java 1.7.0_25, jetty 8.1.10 via custom QueryTorture class (10 worker threads). |
| 45 | + |
| 46 | +### JVM |
| 47 | + |
| 48 | +If GC pauses are too long try `-XX:+UseG1GC` |
| 49 | + |
| 50 | +### Elevation Data |
| 51 | + |
| 52 | +If you want to use elevation data you need to increase the allowed number of open files. Under linux this works as follows: |
| 53 | + |
| 54 | + * sudo vi /etc/security/limits.conf |
| 55 | + * add: `* - nofile 100000` |
| 56 | + which means set hard and soft limit of "number of open files" for all users to 100K |
| 57 | + * sudo vi /etc/sysctl.conf |
| 58 | + * add: `fs.file-max = 90000` |
| 59 | + * reboot now (or sudo sysctl -p; and re-login) |
| 60 | + * afterwards `ulimit -Hn` and `ulimit -Sn` should give you 100000 |
| 61 | + |
| 62 | + |
| 63 | +### TODOs |
| 64 | + |
| 65 | + * Try out to disable NUMA -> http://engineering.linkedin.com/performance/optimizing-linux-memory-management-low-latency-high-throughput-databases |
0 commit comments