Intoduction to OrientDB

28

Click here to load reader

Transcript of Intoduction to OrientDB

Page 1: Intoduction to OrientDB

Abdelmawla Mohamed (Abdo)Senior Developer

2nd generation of Multi-Model NoSQL

Page 2: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited2

Relational database› Data is presented to the user in the form of rows and columns (a relation) 

› Data can be manipulated through relational operators in a tabular form 

Page 3: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited3

Over Time› Data start grown in size› Data become heterogonous  › Structured, semi-structured, unstructured

Page 4: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited4

Big Data

Page 5: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited5

Relational database lowIf the only tool you have is a relational database,

everything looks like a table.

Page 6: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited6

One tool doesn’t fit all› Scalability issues› Scale out

› Index intensive issues› Join data

Page 7: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited7

Issues with joins› the relationships are computed every time a query is performed 

› time complexity grows with data: O(log n)› heavy runtime cost with large datasets› Index lookup does not help, it could speeds up searches but slows down inserts, updates, deletes. Imagine on billions of records.

Page 8: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited8

NoSQL movement› Not only SQL› Simplicity of design (through different data models)

› Being non-relational› Simpler horizontal scaling› Distributed

Page 9: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited9

NoSQL Models› Document

› MongoDB, CouchDB, ….› Key-value

› Cassandra, Redis, …› Column

› Hbase, Cassandra, ..› Graph

› Neo4j, ..

Page 10: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited10

But, all of them are one model

Page 11: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited11

NoSQL one model limitations› Document model: no relationships, no schema validation

› Graph model: no complex data, no schema

› key-value model: faster, but-key based access only

› no transactions

Page 12: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited12

So What ?

Page 13: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited13

Multi-model database

Key-value

Graph Object-oriented

Document

Page 14: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited14

Page 15: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited15

Why OrientDB› Native document store (schema-free, complex

properties)› Native graph store (index-free adjacent, fast

relationships traversal)› Object oriented concepts (classes,

inheritance, polymorphism)› ACID Transactions (no lock applied but at commit time,

the MVCC applied)› Rest / JSON interface› Distributed (multi-master replication / sharding)› SQL  (extended)

Page 16: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited16

OrientDB data model

Page 17: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited17

Graph G = (V, E)Graph Vertices Edges

Graph

Edge

Vertex

Page 18: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited18

Graphdrives

name: Abdo

Vertices can have

properties

Vertices are directed

AudiAbdo

license: A134

model: Q7doors: 5Edges can

have properties

Page 19: Intoduction to OrientDB

Page

Abdo Lyon

Visitedon: 2015

An Edge connects only 2 vertices

Use multiple edges to represent 1-N and N-M relationships

Workedon: 2015

1-N and N-M RelationshipsGraph

Page 20: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited20

Basic Concepts› Class› Used to represent type of data model

› Cluster› Stores group of records within a class

Class Car

Cluster USA_Car

Cluster Germany_Ca

r

Page 21: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited21

Vertices› Record Identifier (RID)› Each vertex has a unique self-assigned identifier (RID)

› Format: #:<cluster-id>:<cluster-position>› List of properties› Edge’s RID (in & out)

Page 22: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited22

Edges› Record identifier (RID)› Each record has it’s own self-assigned unique ID

› Composed of 2 parts#:<cluster-id>:<cluster-position>

› in (RID of the incoming vertex)› out (RID of the outgoing vertex)

Page 23: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited23

Relationships› Doesn't make use of JOINS like RDBMS› Physical links O(1)› Relationship managed by storing the edge’s RID in both vertices as “out” and “in”

› For 1-to-n relationship collections of rid are used

Page 24: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited24

Relationships

drives

out: [#14:10]name: Abdo

@class: Driver

#14:10

#13:20

out: [#13:20]in: [#15:20]

license: A134@class: Drives

#15:20

in: [#14:10]model: Q7doors: 5

name: BMW@class: Car

Page 25: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited25

Demo

Page 26: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited26

API Interfaces• 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

Page 27: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited27

Getting Started for FreeOrientDB Community Edition is FREE for any purpose (Apache 2 license)http://orientdb.com/docs

Udemy Getting Started Training is Free ★★★★★http://www.orientechnologies.com/getting-started

Page 28: Intoduction to OrientDB

Page / Copyright ©2014 by Readify Limited28

?