using big data techniques to query and store openstreetmap data. stephen knox, digital.arup
TRANSCRIPT
Using Big Data techniques with Open
Street MapStephen Knox
ArupPartly based on research for an MSc in Geographical Information Systems and Science
Kingston University 2015
Disclaimer• I am in no way an expert on Hadoop!• I am a Geographic Information Systems specialist who can program
(and is interested in big data)• Hopefully I can tell you something you didn’t know about
OpenStreetMap and geographic big data processing
Outline• Background to OpenStreetMap (OSM) and growth• Background to Geographic Big Data• Dissertation Research• Aims & Objectives• Methodology• Results • Conclusions
• My general experiences of using Hadoop/SpatialHadoop and related tools
2006 2016
INPUT
STORAGE
GRAPHICAL OUTPUT (MAPS)
DATA OUTPUT
OSM Size and Growth• Current Data – c. 0.5 – 1 TB • Current and Historical Data – 5.15TB• Growing at 1TB per annum
2006 2007 2008 2009 2010 2011 2012 2013 2014 20150
5
10
15
20
25
30
35
40
45
50
DB dump Size (XML BZ2)
2 processor cores8GB RAM6TB disk
4 processor cores64GB RAM6TB disk64GB SSD
8 processor cores256GB RAM24TB disk400GB SSD
OSM DB server
?
Source: Planet OSM http://planet.openstreetmap.org
Source: OSM http://wiki.openstreetmap.org/wiki/Servers Source: OSM http://munin.openstreetmap.org/openstreetmap/katla.openstreetmap/postgres_size_openstreetmap_9_1_main.html
OSM Potential Growth (1)Population
Africa Antarctica AsiaAustralia Central America EuropeN. America S. America
Land Area
Africa Antarctica AsiaAustralia Central America EuropeN. America S. America
Data in OSM
Africa Antarctica AsiaAustralia Central America EuropeN. America S. America
+38%+29%
+22%+27%
+16%
+10%
+21%
Source: Geofabrik individual region download pages for OSM size and growth (http://download.geofabrik.de/index.html) , ArcGIS Continents (http://www.arcgis.com/home/item.html?id=3c4741e22e2e4af2bd4050511b9fc6ad) and UN Department of Economic & Social Affairs Total Population – Both Sexes (http://esa.un.org/unpd/wpp/Excel-Data/EXCEL_FILES/1_Population/WPP2012_POP_F01_1_TOTAL_POPULATION_BOTH_SEXES.XLS)
Scaling systemsScale-up Scale-out(parallel) Scale-out(NoSql)
• More memory
• More cores• More SSD• More hard
disk
Controlling Server
$$$$$$$$$
$$$$$$$$
Hardware costsSoftware acquisition & development costsMaintenance costsTraining costs
$$$$$$$$$
Sources: Scale-up vs Scale-out for Hadoop: Time to rethink? http://www.msr-waypoint.com/pubs/204499/a20-appuswamy.pdf Scaling Up vs. scaling Out: Hidden Costs:http://blog.codinghorror.com/scaling-up-vs-scaling-out-hidden-costs/
It’s getting complicated …. !Source: The 451 Group https://blogs.the451group.com/information_management/2011/04/15/nosql-newsql-and-beyond/
What is the right tool for the job?
1MB 1GB 1TB 1PB 1EB
?
Transaction Logs
Tool
Application / Data
NoSQL Spatial• Key research topic is indexing across multiple nodes
Source: Geowave Docs http://ngageoint.github.io/geowave/documentation.html#theory
• Implementations that add spatial capabilities to NoSQL databases• SpatialHadoop, Hadoop GIS, ESRI tools for Hadoop• SpatialSpark, GeoTrellis• Geomesa, Geowave• MongoDB (extension)• Geocouch
Dissertation - Aims• Investigate whether a parallel non-relational solution could be used
to:• Analyse data from OSM (read-only)?• Become the main storage platform (reads & writes)?In terms of performance, and practicality (whole life cost)
• Does the size and growth rate of OSM make it likely that a non-relational parallel storage solution will become technically or economically desirable in the future?
Dissertation - Methodology• Compare common current OSM tasks to an equivalent task using Big
Data tools• Chose technologies in the Hadoop ecosystem rather than parallel
databases. Used SpatialHadoop and Hbase as principal platforms• Started using a test Hadoop cluster @ work, but ran into issues, so
used cloud platforms • Keep processing power and cost constant, so performance could be
directly compared1 16 core server64GB RAM
8 2-core servers8GB RAM each
Master node
Broadly equivalent in cost and equivalent in nominal performance
SpatialHadoop• University of Minnesota Open Source project• Uses pig as an execution engine• Creates spatial indexes and operators for big geographic datasets
Methodology (continued)• 3 stages:• Data loading & preparation for data analysis
• Test whether a data reader to read the OSM binary format was quicker than using the XML format
• Data querying (read / analyse data)• Spatial – give me the total features in this area [using spatial index]• Non-spatial (e.g. count the total number of shops in the osm database)
• Simulation of master database (reads and writes)• downloading existing data to work on (by bounding box)• uploading new data changes
Uncompressed XML Compressed XML PBF
UK OSM data 17GB 1.2GB 765MB
Results – Loading DataFile & size Cluster Time
UK PBF* (765MB) 4 high memory nodes
37m
UK XML (17GB) 4 high memory nodes
75.5m
UK XML BZ2+ (1.2GB)
4 high memory nodes
66m
Europe PBF (15.7GB) 8 high memory nodes
246m
Europe XML (345GB) Not undertaken – too big to process
Europe XML BZ2 (24GB)
8 high memory nodes
Did not complete
Europe PBF (15.7GB) 16 high memory nodes
143m
Europe XML Not undertaken – too big to process
Europe XML BZ2 (24GB)
16 high memory nodes
Did not complete
* Protocol Buffer Format – binary format+ without taking into account decompression time – c. 7 minutes
File & size Cluster Time
UK XML BZ2 (1.2GB) 1 x 8 core machine(52GB RAM)
17m
Europe XML BZ2 (24GB)
1 x 16 core machine(104GB RAM)
578m
OverpassHadoop
Results – Querying DataIndex type Time Taken
Grid 75m
R-tree 81m
Quad-tree 56mOperation Cluster config Cluster Time Standalone config Standalone time
Europe data small bounding box
8 x 2-core high memory nodes (13GB RAM)
Grid: 50sR-tree: 25sQ-tree: 6s
1 x 16 core machine(104GB RAM)
<1s
Europe data medium bounding box
8 x 2-core high memory nodes (13GB RAM)
Grid: 85sR-tree: 141sQ-tree:12s
1 x 16 core machine(104GB RAM)
4s
Europe data large bounding box (1°2)
8 x 2 core high memory nodes (13GB RAM)
Grid: 91mR-tree: 83sQ-tree: 56s
1 x 16 core machine(104GB RAM)
39s
Europe data huge bounding box (3°2)
8 x 2 core high memory nodes (13GB RAM)
Only attempted with Q-tree: 88s
1 x 16 core machine(104GB RAM)
Out of memory
Shops query 8 x 2 core high memory nodes (13GB RAM)
729s 1 x 16 core machine(104GB RAM)
349s (but also got out of mem errors)
Shops query after indexing
8 x 2 core high memory nodes (13GB RAM)
40s BUT… indexing took 714 seconds!
Results – Reading & Writing Data• Used Hbase and Jython, but did not have time to implement spatial
indexesOperation Cluster configuration Cluster Time Standalone
configurationStandalone time
Data loading England PBF (610MB)
8 x 2-core high memory nodes (13GB ram each)
30m 1 x 16 core machine (104GB RAM)
527m
Data retrieval (small town) 8 x 2-core high memory nodes (13GB ram each)
1 x 16 core machine (104GB RAM)
3s
Data retrieval (large town) 8 x 2-core high memory nodes (13GB ram each)
1 x 16 core machine (104GB RAM)
113s
Data retrieval (city) 8 x 2-core high memory nodes (13GB ram each)
1 x 16 core machine (104GB RAM)
Did not complete (> 300s and 50,000 nodes)
Conclusions• It’s possible to replicate much of what OSM requires in Hadoop• Open Street Map is growing quickly, but it is a long way from requiring horizontal
sharing of databases• In general, it is not quicker to run geographic queries in a cluster at the TB order of
magnitude (at least with current OSM tools) • Indexes do significantly speed up geographic queries (Quad-tree seems to be the best)• There is a high barrier of entry (technical & cost) for Hadoop and ecosystem that will
make it difficult for OSM to adopt the technology• OSM should also consider parallel databases if they do have a requirement to scale-
out as there is less mismatch between their current system• Spatial extensions to big data platforms are relatively immature, but there is a huge
potential there to do data analytics on massive datasets and gain new insights• I’ve learnt a lot personally!
Experiences with Azure+ Easy to use – click to deploy+ Good free trial program+ Good integration with storage
- Less customisable- It was impossible to deploy >= 8
node clusters (rate limits?) so I gave up
- Technical support was responsive but not especially helpful
Experiences with Google Cloud+ Already had Hortonworks
Hadoop distribution automated setup
+ Easy to customise – everything on GitHub.
+ Uses a standard setup (Ambari)
- Not always reliable- Free trial was quite limited- More difficult to connect with
Google Storage buckets- Bit more work to deploy solution
as code-based and have to download 3rd party tool (gcloud)
General Hadoop experiences• Choosing the correct tool can be a significant part of the problem• Setting up Hadoop clusters is hard! • Spatial Big Data is still a little niche (although I did get lots of help)
• Running Hadoop jobs (even with Pig) is hard!• Trial and error to experiment with memory requirements• Size of files is a real barrier (especially when you are paying!)• Often jobs failed half way through• Debugging is not easy• Have to recompile Java whenever there is a change (and sometimes deploy to
nodes)