+ All Categories
Home > Technology > Multi model-databases

Multi model-databases

Date post: 29-Aug-2014
Category:
Upload: arangodb
View: 191 times
Download: 0 times
Share this document with a friend
Description:
In this talk we present the term polyglot persistence, give a brief introduction to the world of NoSQL database and point out the benefits and costs of polyglot persistence. Thereafter we present the idea of a multi-model database that reduces the costs for polyglot persistence but keeps its benefits. Next up we present ArangoDB as a Multi-Model database
Popular Tags:
25
Polyglot Persistence & Multi-Model Databases 1 Michael Hackstein @mchacki www.arangodb.org
Transcript
Page 1: Multi model-databases

Polyglot Persistence & Multi-Model Databases

1

Michael Hackstein @mchacki

www.arangodb.org

Page 2: Multi model-databases

Michael Hackstein @mchacki

‣ ArangoDB Core Team

‣ Web Frontend

‣ Graph visualisation

‣ Graph features

!!

‣ Organiser of cologne.js

‣ Master’s Degree(spec. Databases andInformation Systems)

2

Page 3: Multi model-databases

Once upon a time…

‣ Use a SQL-based database

‣ Implement logic to transform your data into table format

‣ Create / Generate complex queries

‣ Implement logic to transform data from table format in required format

3

Page 4: Multi model-databases

4

Shopping-Cart

RecommendationsSales-History Customer

Product-Catalog

An e-commerce system in Relational World

4

Page 5: Multi model-databases

Main Categories of NoSQL DBs

5

Key/Value Store Document Store Graph Database

Source: Andrew Carol

Polyglot Persistence

Page 6: Multi model-databases

Key-Value Store

‣ Map value data to unique string keys (identifiers)

‣ Treat data as opaque (data has no schema)

‣ Can implement scaling and partitioning easily due to simplistic data model

‣ Key-value can be seen as a special case of documents

6

Page 7: Multi model-databases

Document Store

‣ Normally based on key-value stores (each document still has a unique key)

‣ Allow to save documents with logical similarity in “databases” or “collections”

‣ Treat data records as attribute-structured documents (data is no more opaque)

‣ Often allow querying and indexing document attributes

7

Page 8: Multi model-databases

!

!

!

!

!

!

!

Graph Store

8

Page 9: Multi model-databases

Polyglot Persistence

‣ „Use the right tool for the job“

‣ If you have structured data with some differences

‣ Use a document store

‣ If you have relations between entities and want to efficiently query them

‣ 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 where all objects have equal attributes

‣ Use a relational database

9

Page 10: Multi model-databases

10

Recommendations

Product-CatalogShopping-Cart

Sales-History Customer

KeyValueStore

Single-Model-Databases

10

{ “userID": 239178239, “productID”: 128623883, “number": 5, “price”: 12.20, }

{ “userID": 239178239, “productID”: 128623883, “number": 5, “price”: 12.20, }

