This document discusses using a multi-model database like ArangoDB for microservices. It explains how ArangoDB can store different data models like key-value, documents, and graphs to support microservices that use different data structures. It provides examples of breaking up a monolithic application into microservices that use different parts of the database, and using Foxx to build REST APIs on top of ArangoDB to integrate microservices.
2. Michael Hackstein
‣ ArangoDB Core Team
‣ Web Frontend
‣ Graph visualisation
‣ Graph features
‣ Host of cologne.js
‣ Master’s Degree
(spec. Databases and
Information Systems)
2
6. Introduction to NoSQL
6
NoSQL World
Documents - JSON
Graphs
Key Value
{
“type“: "pants",
“waist": 32,
“length”: 34,
“color": "blue",
“material”: “cotton"
}
{
“type“: "television",
“diagonal screen size": 46,
“hdmi inputs": 3,
“wall mountable": true,
“built-in digital tuner": true,
“dynamic contrast ratio”: “50,000:1”,
Resolution”: “1920x1080”
}
{
“type": "sweater",
“color": "blue",
“size": “M”,
“material”: “wool”,
“form”: “turtleneck"
}
{
“type": "sweater",
“color": "blue",
“size": “M”,
“material”: “wool”,
“form”: “turtleneck"
}
‣ Map value data to unique string keys (identifiers)
‣ Treat data as opaque (data has no schema)
‣ Can implement scaling and partitioning easily
‣ Focussed on m-to-n relations between entities
‣ Stores property graphs: entities and edges can have
attributes
‣ Easily query paths of variable length
‣ Normally based on key-value stores (each document still
has a unique key)
‣ Allow to save documents with logical similarity in
“collections”
‣ Treat data records as attribute-structured documents
(data is no more opaque)
‣ Often allow querying and indexing document attributes
7. Polyglot Modeling
‣ If you have structured data
➡ Use a document store
‣ If you have relations between entities and want to efficiently query
them by arbitrary steps in between
➡ Use a graph database
‣ If you manage the data structure yourself and do not need
complex queries
➡ Use a key-value store
‣ If you have structured data in graph format, or data model might
change
➡ Use a multi-model database
7
Use the right tool for the job
25. Live Demo
Neo4J + MongoDB
14
https://github.com/mchacki/ms-meets-nosql-examples
26. Multi Model Database
‣ Can natively store several kinds of data models:
‣ Key-value pairs
‣ Documents
‣ Graphs
‣ Delivers query mechanisms for all data models
‣ ACID transactions
‣ Cross collection joins
15
27. Using a Multi-Model Database
16
LoadBalancer
Application Code
Consistency
Joins
28. Using a Multi-Model Database
16
LoadBalancer
Application Code Consistency
Joins
29. Foxx
‣ Customized REST API on top of ArangoDB
‣ Microservice framework
‣ Integrate with other microservices
‣ Reuse your Node.js code and NPM modules
‣ Built-in authentication using OAuth2.0 or HTTP-Basic Auth
‣ Operations are encapsulated in the database
‣ low network traffic, direct data access
‣ increases data privacy
/
(~(
) ) /_/
( _-----_(@ @)
( /
/|/--| V
" " " "
17
36. ‣ open source and free (Apache 2 license)
‣ sharding & replication
‣ JavaScript throughout (V8 built into server)
‣ drivers for a wide range of languages
‣ web frontend
‣ good & complete documentation
‣ professional as well as community support
20
An overview of other features
37. Thank you
‣ Further questions?
‣ Follow me on twitter/github: @mchacki
‣ Write me a mail: mchacki@arangodb.com
‣ Join or google group: https://groups.google.com/forum/#!forum/arangodb
‣ Visit us at our booth
‣ Free T-shirts
21