49
ROME 11-12 april 2014 ROME 11-12 april 2014 OrientDB: a Document-Graph Database ready for the Cloud OrientDB Committer OrientDB Academy Coordinator at Orient Technologies LTD Project Manager at AssetData S.r.l. Email: l.dellaquila – at – orientechnologies.com Twitter: @ldellaquila Luigi Dell’Aquila

OrientDB Codemotion 2014

Embed Size (px)

DESCRIPTION

Slides of my speech at Codemotion 2014 about OrientDB

Citation preview

Page 1: OrientDB Codemotion 2014

ROME 11-12 april 2014ROME 11-12 april 2014

OrientDB: a Document-Graph Database ready for the Cloud

OrientDB CommitterOrientDB Academy Coordinator at Orient Technologies LTDProject Manager at AssetData S.r.l.

Email: l.dellaquila – at – orientechnologies.comTwitter: @ldellaquila

Luigi Dell’Aquila

Page 2: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Relational Databases:

Everybody knows what a TABLE is

Everybody knows SQL

Page 3: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

Page 4: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

Page 5: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

Page 6: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

Page 7: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

Page 8: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

Page 9: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

Page 10: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

Page 11: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are

GRAPHS!

Page 12: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

And sometimesRepresenting them in tables

Can be difficultAnd

Inefficient

Page 13: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Think about it…

Page 14: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Links, References, Pointers

Page 15: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Collections and Maps(and dynamic data structures!)

Page 16: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Nested and complex objects

Page 17: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Class hierarchies,Inheritance, Polymorphism

Page 18: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Would You LikeA Storage Layer

That Supports ALLThese Conceps Out Of The Box?

Page 19: OrientDB Codemotion 2014

ROME 11-12 april 2014

This is why

Was born

- Luigi Dell’Aquila

Page 20: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Two data models:

Graphand

Document

Page 21: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Classes, not Tables

create class Person

create class Student extends Person

select from Person

Polymorphic query: returns both instances of Person and Student

Page 22: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Dynamic schema

create class Person

insert into Person (name, surname) values (“Luigi”, “Dell’Aquila”)

No need to fully specify the class structure, you can work in schemaless mode

Page 23: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Complex attributes

Update person set address = {

“street”: “5th Ave”, “city”: “NY”

}, tags = [“developer”, “artist”, “geek”]

Collections and embedded properties

Page 24: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Physical links(no Join!)

Update person set address.city = (select from city where name = ‘Rome’)

where name = ‘Luigi’

Select address.city.country.name from Person where name = ‘Luigi’

Dot notation instead of JoinNo need for foreign keys O(1) computational cost – compared to O(log N) in relational Join

Page 25: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

The Graph API(TinkerPop Blueprints)

Traverse out(“Friend”) from (select from Person where name =

‘Luigi’)while address.city = ‘Rome’

Find my friends network in my city (friends, firends of frineds, friends of friends of friends…)

Deep traversal, no need to know in advance HOW deep

Page 26: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Every record has unique IDSelect from Person

{"result": [{

"@rid": "#13:0","@class": “Person","name": "Luigi","surname": "Dell'Aquila","friendOf": "#13:1"

}]}

Page 27: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Every record has unique IDSelect from Person

{"result": [{

"@rid": "#13:0","@class": “Person","name": "Luigi","surname": "Dell'Aquila","friendOf": "#13:1"

}]}

Page 28: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Every record has unique IDSelect from Person

{"result": [{

"@rid": "#13:0","@class": “Person","name": "Luigi","surname": "Dell'Aquila","friendOf": "#13:1"

}]}

Page 29: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Record ID (RID)

=

Physical position

Page 30: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Traversing relationships

=

Following a physical path

Page 31: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

It means:

• Accessing linked data is very efficient• No calculation *• Independent from cluster size **• Deep traversal is allowed and encouraged ***

* In RDMS, a Join is calculated EVERY TIME you execute a query ** RDBS use index-based optimization to speed up joins, but index access is O(log N), so it depends on data size – what about Big Data??? *** in RDMS multiple joins are inefficient (would you dare to write a query with 1000 joins?)

Page 32: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But OrientDBGives you more!

Page 33: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Javascript In the Storage

Extend the query languageWith you own functions

Page 34: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Javascript functions

As REST services

Page 35: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

But of course you can use it from

Page 36: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

90’s are gone

Today you need

Page 37: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Scalability

Page 38: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

High availability

Page 39: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Fault tolerance

Page 40: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Today everybody(with a little luck)

Can write a killer appAnd reach billions of users

Page 41: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

provides:

Replication (Multi Master)and

Sharding

Also on cloud infrastructures

Page 42: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

HAZELCAST HAZELCAST

HAZELCAST

Multi Master

Page 43: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

Example

Page 44: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

HAZELCAST HAZELCAST

HAZELCAST

Amazon

Elastic Load

Balancing+

Auto Scaling

Page 45: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 1/3

Key pair

Page 46: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 2/3

Security group

Page 47: OrientDB Codemotion 2014

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 3/3

Page 48: OrientDB Codemotion 2014

ROME 11-12 april 2014ROME 11-12 april 2014

http://www.orientechnologies.com

http://www.orientechnologies.com/training

https://github.com/orientechnologies/orientdb/

Job opportunities: [email protected]

References

Page 49: OrientDB Codemotion 2014

ROME 11-12 april 2014ROME 11-12 april 2014

http://www.orientechnologies.com/event/orientdb-planet-first-conference-orientdb-rome-italy/

OrientDB Planet