SlideShare a Scribd company logo
1 of 36
Download to read offline
Artem Nikitin
DevDays Vilnius| May, 2018
Go implementation
for Flatdata
A long time ago in a galaxy far, far away....
Routing team at HERE Technologies was in the situation
when routing backend was in danger of failing SLA.
It’s triggered a massive work to improve its performance.
As a side effect of this work, Flatdata was born: zero-copy
memory-mapped data storage
© 2018 HERE | PublicDevDays Vilnius | May, 2018
01
What is routing?
Routing
• Creating a path from point A to point B
• Hmm… It looks familiar…
• Can we represent a map as a graph and then use
Dijkstra?
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Routing
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Routing
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Routing
• It looks easy, but reality is different
• What about negative “turn costs”?
• What to do with time awareness?
• How to handle dynamic info?
• Usually, different algorithms are used for different
cases
© 2018 HERE | PublicDevDays Vilnius | May, 2018
02
Go?… Never heard of…
Go
• Initially developed by:
Ken Thompson (C, Unix)
Rob Pike (Plan9, UTF-8)
Robert Griesemer (V8)
• Statically typed, compiled
• With GC
• Created with support for concurrency in mind
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Go
Why do we need yet another language?
• Fast compilation
• Simple syntax and quick start
• One code style!
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Go
What is written in Go?
• Docker
• Kubernetes
• HashiCorp tools
• Prometheus and many more…
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Go
What I like in Go:
• Simplicity and even primitivity
No more AbstractSingletonProxyFactoryBean ever J
• Code which is easy to understand
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Go
What I DON’T like about Go:
• Dependency management
• Ecosystem isn’t that good comparing to more mature
languages, like Java
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Go
If you are interested, then:
• https://tour.golang.org
• The Go Programming Language
(Alan A. A. Donovan, Brian W. Kernighan)
© 2018 HERE | PublicDevDays Vilnius | May, 2018
03
Flatdata
What is Flatdata?
https://github.com/heremaps/flatdata
Flatdata is a library providing data structures for convenient
creation, storage and access of packed memory-mappable
immutable data structures with minimal overhead
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Why Flatdata?
Existed data format was optimized for embedded clients:
• Reduced space consumption (Disk)
• Incremental processing tile-by-tile (CPU)
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Why Flatdata?
Drawbacks for backend:
• Decoding tiles and reconstructing world scene (CPU
Time)
• Custom tile cache not shared between processes (RAM)
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Solution
• Store the data in directly-accessible memory-mapped
files
• Store it sorted to preserve locality
• Use constant-time lookups wherever possible
• Avoid unnecessary copying of data
© 2018 HERE | PublicDevDays Vilnius | May, 2018
When it's useful?
• Your data updates infrequently and accessed much
more often than updated
• You can afford to recreate the full data archive on
every update
• Your data fits in the RAM on target instance
• You want to optimize your data to be cache-friendly
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Alternatives
We looked at several alternatives with Flatbuffers as
most well-known.
We prototyped a routing graph with 10M nodes and
compared our solution with Flatbuffers
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Prototype
Graph creation
© 2018 HERE | PublicDevDays Vilnius | May, 2018
cpu_time (ms) peak memory consumption (kb)
flatbuffers 1 936.2096 1 486 116
reference 1 446.0785 743 640
Prototype
Dijkstra
© 2018 HERE | PublicDevDays Vilnius | May, 2018
cpu_time (ms) peak memory consumption (kb)
flatbuffers 62 526.3584 1 735 836
reference 57 970.6155 1 718 032
Prototype
BFS
© 2018 HERE | PublicDevDays Vilnius | May, 2018
cpu_time (ms) peak memory consumption (kb)
flatbuffers 10 997.4264 1 163 352
reference 9 300.9597 1 144 048
Prototype
© 2018 HERE | PublicDevDays Vilnius | May, 2018
• Double memory footprint during graph compilation
due to immutability of Flatbuffers
• Performance is a little bit worse then our solution
• Possibilities for fine-grained optimizations are limited
Flatdata
Library consists of:
• Schema language
• Code generator for C++, Python and Go
• Target language libraries.
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Schema
© 2018 HERE | PublicDevDays Vilnius | May, 2018
How it works
© 2018 HERE | PublicDevDays Vilnius | May, 2018
How it works
© 2018 HERE | PublicDevDays Vilnius | May, 2018
How it works
© 2018 HERE | PublicDevDays Vilnius | May, 2018
How it works
© 2018 HERE | PublicDevDays Vilnius | May, 2018
Implementations comparison
© 2018 HERE | PublicDevDays Vilnius | May, 2018
C++
feature
complete
very efficient used in production has writer
Python
feature
complete
slow debugging, tooling etc. no writer
Go
feature
complete
performance
unclear
beta no writer
Current status of Go implementation
• It's feature complete comparing to C++/Python
• It's passes tests for C++/Python implementations
• Probably, a lots of bugs missed :)
• Performance is unclear
• No guarantees of backward compatible changes for
public API
• No writer :(
© 2018 HERE | PublicDevDays Vilnius | May, 2018
04
It’s demo time J
https://github.com/artemnikitin/flatdata-go-coappearances-example
Thank you
Contact
Artem Nikitin hi@artemnikitin.com artemnikitin artemnikitin
Go implementation for Flatdata

More Related Content

Similar to Go implementation for Flatdata

Building CI from scratch
Building CI from scratchBuilding CI from scratch
Building CI from scratchArtem Nikitin
 
Zero to Snowflake Presentation
Zero to Snowflake Presentation Zero to Snowflake Presentation
Zero to Snowflake Presentation Brett VanderPlaats
 
KNIME Software Overview
KNIME Software OverviewKNIME Software Overview
KNIME Software OverviewKNIMESlides
 
Containers and Kubernetes without limits
Containers and Kubernetes without limitsContainers and Kubernetes without limits
Containers and Kubernetes without limitsAntje Barth
 
Container and Kubernetes without limits
Container and Kubernetes without limitsContainer and Kubernetes without limits
Container and Kubernetes without limitsAntje Barth
 
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud Steps
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud StepsAccelerate Cloud Migration to AWS Cloud with Cognizant Cloud Steps
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud StepsAmazon Web Services
 
Big data lab as a service
Big data lab as a serviceBig data lab as a service
Big data lab as a serviceHadi Fadlallah
 
Supercharge Your Authoring - ASTC Conference 2018
Supercharge Your Authoring - ASTC Conference 2018Supercharge Your Authoring - ASTC Conference 2018
Supercharge Your Authoring - ASTC Conference 2018Gareth Oakes
 
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...GIS in the Rockies
 
Pro Tips: When to Choose Private vs Public vs Hybrid Cloud
Pro Tips: When to Choose Private vs Public vs Hybrid CloudPro Tips: When to Choose Private vs Public vs Hybrid Cloud
Pro Tips: When to Choose Private vs Public vs Hybrid CloudPenguin Computing
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
Containers and Kubernetes
Containers and KubernetesContainers and Kubernetes
Containers and KubernetesAltoros
 
What's New In Neo4j 3.4 & Bloom Update
What's New In Neo4j 3.4 & Bloom UpdateWhat's New In Neo4j 3.4 & Bloom Update
What's New In Neo4j 3.4 & Bloom UpdateNeo4j
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataSafe Software
 
Distributed deep learning
Distributed deep learningDistributed deep learning
Distributed deep learningAlireza Shafaei
 
Going MicroServices with Net
Going MicroServices with NetGoing MicroServices with Net
Going MicroServices with NetDavid Revoledo
 
Jawg maurice vs google maps
Jawg   maurice vs google mapsJawg   maurice vs google maps
Jawg maurice vs google mapsLoic Ortola
 
AGIT 2015 - Hans Viehmann: "Big Data and Smart Cities"
AGIT 2015  - Hans Viehmann: "Big Data and Smart Cities"AGIT 2015  - Hans Viehmann: "Big Data and Smart Cities"
AGIT 2015 - Hans Viehmann: "Big Data and Smart Cities"jstrobl
 

Similar to Go implementation for Flatdata (20)

Building CI from scratch
Building CI from scratchBuilding CI from scratch
Building CI from scratch
 
Zero to Snowflake Presentation
Zero to Snowflake Presentation Zero to Snowflake Presentation
Zero to Snowflake Presentation
 
KNIME Software Overview
KNIME Software OverviewKNIME Software Overview
KNIME Software Overview
 
Containers and Kubernetes without limits
Containers and Kubernetes without limitsContainers and Kubernetes without limits
Containers and Kubernetes without limits
 
Container and Kubernetes without limits
Container and Kubernetes without limitsContainer and Kubernetes without limits
Container and Kubernetes without limits
 
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud Steps
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud StepsAccelerate Cloud Migration to AWS Cloud with Cognizant Cloud Steps
Accelerate Cloud Migration to AWS Cloud with Cognizant Cloud Steps
 
Introduction to Digimap's Ordnance Survey Collection
Introduction to Digimap's Ordnance Survey CollectionIntroduction to Digimap's Ordnance Survey Collection
Introduction to Digimap's Ordnance Survey Collection
 
Big data lab as a service
Big data lab as a serviceBig data lab as a service
Big data lab as a service
 
Supercharge Your Authoring - ASTC Conference 2018
Supercharge Your Authoring - ASTC Conference 2018Supercharge Your Authoring - ASTC Conference 2018
Supercharge Your Authoring - ASTC Conference 2018
 
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...
2013 Enterprise Track, Building GIS, Decision Support, and Location Intellige...
 
Pro Tips: When to Choose Private vs Public vs Hybrid Cloud
Pro Tips: When to Choose Private vs Public vs Hybrid CloudPro Tips: When to Choose Private vs Public vs Hybrid Cloud
Pro Tips: When to Choose Private vs Public vs Hybrid Cloud
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
Containers and Kubernetes
Containers and KubernetesContainers and Kubernetes
Containers and Kubernetes
 
What's New In Neo4j 3.4 & Bloom Update
What's New In Neo4j 3.4 & Bloom UpdateWhat's New In Neo4j 3.4 & Bloom Update
What's New In Neo4j 3.4 & Bloom Update
 
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial DataCloud Revolution: Exploring the New Wave of Serverless Spatial Data
Cloud Revolution: Exploring the New Wave of Serverless Spatial Data
 
Distributed deep learning
Distributed deep learningDistributed deep learning
Distributed deep learning
 
Going MicroServices with Net
Going MicroServices with NetGoing MicroServices with Net
Going MicroServices with Net
 
Jawg maurice vs google maps
Jawg   maurice vs google mapsJawg   maurice vs google maps
Jawg maurice vs google maps
 
AGIT 2015 - Hans Viehmann: "Big Data and Smart Cities"
AGIT 2015  - Hans Viehmann: "Big Data and Smart Cities"AGIT 2015  - Hans Viehmann: "Big Data and Smart Cities"
AGIT 2015 - Hans Viehmann: "Big Data and Smart Cities"
 
HDF-EOS Data Product Developer's Guide
HDF-EOS Data Product Developer's GuideHDF-EOS Data Product Developer's Guide
HDF-EOS Data Product Developer's Guide
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Go implementation for Flatdata

  • 1. Artem Nikitin DevDays Vilnius| May, 2018 Go implementation for Flatdata
  • 2. A long time ago in a galaxy far, far away.... Routing team at HERE Technologies was in the situation when routing backend was in danger of failing SLA. It’s triggered a massive work to improve its performance. As a side effect of this work, Flatdata was born: zero-copy memory-mapped data storage © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 4. Routing • Creating a path from point A to point B • Hmm… It looks familiar… • Can we represent a map as a graph and then use Dijkstra? © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 5. Routing © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 6. Routing © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 7. Routing • It looks easy, but reality is different • What about negative “turn costs”? • What to do with time awareness? • How to handle dynamic info? • Usually, different algorithms are used for different cases © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 9. Go • Initially developed by: Ken Thompson (C, Unix) Rob Pike (Plan9, UTF-8) Robert Griesemer (V8) • Statically typed, compiled • With GC • Created with support for concurrency in mind © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 10. Go Why do we need yet another language? • Fast compilation • Simple syntax and quick start • One code style! © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 11. Go What is written in Go? • Docker • Kubernetes • HashiCorp tools • Prometheus and many more… © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 12. Go What I like in Go: • Simplicity and even primitivity No more AbstractSingletonProxyFactoryBean ever J • Code which is easy to understand © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 13. Go What I DON’T like about Go: • Dependency management • Ecosystem isn’t that good comparing to more mature languages, like Java © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 14. Go If you are interested, then: • https://tour.golang.org • The Go Programming Language (Alan A. A. Donovan, Brian W. Kernighan) © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 16. What is Flatdata? https://github.com/heremaps/flatdata Flatdata is a library providing data structures for convenient creation, storage and access of packed memory-mappable immutable data structures with minimal overhead © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 17. Why Flatdata? Existed data format was optimized for embedded clients: • Reduced space consumption (Disk) • Incremental processing tile-by-tile (CPU) © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 18. Why Flatdata? Drawbacks for backend: • Decoding tiles and reconstructing world scene (CPU Time) • Custom tile cache not shared between processes (RAM) © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 19. Solution • Store the data in directly-accessible memory-mapped files • Store it sorted to preserve locality • Use constant-time lookups wherever possible • Avoid unnecessary copying of data © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 20. When it's useful? • Your data updates infrequently and accessed much more often than updated • You can afford to recreate the full data archive on every update • Your data fits in the RAM on target instance • You want to optimize your data to be cache-friendly © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 21. Alternatives We looked at several alternatives with Flatbuffers as most well-known. We prototyped a routing graph with 10M nodes and compared our solution with Flatbuffers © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 22. Prototype Graph creation © 2018 HERE | PublicDevDays Vilnius | May, 2018 cpu_time (ms) peak memory consumption (kb) flatbuffers 1 936.2096 1 486 116 reference 1 446.0785 743 640
  • 23. Prototype Dijkstra © 2018 HERE | PublicDevDays Vilnius | May, 2018 cpu_time (ms) peak memory consumption (kb) flatbuffers 62 526.3584 1 735 836 reference 57 970.6155 1 718 032
  • 24. Prototype BFS © 2018 HERE | PublicDevDays Vilnius | May, 2018 cpu_time (ms) peak memory consumption (kb) flatbuffers 10 997.4264 1 163 352 reference 9 300.9597 1 144 048
  • 25. Prototype © 2018 HERE | PublicDevDays Vilnius | May, 2018 • Double memory footprint during graph compilation due to immutability of Flatbuffers • Performance is a little bit worse then our solution • Possibilities for fine-grained optimizations are limited
  • 26. Flatdata Library consists of: • Schema language • Code generator for C++, Python and Go • Target language libraries. © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 27. Schema © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 28. How it works © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 29. How it works © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 30. How it works © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 31. How it works © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 32. Implementations comparison © 2018 HERE | PublicDevDays Vilnius | May, 2018 C++ feature complete very efficient used in production has writer Python feature complete slow debugging, tooling etc. no writer Go feature complete performance unclear beta no writer
  • 33. Current status of Go implementation • It's feature complete comparing to C++/Python • It's passes tests for C++/Python implementations • Probably, a lots of bugs missed :) • Performance is unclear • No guarantees of backward compatible changes for public API • No writer :( © 2018 HERE | PublicDevDays Vilnius | May, 2018
  • 34. 04 It’s demo time J https://github.com/artemnikitin/flatdata-go-coappearances-example
  • 35. Thank you Contact Artem Nikitin hi@artemnikitin.com artemnikitin artemnikitin