• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
OrientDB the graph database
 

OrientDB the graph database

on

  • 4,347 views

 

Statistics

Views

Total Views
4,347
Views on SlideShare
3,872
Embed Views
475

Actions

Likes
4
Downloads
67
Comments
0

2 Embeds 475

http://jeeconf.com 453
http://aws.w3db.us 22

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    OrientDB the graph database OrientDB the graph database Presentation Transcript

    • 1.0May2012 www.orientechnologies.com
    • Artem Orobets Senior Java Developer in ExigenServices 1.5 year in Java OrientDB committerAndrey LomakinSoftware Architectin ExigenServices6+ years JEE experienceOrientDB committer
    • OrientDB = best features of newest NoSQL solutions +best features of Relational DBMS + True Graph engine www.orientechnologies.com
    • Relationships are direct linksno Relational JOINS to connect multiple tables Load trees and graphs in few ms! www.orientechnologies.com
    • Complex typesnative support for collections, maps (key/value) and embedded documentsno more additional tables to handle them www.orientechnologies.com
    • Schema-mixedschema with mandatory and optional fields + constraints the best of schema-less and schema-full modes www.orientechnologies.com
    • ACID Transactionsdb.begin();try{ // your code ... db.commit();} catch( Exception e ) { db.rollback();} www.orientechnologies.com
    • SQLselect * from employee where name like %Jay% and status=0 www.orientechnologies.com
    • SELECT SUM(price) as prices, SUM(cost) as costs, prices-costs, margin/price FROM Balance VSfunction (key, values) { var price = 0.0, cost = 0.0, margin = 0.0, marginPercent = 0.0; for (var i = 0; i < values.length; i++) { price += values[i].price; cost += values[i].cost; } margin = price - cost; marginPercent = margin / price; return { price: price, cost: cost, margin: margin, marginPercent: marginPercent };} www.orientechnologies.com
    • SQL & relationshipsselect from Account where address.city.country.name = Italyselect from Account where addresses contains (city.country.name = Italy) www.orientechnologies.com
    • SQL & schema- lessselect from Profile where any() like %Jay%select from Stock where all() is not null www.orientechnologies.com
    • HTTP RESTful firewall friendlyuse it from the webbrowser use it from the ESB (SOA) www.orientechnologies.com
    • Native{ JSON @rid = 26:10, @class = Developer, name : Luca, surname : Garulli, out : [ #10:33, #10:232 ]} www.orientechnologies.com
    • Binary protocol available for Java and soon C, C++ and Ruby www.orientechnologies.com
    • MVRB-Tree index the best of B+Tree and RB-Treefast on browsing, low insertion cost www.orientechnologies.com
    • Hooks similar to triggerscatch events against records, database and transactions implement custom cascade deletion algorithm enforce constraints www.orientechnologies.com
    • Securityusers and roles, encrypted passwords fine grain privileges www.orientechnologies.com
    • Multi-Master architectureany node can read/write to the database this scale up horizontly adding nodes is straightforward
    • The actorsLeader Node Only 1 per Leader per cluster, checks other nodes and notify changes to other Peer Nodes. Any server node in the cluster. Has a permanent Peer Node connection to the Leader Node Clients are connected to Server Nodes no matter if Leader Client or Peer Database Database, where data are stored Synchronous mode replication. Asynchronous mode replication.
    • Cluster auto-discoveringAt start up each Server Node sends a IP Multicast message in broadcast to discover if any Leader Node is available to join the cluster. Server #1 (Leader) DB DB DB DB DB DB Server #2 (Peer) DB DB DB DB DB DB
    • One Leader Multiple PeersThe first node to start is always the Leader but in case of failure can be elected any other. Server #1 (Leader) DB DB DBDB DB DB Server #2 Server #3 (Peer) (Peer) DB DB DBDB DB DB DB DB DBDB DB
    • SecurityTo join a cluster the Server Node has to configure the cluster name and password Broadcast messages are encrypted using the password Server #1 (Leader) Server #2 Join the cluster (Peer) ONLY If knows the name DB DB DB DB DB DB and password
    • Multiple clusters Multiple separate clusters can coexist in the same network Clusters cant see each others. Are separated boxes What identify a cluster is name + passwordCluster A, passwordaaa Server #1 Cluster B, password (Leader) bbb Server #2 Server #1 (Peer) (Leader) Server #3 (Peer) Server #2 (Peer) Server #3 (Peer)
    • Synchronous ReplicationGuarantees two databases are always consistent More expensive than asynchronous Server #1 Server #2 DB-1 DB-2
    • Synchronous Replication steps Client #1 6) Sends back OK to Client1) Update record #1request 3) Propagates the update Server #1 Server #22) Update record to DB-1 5) Sends back OK to Server #1 4) update record to DB-2 DB-1 DB-2
    • Asynchronous Replication Changes are propagated without waiting for the answerTwo databases could be not consistent in the range of few ms Server #1 Server #2 DB-1 DB-2
    • Asynchronous Replication steps (4a and 4b are executed in parallel) Client #1 4a) Sends back OK to Client #11) Update record request 3) Propagates the update Server #1 Server #2 2) Update record to DB-1 4b) update record to DB-2 DB-1 DB-2
    • Conflict ManagementThe conflicts resolution strategy can be plugged by providing implementations of the OReplicationConflictResolver interface Server #2 Conflict Strategy DB-2
    • Conflict Management Default strategy Server #2Default implementation:Conflict mark is created Defaultand conflict should be Conflict DB-2 resolved manually Strategy Conflict Log
    • Graph Database model wrapper on top of Document DatabaseFew simple concepts: Vertex, Edge, Property and Index www.orientechnologies.com
    • 2 different API OGraphDatabase All APIsNative, damn fast, not the most beautiful API are compatible among them! So use the right one for the right case OrientGraph TinkerPop Blueprints, slowest but: common to other impls, Gremlin, SPARQL www.orientechnologies.com
    • TinkerPop technologies sort of “standard” for GraphDB a lot of free open-source projects http://tinkerpop.com www.orientechnologies.com
    • TinkerPop Blueprintsbasic API to interact with GraphDB implements transactional and indexable property graph model bidirectional edges www.orientechnologies.com
    • TinkerPop Gremli scripting language easy to learn and understandUsed for operations against graphs www.orientechnologies.com
    • g.v(89).outE(followed_by) .inV.outE(sung_by).inV.has(name,Garcia).back(3).name
    • Inheritance OgraphVertex (V) OgraphEdge (E) Person Works Reside Knows Vehicle Address : Address brand : BRANDS s since : since : Date Level : Date till : Date LEVELSCustome Provider r totBuyed :totSold : float float www.orientechnologies.com
    • Polymorphic SQL QueryList<ODocument> result = database.query( newOSQLSynchQuery( "select from Person where city.name = Rome" )); Queries are polymorphics and subclasses of Person can be part of result set www.orientechnologies.com
    • Fetch plans Choose what to fetch on query and vertexes/edges loadingVertexes/Edges not fetched will be lazy-loaded on request Optimizes network latency www.orientechnologies.com
    • Fetch plans Load only the root vertexVertex = *:1 Luca | | lives city +---------> Vertex ------------> Vertex | 10th street Italy | knows +--------->* [Vertex Vertex Vertex ] [ Marko John Nicholas] www.orientechnologies.com
    • Fetch plans Load root + addressVertex = *:1 lives:2 Luca | | lives city +---------> Vertex ------------> Vertex | 10th street Italy | knows +--------->* [Vertex Vertex Vertex ] [ Marko John Nicholas] www.orientechnologies.com
    • Fetch plans Load root + all knownVertex = *:1 knows:1 Luca | | lives city +---------> Vertex ------------> Vertex | 10th street Italy | knows +--------->* [Vertex Vertex Vertex ] [ Marko John Nicholas] www.orientechnologies.com
    • Fetch plans Load up 3rd level of depthVertex = *:3 Luca | | lives city +---------> Vertex ------------> Vertex | 10th street Italy | knows +--------->* [Vertex Vertex Vertex ] [ Marko John Nicholas] www.orientechnologies.com
    • ConsoleORIENT database v.1.0.0 www.orientechnologies.comType help to display all the commands supported.> connect remote:localhost/demo admin adminConnecting to database [remote:localhost/demo] with user admin...OK> select from profile where nick.startsWith(L)---+--------+--------------------+--------------------+--------------------+ #| REC ID |NICK |SEX |AGE |---+--------+--------------------+--------------------+--------------------+ 0| 10:0|Lvca |male |34 1| 10:3|Leo |male |22 2| 10:7|Luisa |female |273 item(s) found. Query executed in 0.013 sec(s).> closeDisconnecting from the database [demo]...OK> quit www.orientechnologies.com
    • OrientDB Studio/SQL query Resultset is editable and changes are immediately persistent! www.orientechnologies.com
    • OrientDB Studio/View graph www.orientechnologies.com
    • Upcoming features New hash Indexes, query performance boost, data consistency check,new transaction lock mechanics, object DB improvements
    • Production usage Finance Solutions Of America
    • NuvolaBase.com (beta) The first Graph Database on the Cloud always available few seconds to setup it use it from app & mobile www.orientechnologies.com
    • User’s reasons to chose Only one graph DB with cloud computing support, high flexibility of data format, powerful data analyzes (SQL + Gremlin),JDBC driver, huge reduction of integration time, good technical support.
    • Blueprints microbenchmarksModule OrientDB Neo4j DEXRelease 1.0-SNAPSHOT 1.7M03 4.5.1VertexTestSuite 11,628.98 30,535.02 4,686.65EdgeTestSuite 7,712.06 41,206.89 58,671.90GraphTestSuite 9,073.09 55,102.35 7,428.25IndexableGraphTestSuite 4,620.61 11,299.02 1070.75IndexTestSuite 2,072.23 5,239.92 not supportedAutomaticIndexTestSuite 3,252.48 9,402.59 not supportedTransactionGraphTestSuite 7,659.67 22,787.29 not supportedGraphMLReaderTestSuite 4,064.23 5,440.67 not supported git clone git://github.com/tinkerpop/blueprints.git mvn clean install
    • Always FreeOpen Source Apache 2 license free for any purposes, even commercials www.orientechnologies.com
    • No dependencies with 3rd parties software no conflicts with other softwarejust 1 Mb of run-time libraries www.orientechnologies.com
    • Ø config download, unzip, run! cut & paste the db www.orientechnologies.com
    • Luca Garulli Founder of OrientDB Andrey Lomakin Committer of OrientDB Artem Orobets @lgarulli, Commiter of OrientDB@Andrey_Lomakin, @Dr_EniSh www.orientechnologies.com