52
DevDay Napoli And why GraphDB are the starting point of this revolution - the 2nd generation of (Multi-Model) NoSQL And why GraphDB are the starting point of this revolution

OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

  • Upload
    devday

  • View
    25

  • Download
    1

Embed Size (px)

Citation preview

Page 1: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

DevDay Napoli

And why GraphDB are the starting point of this revolution

- the 2nd generation of

(Multi-Model) NoSQLAnd why GraphDB are the

starting point of this revolution

Page 2: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

DevDay Napoli

29/10 ore 16.00 - Bootstrap 4 & SASS (Js&Node Meetup Salerno)

30/11 ore 18.45 - OAuthorize yourself 2.0 - dalla crittografia ai protocolli web (DevDay Napoli)

Prossimi Eventi

Page 3: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Luigi Dell’AquilaCore Developer and Director of ConsultingOrientDB LTDTwitter: @ldellaquilahttp://www.orientdb.com

Page 4: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

“90% of the data in the world today has been created in the last two years alone.”

- IBM

Page 5: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Order #134 (Order) John

(Provider)

Commodore Amiga 1200

(Product)

Frank (Customer)

Monitor 40” (Product)

Mouse (Product)

Bruno (Provider)

Page 6: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Order #134 (Order) John

(Provider)

Commodore Amiga 1200

(Product)

Frank (Customer)

Monitor 40” (Product)

Mouse (Product)

Bruno (Provider)

Data by itself has little value, it’s the relationship

between data that gives it incredible value

Page 7: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Order #134 (Order) John

(Provider)

Commodore Amiga 1200

(Product)

(Sells)

Frank (Customer)

(Has)(Makes)

Monitor 40” (Product)

(Sells)(Has)

Mouse (Product)

Bruno (Provider)

(Sells)

(Has)

Page 8: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Key/Value DatabasesDocument Databases

Graph DatabasesColumn Databases

Page 9: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Key/Value Databases

Document Databases Graph Databases

Column Databases

Page 10: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Why do most NoSQL products avoid

managing relationships?

Page 11: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

ID Name

10 John

11 John

24 Mike

28 Mike

ID Address

10 24

10 33

32 44

ID Location

24 Milan

33 London

18 Paris

18 Madrid

44 Moscow

Customer CustomerAddress Address

Is this familiar?

Page 12: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

What’swrongwithJOIN?

Page 13: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

ID Name

10 John

11 John

24 Mike

28 Mike

ID Address

10 24

10 33

32 44

ID Location

24 Milan

33 London

18 Paris

18 Madrid

44 Moscow

Customer CustomerAddress AddressJoins are executed every time

you cross relationships

Querying millions of records joining 3-4 tables could

generate billions of combinations

Page 14: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

This is why the database query performance

suffers as the database increases in size

O(Log N)

Page 15: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

PERFORMANCE

DATABASE SIZE

RDBMS performance on traversal

Page 16: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Solution: Graph Database!

Page 17: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Back to school: Graph Theory crash course

Page 18: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Basic Graph

Luigi RomeVisited

Page 19: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

VerticesandEdgescanhaveproperties

Verticesaredirected

*https://github.com/tinkerpop/blueprints/wiki/Property-Graph-Model

Property Graph Model*

Romecountry:Italy

Luigicompany:OrientDB

VerticesandEdgescanhaveproperties

VerticesandEdgescanhaveproperties

Visitedyear:2016

Page 20: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Luigi Rome

Visitedyear:2016

AnEdgeconnectsonly2vertices

Usemultipleedgestorepresent1-NandN-Mrelationships

Workedyear:2016

1-N and N-M Relationships

Page 21: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Congrats! This is your diploma in «Graph Theory»

Page 22: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

How does a true* Graph Database

manage relationships?

*a “Graph” layer on top of a DBMS doesn’t qualify as a true GraphDB

Page 23: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Luigi Rome

Visitedyear:2015

#13:55#15:99

Each element in the Graph has own immutable

Record ID

#22:11

(Edge)

(Vertex)(Vertex)

Each element in the Graph has own immutable

Record ID

Each element in the Graph has own immutable

Record ID

Page 24: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Connections use persistent pointers

Luigi Rome

Visitedon:2015

#13:55#15:99out = #22:11

in = #22:11

#22:11

(Edge)

(Vertex)(Vertex)

out = #13:55

in = #15:99

Page 25: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Luigi Rome

Visitedon:2015

#13:55#15:99out = #22:11

in = #22:11

#22:11

(Edge)

(Vertex)(Vertex)

out = #13:55

in = #15:99

Page 26: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Luigi Rome

Visitedon:2015

#13:55#15:99out = #22:11

in = #22:11

#22:11

(Edge)

(Vertex)(Vertex)

out = #13:55

in = #15:99

Page 27: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

A Graph Database creates the relationship just once

(when the edge is created)

VS

RDBMS computes the relationship every time you query a database

Page 28: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

When you move from a RDBMS to a Graph Database you jump

from a O(log N) speed to a near O(1)

With a Graph Database, the traversing time is

not affected by database size!

This is huge in the BigData age

Page 29: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

No costs to traverse relationships: • Recommendation engines • Social Applications • Spatial Apps • Master Data Management • Information Clustering

