[OSRM-talk] Using OSRM linked into other code?

Jacob Roope jacobcroope at gmail.com
Fri Nov 7 17:48:06 UTC 2014

Stephen and Per,

Have you considered precomputing your matrix. It is front end intensive but
I currently store the entirety of North America in my database for analysis
and it is much quicker than running all the HTTP requests as needed.

Also, there is a distance matrix feature in the latest builds that does
drive time if that is all you need.

If those don't solve your problem I can share my pre-building code with


On Fri, Nov 7, 2014 at 12:17 PM, Stephen Woodbridge <woodbri at swoodbridge.com
> wrote:

> Per,
> Thank your for responding. We are also doing the HTTP requests, but the
> performance is killing us. So just a quick update on what I have found out
> so far:
> time GET 'http://localhost:5000/viaroute?...'
> takes about 500 ms on my system.
> time ./simpleclient --sharedmemory
> takes about 44 ms with all the default options in the code turned on
> takes about 22 ms with all the options turned off
> And these numbers are based on still returning json output and parsing
> that.
> So if it were possible to turn simpleclient into object with a few simple
> options we could get something close to the performance improvement above.
> And if we can untangle the json encoding and parse and just pass back raw
> data we would probably see some additional improvement over those numbers.
> This seems like a worthy path to follow, hence my request for some help or
> pointers untangling json encoding and parsing.
> Thanks,
>   -Steve
> On 11/7/2014 10:41 AM, Per Lindberg wrote:
>> I guess that was me. We also would love to have a single
>> sharable object file (.dll and .so) with a documented API.
>> All we need is travel time from A to B. We currently do
>> gazillions of HTTP calls to a separate process, so a more
>> direct call would be wonderful.
>> Keep me posted if you see any progress in this.
>> Cheers,
>> Per Lindberg
>> Facility labs
>> On 2014-11-07 16:13, Stephen Woodbridge wrote:
>>> Hi,
>>> I seem to remember a while back that there was a discussion about the
>>> possibility to embed the OSRM routing engine at the code level rather
>>> than doing HTTP requests to a server.
>>> I now find myself in a position that this would be desirable to do. I
>>> have a small coverage area like a city, but I'm getting killed by the
>>> overhead of formatting requests as strings, making a socket connection
>>> to osrm-routed, parsing the responses, etc. Making local requests my
>>> server this is taking 4-500 ms per request.
>>> Basically, I'm doing viaroute requests with 2-100 via points. 99% of the
>>> time all I need to know is the travel time.
>>> Since I'm developing in C++, I thought it might be easy and much faster
>>> to instantiate the routing engine and then have a simple interface where
>>> I can pass a container of points and get back the travel time for that
>>> route and/or the path coordinates. But I could live without the
>>> coordinates if I had to.
>>> Has anyone done this already? Can you share?
>>> I have started digging through the source to see if I can do this, but
>>> working my way in from osrm-routed or Tools/simpleclient.cpp the code is
>>> very entangled with all the http request/response stuff that I would
>>> ideally like to avoid. So far the most promising path looks like using
>>> some variant of the simpleclient, but its not obvious if or how to
>>> untangle all the json stuff and simply return a struct or class to the
>>> caller without that. I spent most of yesterday, digging through this and
>>> made a lot of progress just understanding simpleclient and getting ti to
>>> compile and work and get it to actual return results using a shared
>>> memory connection.
>>> A little help in this direction would be appreciated.
>>> Thanks,
>>>    -Steve
>>> _______________________________________________
>>> OSRM-talk mailing list
>>> OSRM-talk at openstreetmap.org
>>> https://lists.openstreetmap.org/listinfo/osrm-talk
> _______________________________________________
> OSRM-talk mailing list
> OSRM-talk at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osrm-talk/attachments/20141107/e8af0335/attachment.html>

More information about the OSRM-talk mailing list