DocumentStore GraphStore { “Name": "Smith", “lastLogin”: “2012-11-01", “Visits": 121, “shipping address”: “abc”, “shipping address”: “def” }

{ “Name": "Meyer", “lastLogin”: “2012-11-21", “Visits": 20, “shipping address”: “xyz”, }

DocumentStore

423453453

4328, “shirt”, “L”, 1, 12.99 6378, “sweater”, “M”, 2, 37.95 3245, “sweater”, “blue”, 1, 99.95 3245, “pants”, “32/34”, “black”, 1, 99.95

=>

8743655635463, “shirt”, “S”, 1, 9.99 6378, “sweater”, “M”, 2, 37.95 3245, “pants”, “32/34”, “black”, 1, 99.95

=>

{ “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" }

DocumentStore

Page 11: Multi model-databases

Benefits & Costs

11

‣ Native mapping of data into DB

‣ DB optimized

‣ Queries are tailored for your data format

‣ Focus on writing business logic

‣ Several technologies involved

‣ Experts required for each

‣ Administration effort is huge

‣ Application logic has to interface with several sources

‣ Data has to be stored redundantly and has to be kept in sync

Page 12: Multi model-databases

Syncing Requirements

12

Customers Products

Recommendations

Sales-History

Extract E

dges

Suggest only Available Products

Filter suggestions

Find connected users

Buyers Purchases

‣ Problem: Different Data-Formats

‣ On small systems: One database could be sufficient

Page 13: Multi model-databases

Multi Model Database

13

‣ Can store several kinds of data models:

‣ Acts as a key-value store

‣ Acts as a document store

‣ Stores graphs natively

‣ Delivers query mechanisms for all data models

Page 14: Multi model-databases

14

‣ a multi-model database (document store & graph database)

‣ is open source and free (Apache 2 license)

‣ offers convenient queries (via HTTP/REST and AQL)

‣ offers high performance and is memory efficient

‣ uses JavaScript throughout (V8 built into server)

‣ doubles as a web and application server (Foxx)

‣ offers many drivers for a wide range of languages

‣ is easy to use with web frontend and good documentation

‣ enjoys good professional as well as community support

‣ and recently added sharding in Version 2.0.

Page 15: Multi model-databases

Different query interfaces

Different scenarios require different access methods:

‣ Query a document by its unique id / key:

GET /_api/document/users/12345

‣ Query by providing an example document:

PUT /_api/simple/by-example { "name": "Michael", "age": 26 }

‣ Query via AQL: FOR user IN users FILTER user.active == true RETURN { name: user.name }

‣ Graph Traversals

15

Page 16: Multi model-databases

Why another query language?

‣ Initially, we implemented a subset of SQL's SELECT

‣ It didn't fit well

‣ UNQL addressed some of the problems

‣ Looked dead

‣ No working implementations

‣ XQuery seemed quite powerful

‣ A bit too complex for simple queries

‣ JSONiq wasn't there when we started

16

Page 17: Multi model-databases

Other Document Stores

‣ MongoDB uses JSON/BSON as its “query language”

‣ Limited

‣ Hard to read & write for more complex queries

‣ CouchDB uses Map/Reduces

‣ It‘s not a relational algebra, and therefore hard to generate

‣ Not easy to learn

17

Page 18: Multi model-databases

ArangoDB Query Language (AQL)

‣ We came up with AQL mid-2012

‣ Declarative language, loosely based on the syntax of XQuery

‣ Other keywords than SQL so it's clear that the languages are different

‣ Implemented in C and JavaScript

18

Page 19: Multi model-databases

Extendable through JS

‣ Dynamic Language that enriches ArangoDB

‣ Multi Collection Transactions

‣ Graph Traversals

‣ Cascading deletes/updates

‣ Aggregate data from multiple queries into a single response

‣ Data-intensive operations

‣ Actions, Foxx, Application Server

19

Page 20: Multi model-databases

Application Server / Action Server

‣ ArangoDB can answer arbitrary HTTP requests directly

‣ You can write your own JavaScript functions (“actions”) that will be executed server-side

‣ Includes a permission system

‣ Build your own API rapidly using the Foxx framework

!

!

➡ You can use it as a database or as a combined database/application server

20

Page 21: Multi model-databases

21

Product-CatalogShopping-Cart

Sales-History Recommendations Customer

DocumentStore

DocumentStore

DocumentStoreGraphStore

KeyValueStore

Use Case: Multi-Model-Databases

21

Page 22: Multi model-databases

Syncing Requirements

22

Customers Products

Recommendations

Sales-History

Extract E

dges

Suggest only Available Products

Filter suggestions

Find connected users

Buyers Purchases

‣ Data-format is unified, no transformations

‣ On small systems: (Single Database)

‣ Separate into collections

‣ No redundancy

‣ Gain transaction possibilities

Page 23: Multi model-databases

Join our growing community

23

.. working on the geo index, the full text search and many APIs: Ruby, Python, PHP, Java, D, ...

Page 24: Multi model-databases

Summary

‣ Multi-Model databases simplify database setup

‣ Cross-out transformation of data-formats

!

‣ ArangoDB

‣ Based on web standards: HTTP, REST, JSON

‣ Flexible querying: Documents, Graphs in the same language

‣ Reduce Server <-> Database communication: ‣ Define your own API using Foxx

‣ Execute data-intensive code within the database

‣ You can even use ArangoDB as our application server

24

Page 25: Multi model-databases

25

Thank you

!

‣ Further questions?

‣ Follow me on twitter/github: @mchacki

‣ Or write me a mail: [email protected]

25


Recommended