John

Thriller

Comedy

Pulp Fiction

Mr Bean

Theater B

Theater A

Theater C

NYC

San Josè

Lives in

Likes

Page 30: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

So the Graph Model Is the only solution to efficiently

manage relationships

But what about data complexity? And data consistency?

And scaling?

Page 31: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Rel

atio

nshi

ps C

ompl

exity

>

Data Complexity >

Relational

Key Value

Column

Graph

Document

First Generation NoSQL

Page 32: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

RDBMS

Key/ValueStore

DocumentDatabase

GraphDatabase

Application

ETL

Primary DB

Page 33: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

RDBMS

Key/ValueStore

DocumentDatabase

GraphDatabase

Application

ETL

- No standard between NoSQL products - Multiple vendors = multiple skills - ETL + synchronization code is costly to write and maintain - Performance and Reliability is hard to predict

Page 34: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

2nd Generation NoSQL is

Multi-model

Page 35: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

GraphDocument

Object

Key/Value

Multi Model represents the intersection

of multiple models in just one product

What’s Multi-Model DBMS?

Page 36: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

GraphDocument

Object

Key/Value

Multi Model represents the intersection

of multiple models in just one product

- Just one product to learn and maintain - Just one vendor relationship to manage - No ETL, no synchronization required - Performance and Reliability is easy to test from the beginning

What’s Multi-Model DBMS?

Page 37: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

`

{ ”@rid": “12:382”, ”@class": ”Customer", “name”: “Frank”, “surname” : “Raggio”, “phone” : “+39 33123212”, “details”: { “city”:”London", “tags”:”millennial” } }

Frank

Order

Makes

General purpose solution: • JSON • Schema-less • Schema-full • Schema-hybrid • Nested documents • Rich indexing and querying • Developer friendly

Page 38: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Second Generation NoSQLRelationship Complexity >

Data Complexity >

Relational

Key Value

Column

Graph

Document

Multi-Model

Page 39: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

With a true Graph, Document, Key/Value and Object Oriented engine

Page 40: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

•Support for TinkerPop standard for Graph DB: Gremlin language and Blueprints API

•SQL + extensions for graphs•JDBC driver to connect any BI tool•HTTP/JSON support•Drivers in Java, Node.js, Python,

PHP, .NET, Perl, C/C++ and more

API & Standards

Page 41: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

• Basic HTTP authentication (+HTTPS/SSL)

• User/Role authentication system. One User can have multiple Roles

• Privileges are managed in Roles

• Roles can inherit from other Roles

• Record-level security: every record can contain the user/role can create/read/update/delete the record

• Auditing available in Enterprise Edition

Security

Page 42: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

• HTTPS/SSL

• Starting from OrientDB v2.2:• Support for Kerberos• Encryption at REST using AES and DES of the entire

database or portions• PBKDF2 HASH algorithm with a 24-bit length Salt per

user for a configurable number of iterations.

Encryption

Page 43: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

• Full Backup and Restore

• Delta Backup (v2.2) Enterprise Edition and Restore is available

• Studio web tool

• Command line Console

Administration

Page 44: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

• Import/Export in JSON

• Import from SQL script

• OrientDB ETL tool (http://orientdb.com/docs/last/ETL-Introduction.html)

• Teleporter (v2.2)

Data Extraction and Loading

Page 45: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

• Multi-Master architecture

• Tunable consistency through the usage of a quorum, per database or single class (table)

• Synchronous and Asynchronous replication

• Zero config: if multicast is enabled the server is attached to the cluster

Scale out and HA

Page 46: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Master Node Master Node

C

C C C

CC

C

Multi-master Replication

Atomic, Consistent, Isolated and Durable (ACID) multi-statement transactions

Page 47: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Master Node Master Node

CC C C

CC

C

Auto-Discovered

Node

Page 48: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Architectures

•  Single, stand-alone node

•  Embedded (in-process) DB

•  Multi-Master Replica

•  Mixed

DB Application

Application DB

Application

DB Application Application DB DB

(replica N)

DB Application Application DB DB

Application

DB

(replica N)

Page 49: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

FEATURES ORIENTDB)) MONGODB NEO4J MYSQL)(RDBMS)

Operational Database X X X Graph Database X X Document Database X X Object-Oriented Concepts X Schema-full, Schema-less, Schema mix X User and Role & Record Level Security X Record Level Locking X X X SQL X X ACID Transaction X X X Relationships (Linked Documents) X X X Custom Data Types X X X Embedded Documents X X Multi-Master Zero Configuration Replication X Sharding X X Server Side Functions X X X Native HTTP Rest/ JSON X X Embeddable with No Restrictions X

Page 50: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Udemy Getting Started Training is and Free

http://www.orientechnologies.com/getting-started

OrientDB Enterprise is Free for Development

OrientDB Community is FREE for any purpose (APACHE 2 license)

Page 51: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

DEMO

Page 52: OrientDB - Perché le tue applicazioni meritano un DB Multi-Model

#OrientDB - @ldellaquila

Dev

Day

Nap

oli

Thank you!Luigi Dell’Aquila@ldellaquilahttp://www.orientdb.com

Q/A