Skip to content

Experiment: Store geometry edges in MapDB

Andrew Byrd edited this page Dec 17, 2014 · 1 revision

I experimented something with graph reduction. For tests I used OSM of my country - Slovenia.

This is based on ticket 1505.

First I removed all street names, because they are only used when showing the trip data not during search. This only meant couple of KB. Next thing I removed edge geometry data. Graph size was only 53% of previous size.

I also tried removing geometry from graph completely. I used MapDB http://www.mapdb.org/ for that. During graph generation all of edge geometries are saved in mapDB hashmap, keyed according to edge ID. And during server operation when geometry is needed it is read from 50MB LRU cache (configurable) or disk. This change is transparent to the rest of the program. Geometries are used on start and end vertices when edges closest to it are searched and when path is returned. I didn't noticed any slowness during graph building or usage but my graph is pretty small it would be great if someone tested this with large graph.

MapDB master branch: https://github.com/buma/OpenTripPlanner/tree/geometriesInMapDB_master

Currently mapDB database is created and expected to be at the same folder from where otp command for graph building is run. And database has to be manually deleted if different graph is run from same folder.

Results:

Slovenia default graph: 143MB
Slovenia with MapDB: 76MB same as without geometry 53% size
Geodata in MapDB: 40 MB
Together 116 MB even though MapDB is only loaded as needed
So that means graph size is only 53% of previous size.
And geometry data which is 67MB in this graph is only 40MB or 60% in mapDB.
Slovenia with polylinePacked geometry: 98MB 69% size
Slovenia with fast_serial: 123 MB 86% size

The documentation on this wiki is outdated and should not be used

unless you are intentionally working with legacy versions of OpenTripPlanner. Please consult the current documentation at readthedocs

Clone this wiki locally