OrientDB Codemotion 2014

Preview:

DESCRIPTION

Slides of my speech at Codemotion 2014 about OrientDB

Citation preview

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

ROME 11-12 april 2014 - Luigi Dell’Aquila

Relational Databases:

Everybody knows what a TABLE is

Everybody knows SQL

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are tables,Data ARE Tables!

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

ROME 11-12 april 2014 - Luigi Dell’Aquila

But this is not

ROME 11-12 april 2014 - Luigi Dell’Aquila

These are

GRAPHS!

ROME 11-12 april 2014 - Luigi Dell’Aquila

And sometimesRepresenting them in tables

Can be difficultAnd

Inefficient

ROME 11-12 april 2014 - Luigi Dell’Aquila

Think about it…

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Links, References, Pointers

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Collections and Maps(and dynamic data structures!)

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Nested and complex objects

ROME 11-12 april 2014 - Luigi Dell’Aquila

When you write your codeYou have to deal with

Class hierarchies,Inheritance, Polymorphism

ROME 11-12 april 2014 - Luigi Dell’Aquila

Would You LikeA Storage Layer

That Supports ALLThese Conceps Out Of The Box?

ROME 11-12 april 2014

This is why

Was born

- Luigi Dell’Aquila

ROME 11-12 april 2014 - Luigi Dell’Aquila

Two data models:

Graphand

Document

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

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

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

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

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

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"

}]}

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"

}]}

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"

}]}

ROME 11-12 april 2014 - Luigi Dell’Aquila

Record ID (RID)

=

Physical position

ROME 11-12 april 2014 - Luigi Dell’Aquila

Traversing relationships

=

Following a physical path

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?)

ROME 11-12 april 2014 - Luigi Dell’Aquila

But OrientDBGives you more!

ROME 11-12 april 2014 - Luigi Dell’Aquila

Javascript In the Storage

Extend the query languageWith you own functions

ROME 11-12 april 2014 - Luigi Dell’Aquila

Javascript functions

As REST services

ROME 11-12 april 2014 - Luigi Dell’Aquila

But of course you can use it from

ROME 11-12 april 2014 - Luigi Dell’Aquila

90’s are gone

Today you need

ROME 11-12 april 2014 - Luigi Dell’Aquila

Scalability

ROME 11-12 april 2014 - Luigi Dell’Aquila

High availability

ROME 11-12 april 2014 - Luigi Dell’Aquila

Fault tolerance

ROME 11-12 april 2014 - Luigi Dell’Aquila

Today everybody(with a little luck)

Can write a killer appAnd reach billions of users

ROME 11-12 april 2014 - Luigi Dell’Aquila

provides:

Replication (Multi Master)and

Sharding

Also on cloud infrastructures

ROME 11-12 april 2014 - Luigi Dell’Aquila

HAZELCAST HAZELCAST

HAZELCAST

Multi Master

ROME 11-12 april 2014 - Luigi Dell’Aquila

Example

ROME 11-12 april 2014 - Luigi Dell’Aquila

HAZELCAST HAZELCAST

HAZELCAST

Amazon

Elastic Load

Balancing+

Auto Scaling

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 1/3

Key pair

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 2/3

Security group

ROME 11-12 april 2014 - Luigi Dell’Aquila

HOWTO 3/3

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: jobs@assetdata.it

References

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

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

OrientDB Planet