graphhopper / directions-api

Issues for the GraphHopper Directions API
https://graphhopper.com/api/1/docs/
60 stars 25 forks source link

Slow response for none-EU located servers (Australia, USA, Japan, Africa, ...) #16

Open karussell opened 9 years ago

karussell commented 9 years ago

The handshake for SSL is expensive as many times it needs to send forth and back something. So the solution is to keep this handshake at the initial request only (our server should support this via keepalive) and follow up requests are much faster, which you can try e.g. via:

URL="https://graphhopper.com/api/1/route?key=[YOUR_KEY]&point=-34.0102021%2C151.1270069&point=-33.95237450124232%2C150.9959234857656&vehicle=car&locale=en"
curl -w "tcp: %{time_connect} ssl:%{time_appconnect} all: %{time_total}\n" -sk -o /dev/null $URL -o /dev/null $URL -o /dev/null $URL

Another solution will be established in the future to have several servers across the world. Initial connections can be tested from various locations with this service

Our Java and JavaScript clients already do this 'keepalive' for you as JavaScript uses the default for HTTP1.1 and Java uses okhttp having similar defaults.