SlideShare a Scribd company logo
1 of 76
Introduction data
structure for GraphDB
          mixi.inc
       Shunya Kimura
         @kimuras
agenda

• Motivation
• Introduction
• Structure for Node
• Create Node
• Appendix
Motivation
• Just interesting in GraphDB data structure
• Why fast
• Mysterious
Introduction
Neo4j
• OSS implement of GraphDB
• High availability
• Scales to billions of nods and relationships
• High speed querying through traversals
• For more Information about Neo4j
 • http://www.slideshare.net/skimura/
Introduction for Graph
   Node

  Name: Kimura
    Job: Eng

                 Relationship
Introduction for Graph
   Node

  Name: Kimura
    Job: Eng

                 Relationship
Introduction for Graph
     Node

 Data Structure
  Create Node
                  Relationship
Structure for Node
A node data structure
Node Manager
A node data structure
Node Manager

  Node Cache
A node data structure
Node Manager

  Node Cache   Relation Cache
A node data structure
Node Manager

  Node Cache   Relation Cache   Cache Manager
A node data structure
Node Manager

  Node Cache      Relation Cache   Cache Manager


 Property Index
    Manager
A node data structure
Node Manager

  Node Cache        Relation Cache      Cache Manager


 Property Index
                  Transaction Manager
    Manager
A node data structure
Node Manager

  Node Cache        Relation Cache        Cache Manager


 Property Index
                  Transaction Manager   Persistence Manager
    Manager
A node data structure
  Node Manager

           Node Cache                 Relation Cache               Cache Manager


          Property Index
                                  Transaction Manager          Persistence Manager
             Manager




     id                         id                      id                         id

relationships              relationships           relationships            relationships


  Node                       Node                      Node                   Node
Node Manager

•   NodeCache: Caching node id and node object

•   RelationCache: Caching rel id and Relation object

•   Cache Manager: Management cache threads

•   Property Index Manager: Management all nodes
    Properties

•   Persistence Manager: Management store
Relationship structure


      id

 relationships


   Node
Relationship structure


      id


relationships
    Node
Relationship structure

           Array structure for relationships
      id


relationships
    Node
Relationship structure

        relationships

           In Blocks

          Out Blocks


           Node
Relationship structure
Node                    Node


        relationships

           In Blocks
Node                    Node
          Out Blocks


           Node

Node                    Node




Node                    Node
Relationship structure
       In Direction
Node                             Node


                 relationships

                    In Blocks
Node                             Node
                   Out Blocks


                      Node

Node                             Node




Node                             Node
Relationship structure
       In Direction
Node                                Node


                 relationships

                    In Blocks
Node                                Node
                   Out Blocks


                      Node

Node                                Node

                        Out Direction

Node                                Node
Relationship structure
                 Node

      id

 relationships
Relationship structure
                    Node

         id

    relationships




relationships
Relationship structure
                            Node

          id

     relationships




relationships

 In blocks
  ID:1    ID:2       ID:3   ID:4   ID:5   ID:6   ID:7   ID:8   ID:9
Relationship structure
                            Node

          id

     relationships




relationships

 In blocks
  ID:1    ID:2       ID:3   ID:4   ID:5   ID:6   ID:7   ID:8   ID:9

 Out blocks
 ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
Relationship structure
                                Node

          id                Last In block

     relationships




relationships

 In blocks
  ID:1    ID:2       ID:3      ID:4         ID:5   ID:6   ID:7   ID:8   ID:9

 Out blocks
 ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
Relationship structure
                                 Node

          id                Last In block

     relationships          Last Out block




relationships

 In blocks
  ID:1    ID:2       ID:3      ID:4         ID:5   ID:6   ID:7   ID:8   ID:9

 Out blocks
 ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
Create Nodes
Create Node

• Understanding data structure with creating
  nodes
 • Create Node A
 • Create Node B
 • Create Relationship A to B
Create Node
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH );
Node NodeA = graphDb.createNode();
Node NodeB = graphDb.createNode();
Relationship relationship =
NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS );
Create Node
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH );
Node NodeA = graphDb.createNode();
Node NodeB = graphDb.createNode();
Relationship relationship =
NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS );




                    NodeA
Create Node
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH );
Node NodeA = graphDb.createNode();
Node NodeB = graphDb.createNode();
Relationship relationship =
NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS );




                    NodeA                 NodeB
Create Node
GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH );
Node NodeA = graphDb.createNode();
Node NodeB = graphDb.createNode();
Relationship relationship =
NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS );




                    NodeA                 NodeB
Introduction Create Node
Introduction Create Node




     NodeA
Introduction Create Node

     Node Manager


      Node Cache

   Persistence Manager

     Relation Cache




             NodeA
Introduction Create Node
               Create New ID   id


     Node Manager


      Node Cache

   Persistence Manager

     Relation Cache




             NodeA
Introduction Create Node
               Create New ID   id
                                    Create Node

     Node Manager
                                              id
      Node Cache
                                         relationships
   Persistence Manager

                                          NodeA
     Relation Cache




             NodeA
Introduction Create Node
               Create New ID      id
                                               Create Node

     Node Manager
                                                         id
                         register Node cache
      Node Cache
                                                    relationships
   Persistence Manager

                                                     NodeA
     Relation Cache




             NodeA
Introduction Create Node
               Create New ID          id
                                                 Create Node

     Node Manager
                                                             id
                           register Node cache
      Node Cache
                                                        relationships
   Persistence Manager
                         register Persistence Manager
                                                         NodeA
     Relation Cache




             NodeA
Cache

• You can choice some cache type
 • Strong Reference Cache
 • Soft LRU Cache (default)
 • Weak LRU Cache
 • No Cache
What is LRU Cache
• discards the least recently used items first.
                   http://en.wikipedia.org/wiki/Cache_algorithms
What is LRU Cache
• discards the least recently used items first.
                   http://en.wikipedia.org/wiki/Cache_algorithms


                                   On memory
                                 KEY              VALUE
                                    1               VAL_1

                                    2               VAL_2

                                    3               VAL_3

                                    4               VAL_4

                                    5               VAL_5
What is LRU Cache
• discards the least recently used items first.
                   http://en.wikipedia.org/wiki/Cache_algorithms


                                   On memory
                                 KEY              VALUE
                                    1               VAL_1

                                    2               VAL_2
               Priority             3               VAL_3

                                    4               VAL_4

                                    5               VAL_5
What is LRU Cache
 • discards the least recently used items first.
                    http://en.wikipedia.org/wiki/Cache_algorithms


                                    On memory
                                  KEY              VALUE
GET KEY:5                            1               VAL_1

                                     2               VAL_2
                Priority             3               VAL_3

                                     4               VAL_4

                                     5               VAL_5
What is LRU Cache
 • discards the least recently used items first.
                    http://en.wikipedia.org/wiki/Cache_algorithms


                                    On memory
                                  KEY              VALUE
GET KEY:5                            5               VAL_5

                                     1               VAL_1
                Priority             2               VAL_2

                                     3               VAL_3

                                     4               VAL_4
What is LRU Cache
• discards the least recently used items first.
                   http://en.wikipedia.org/wiki/Cache_algorithms


                                   On memory
                                 KEY              VALUE
                                    5               VAL_5

                                    1               VAL_1
               Priority             2               VAL_2

                                    3               VAL_3

                                    4               VAL_4
What is LRU Cache
 • discards the least recently used items first.
                    http://en.wikipedia.org/wiki/Cache_algorithms


                                    On memory
                                  KEY              VALUE
PUT KEY:6                            5               VAL_5

                                     1               VAL_1
                Priority             2               VAL_2

                                     3               VAL_3

                                     4               VAL_4
What is LRU Cache
 • discards the least recently used items first.
                    http://en.wikipedia.org/wiki/Cache_algorithms


                                    On memory
                                  KEY              VALUE
PUT KEY:6                            6               VAL_6

                                     5               VAL_5
                Priority             1               VAL_1

                                     2               VAL_2

                                     3               VAL_3
Soft LRU Cache
Soft LRU Cache

 Soft LRU Cache


Cache (ConcurrentHashMap)


Queue (SoftReferenceQueue)
Soft LRU Cache
                             ConcurrentHashMap

                                  KEY            VALUE

                                   1             ref_1
 Soft LRU Cache
                                   2             ref_2

                                   3             ref_3
Cache (ConcurrentHashMap)


Queue (SoftReferenceQueue)
Soft LRU Cache
                                                               ConcurrentHashMap

                                                                        KEY            VALUE

                                                                            1           ref_1
          Soft LRU Cache
                                                                            2           ref_2

                                                                            3           ref_3
        Cache (ConcurrentHashMap)

                                                                 SoftRefrenceQueue
       Queue (SoftReferenceQueue)
                                                                            KEY   VALUE(※SoftRefrence)

                                                                            1            ref_1

                                                                            2            ref_2

                                                                            3            ref_3


 ※Soft reference objects, which are cleared at the discretion of the garbage collector in response to memory
demand.
http://docs.oracle.com/javase/7/docs/api/java/lang/ref/SoftReference.html
Soft LRU Cache
                                                               ConcurrentHashMap

                                                                        KEY            VALUE

                                                                            1           ref_1
          Soft LRU Cache
                                                                            2           ref_2

                                                                            3           ref_3
        Cache (ConcurrentHashMap)

                                                                 SoftRefrenceQueue
       Queue (SoftReferenceQueue)
                                                                            KEY   VALUE(※SoftRefrence)

                                                                            1            ref_1

                                                                            2            ref_2

                                                                            3            ref_3


 ※Soft reference objects, which are cleared at the discretion of the garbage collector in response to memory
demand.
http://docs.oracle.com/javase/7/docs/api/java/lang/ref/SoftReference.html
Comparing Cache type
 Cache Type          Queue Type          Reference Type

 Weak LRU Cache     WeakReferenceQueue     WeakReference


  Soft LRU Cache     SoftRefrenceQueue     SoftReference


 Strong Reference
                           None                None
      Cache


Remaining Reference on memory
Strong > Soft > Weak
Introduction Create Node
               Create New ID          id
                                                 Create Node

     Node Manager
                                                             id
                           register Node cache
      Node Cache
                                                        relationships
   Persistence Manager
                         register Persistence Manager
                                                         NodeA
     Relation Cache




             NodeA
Introduction Create Node
               Create New ID          id
                                                 Create Node

     Node Manager
                                                             id
                           register Node cache
      Node Cache
                                                        relationships
   Persistence Manager
                         register Persistence Manager
                                                         NodeA
     Relation Cache




             NodeA                             NodeB
Introduction Create Node




     NodeA     NodeB
Introduction Create Node




     NodeA     NodeB
Introduction Create Node
                                           id


  Node Manager                        relationships


   Node Cache                          NodeA

Persistence Manager

                                           id
  Relation Cache
                                      relationships


                                       NodeB



                      NodeA   NodeB
Introduction Create Node
                                                         id


  Node Manager                                      relationships


   Node Cache                                        NodeA
                              Register OUT direction to NodeB
Persistence Manager

                                                         id
  Relation Cache
                                                    relationships


                                                     NodeB



                      NodeA              NodeB
Introduction Create Node
                                                                       id


  Node Manager                                                    relationships


   Node Cache                                                      NodeA
                                            Register OUT direction to NodeB
Persistence Manager

                                                                       id
  Relation Cache
                                                                  relationships
                              Register IN direction from NodeA

                                                                   NodeB



                      NodeA                             NodeB
Introduction Create Node
                                           id


  Node Manager                        relationships


   Node Cache                          NodeA

Persistence Manager

                                           id
  Relation Cache
                                      relationships


                                       NodeB



                      NodeA   NodeB
Introduction Create Node
                   Create New Relation ID
                                      rel id                id


  Node Manager                                         relationships


   Node Cache                                           NodeA

Persistence Manager

                                                            id
  Relation Cache
                                                       relationships


                                                        NodeB



                       NodeA                   NodeB
Introduction Create Node
                   Create New Relation ID
                                                  create Relationship
                                      rel id                                 id


  Node Manager                                                          relationships


   Node Cache                                                            NodeA
                                       Relation

Persistence Manager

                                                                             id
  Relation Cache
                                                                        relationships


                                                                         NodeB



                       NodeA                                   NodeB
Introduction Create Node
                   Create New Relation ID
                                                  create Relationship
                                      rel id                                 id


  Node Manager                                                          relationships


   Node Cache                                                            NodeA
                                       Relation

Persistence Manager

                                                                             id
  Relation Cache
                                                                        relationships


                                                                         NodeB



                       NodeA                                   NodeB
Appendix
Implemented Graph
        Algorithms
• Centrality
 • Betweenness Centrality
 • Closeness Centrality
• Path
 • A*
 • Dijkstart
 • Shortest Path
announcement
(NL   )


  (DSIRNLP)
(Tokyo NLP)
(Japan.R)
  (                    )

  (TokyoWebmining)
  (MongoDB Japan)
                      http://www.ipsj.or.jp/10jigyo/taikai/74kai/event_2-6.html
Thanks!

More Related Content

Similar to GraphDB data structure introduction

2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm MeetupMårten Gustafson
 
Webinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBMongoDB
 
NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)Pavlo Baron
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
BADCamp 2008 DB Sync
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB SyncShaun Haber
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph databaseartem_orobets
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph databaseArtem Orobets
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecturedrewz lin
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecturemysqlops
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01jgregory1234
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构yiditushe
 
Inside Sql Azure - Cihan Biyikoglu - SQL Azure
Inside Sql Azure - Cihan Biyikoglu - SQL AzureInside Sql Azure - Cihan Biyikoglu - SQL Azure
Inside Sql Azure - Cihan Biyikoglu - SQL AzureCihan Biyikoglu
 
Cs c -3_0_cookbook_3rd_edition_-_o_reilly
Cs c -3_0_cookbook_3rd_edition_-_o_reillyCs c -3_0_cookbook_3rd_edition_-_o_reilly
Cs c -3_0_cookbook_3rd_edition_-_o_reillythanhduoc
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0Karsten Dambekalns
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsasync_io
 

Similar to GraphDB data structure introduction (20)

2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup
 
Webinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDB
 
NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
BADCamp 2008 DB Sync
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB Sync
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
 
Context at design
Context at designContext at design
Context at design
 
Neo4j Davide Francesconi
Neo4j Davide FrancesconiNeo4j Davide Francesconi
Neo4j Davide Francesconi
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构
 
Inside Sql Azure - Cihan Biyikoglu - SQL Azure
Inside Sql Azure - Cihan Biyikoglu - SQL AzureInside Sql Azure - Cihan Biyikoglu - SQL Azure
Inside Sql Azure - Cihan Biyikoglu - SQL Azure
 
Cs c -3_0_cookbook_3rd_edition_-_o_reilly
Cs c -3_0_cookbook_3rd_edition_-_o_reillyCs c -3_0_cookbook_3rd_edition_-_o_reilly
Cs c -3_0_cookbook_3rd_edition_-_o_reilly
 
A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0A Content Repository for TYPO3 5.0
A Content Repository for TYPO3 5.0
 
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
 

Recently uploaded

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

GraphDB data structure introduction

  • 1. Introduction data structure for GraphDB mixi.inc Shunya Kimura @kimuras
  • 2. agenda • Motivation • Introduction • Structure for Node • Create Node • Appendix
  • 4. • Just interesting in GraphDB data structure • Why fast • Mysterious
  • 6. Neo4j • OSS implement of GraphDB • High availability • Scales to billions of nods and relationships • High speed querying through traversals • For more Information about Neo4j • http://www.slideshare.net/skimura/
  • 7. Introduction for Graph Node Name: Kimura Job: Eng Relationship
  • 8. Introduction for Graph Node Name: Kimura Job: Eng Relationship
  • 9. Introduction for Graph Node Data Structure Create Node Relationship
  • 11. A node data structure Node Manager
  • 12. A node data structure Node Manager Node Cache
  • 13. A node data structure Node Manager Node Cache Relation Cache
  • 14. A node data structure Node Manager Node Cache Relation Cache Cache Manager
  • 15. A node data structure Node Manager Node Cache Relation Cache Cache Manager Property Index Manager
  • 16. A node data structure Node Manager Node Cache Relation Cache Cache Manager Property Index Transaction Manager Manager
  • 17. A node data structure Node Manager Node Cache Relation Cache Cache Manager Property Index Transaction Manager Persistence Manager Manager
  • 18. A node data structure Node Manager Node Cache Relation Cache Cache Manager Property Index Transaction Manager Persistence Manager Manager id id id id relationships relationships relationships relationships Node Node Node Node
  • 19. Node Manager • NodeCache: Caching node id and node object • RelationCache: Caching rel id and Relation object • Cache Manager: Management cache threads • Property Index Manager: Management all nodes Properties • Persistence Manager: Management store
  • 20. Relationship structure id relationships Node
  • 21. Relationship structure id relationships Node
  • 22. Relationship structure Array structure for relationships id relationships Node
  • 23. Relationship structure relationships In Blocks Out Blocks Node
  • 24. Relationship structure Node Node relationships In Blocks Node Node Out Blocks Node Node Node Node Node
  • 25. Relationship structure In Direction Node Node relationships In Blocks Node Node Out Blocks Node Node Node Node Node
  • 26. Relationship structure In Direction Node Node relationships In Blocks Node Node Out Blocks Node Node Node Out Direction Node Node
  • 27. Relationship structure Node id relationships
  • 28. Relationship structure Node id relationships relationships
  • 29. Relationship structure Node id relationships relationships In blocks ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9
  • 30. Relationship structure Node id relationships relationships In blocks ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9 Out blocks ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
  • 31. Relationship structure Node id Last In block relationships relationships In blocks ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9 Out blocks ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
  • 32. Relationship structure Node id Last In block relationships Last Out block relationships In blocks ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9 Out blocks ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
  • 34. Create Node • Understanding data structure with creating nodes • Create Node A • Create Node B • Create Relationship A to B
  • 35. Create Node GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH ); Node NodeA = graphDb.createNode(); Node NodeB = graphDb.createNode(); Relationship relationship = NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS );
  • 36. Create Node GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH ); Node NodeA = graphDb.createNode(); Node NodeB = graphDb.createNode(); Relationship relationship = NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS ); NodeA
  • 37. Create Node GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH ); Node NodeA = graphDb.createNode(); Node NodeB = graphDb.createNode(); Relationship relationship = NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS ); NodeA NodeB
  • 38. Create Node GraphDatabaseService graphDb = new EmbeddedGraphDatabase( DB_PATH ); Node NodeA = graphDb.createNode(); Node NodeB = graphDb.createNode(); Relationship relationship = NodeA.createRelationshipTo( NodeB, RelTypes.KNOWS ); NodeA NodeB
  • 41. Introduction Create Node Node Manager Node Cache Persistence Manager Relation Cache NodeA
  • 42. Introduction Create Node Create New ID id Node Manager Node Cache Persistence Manager Relation Cache NodeA
  • 43. Introduction Create Node Create New ID id Create Node Node Manager id Node Cache relationships Persistence Manager NodeA Relation Cache NodeA
  • 44. Introduction Create Node Create New ID id Create Node Node Manager id register Node cache Node Cache relationships Persistence Manager NodeA Relation Cache NodeA
  • 45. Introduction Create Node Create New ID id Create Node Node Manager id register Node cache Node Cache relationships Persistence Manager register Persistence Manager NodeA Relation Cache NodeA
  • 46. Cache • You can choice some cache type • Strong Reference Cache • Soft LRU Cache (default) • Weak LRU Cache • No Cache
  • 47. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms
  • 48. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE 1 VAL_1 2 VAL_2 3 VAL_3 4 VAL_4 5 VAL_5
  • 49. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE 1 VAL_1 2 VAL_2 Priority 3 VAL_3 4 VAL_4 5 VAL_5
  • 50. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE GET KEY:5 1 VAL_1 2 VAL_2 Priority 3 VAL_3 4 VAL_4 5 VAL_5
  • 51. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE GET KEY:5 5 VAL_5 1 VAL_1 Priority 2 VAL_2 3 VAL_3 4 VAL_4
  • 52. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE 5 VAL_5 1 VAL_1 Priority 2 VAL_2 3 VAL_3 4 VAL_4
  • 53. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE PUT KEY:6 5 VAL_5 1 VAL_1 Priority 2 VAL_2 3 VAL_3 4 VAL_4
  • 54. What is LRU Cache • discards the least recently used items first. http://en.wikipedia.org/wiki/Cache_algorithms On memory KEY VALUE PUT KEY:6 6 VAL_6 5 VAL_5 Priority 1 VAL_1 2 VAL_2 3 VAL_3
  • 56. Soft LRU Cache Soft LRU Cache Cache (ConcurrentHashMap) Queue (SoftReferenceQueue)
  • 57. Soft LRU Cache ConcurrentHashMap KEY VALUE 1 ref_1 Soft LRU Cache 2 ref_2 3 ref_3 Cache (ConcurrentHashMap) Queue (SoftReferenceQueue)
  • 58. Soft LRU Cache ConcurrentHashMap KEY VALUE 1 ref_1 Soft LRU Cache 2 ref_2 3 ref_3 Cache (ConcurrentHashMap) SoftRefrenceQueue Queue (SoftReferenceQueue) KEY VALUE(※SoftRefrence) 1 ref_1 2 ref_2 3 ref_3 ※Soft reference objects, which are cleared at the discretion of the garbage collector in response to memory demand. http://docs.oracle.com/javase/7/docs/api/java/lang/ref/SoftReference.html
  • 59. Soft LRU Cache ConcurrentHashMap KEY VALUE 1 ref_1 Soft LRU Cache 2 ref_2 3 ref_3 Cache (ConcurrentHashMap) SoftRefrenceQueue Queue (SoftReferenceQueue) KEY VALUE(※SoftRefrence) 1 ref_1 2 ref_2 3 ref_3 ※Soft reference objects, which are cleared at the discretion of the garbage collector in response to memory demand. http://docs.oracle.com/javase/7/docs/api/java/lang/ref/SoftReference.html
  • 60. Comparing Cache type Cache Type Queue Type Reference Type Weak LRU Cache WeakReferenceQueue WeakReference Soft LRU Cache SoftRefrenceQueue SoftReference Strong Reference None None Cache Remaining Reference on memory Strong > Soft > Weak
  • 61. Introduction Create Node Create New ID id Create Node Node Manager id register Node cache Node Cache relationships Persistence Manager register Persistence Manager NodeA Relation Cache NodeA
  • 62. Introduction Create Node Create New ID id Create Node Node Manager id register Node cache Node Cache relationships Persistence Manager register Persistence Manager NodeA Relation Cache NodeA NodeB
  • 65. Introduction Create Node id Node Manager relationships Node Cache NodeA Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 66. Introduction Create Node id Node Manager relationships Node Cache NodeA Register OUT direction to NodeB Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 67. Introduction Create Node id Node Manager relationships Node Cache NodeA Register OUT direction to NodeB Persistence Manager id Relation Cache relationships Register IN direction from NodeA NodeB NodeA NodeB
  • 68. Introduction Create Node id Node Manager relationships Node Cache NodeA Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 69. Introduction Create Node Create New Relation ID rel id id Node Manager relationships Node Cache NodeA Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 70. Introduction Create Node Create New Relation ID create Relationship rel id id Node Manager relationships Node Cache NodeA Relation Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 71. Introduction Create Node Create New Relation ID create Relationship rel id id Node Manager relationships Node Cache NodeA Relation Persistence Manager id Relation Cache relationships NodeB NodeA NodeB
  • 73. Implemented Graph Algorithms • Centrality • Betweenness Centrality • Closeness Centrality • Path • A* • Dijkstart • Shortest Path
  • 75. (NL ) (DSIRNLP) (Tokyo NLP) (Japan.R) ( ) (TokyoWebmining) (MongoDB Japan) http://www.ipsj.or.jp/10jigyo/taikai/74kai/event_2-6.html

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n
  55. \n
  56. \n
  57. \n
  58. \n
  59. \n
  60. \n
  61. \n
  62. \n
  63. \n
  64. \n
  65. \n
  66. \n
  67. \n
  68. \n
  69. \n
  70. \n
  71. \n
  72. \n
  73. \n
  74. \n
  75. \n
  76. \n
  77. \n
  78. \n
  79. \n
  80. \n
  81. \n
  82. \n
  83. \n
  84. \n
  85. \n
  86. \n
  87. \n
  88. \n
  89. \n
  90. \n
  91. \n
  92. \n
  93. \n
  94. \n
  95. \n
  96. \n
  97. \n
  98. \n
  99. \n
  100. \n
  101. \n
  102. \n
  103. \n
  104. \n
  105. \n
  106. \n
  107. \n
  108. \n
  109. \n
  110. \n
  111. \n
  112. \n
  113. \n
  114. \n
  115. \n
  116. \n
  117. \n
  118. \n
  119. \n
  120. \n
  121. \n
  122. \n
  123. \n
  124. \n
  125. \n
  126. \n
  127. \n
  128. \n
  129. \n
  130. \n
  131. \n
  132. \n
  133. \n
  134. \n
  135. \n
  136. \n
  137. \n
  138. \n
  139. \n
  140. \n
  141. \n
  142. \n
  143. \n
  144. \n
  145. \n
  146. \n
  147. \n
  148. \n
  149. \n
  150. \n
  151. \n
  152. \n
  153. \n
  154. \n
  155. \n
  156. \n
  157. \n
  158. \n
  159. \n
  160. \n
  161. \n
  162. \n
  163. \n
  164. \n
  165. \n
  166. \n
  167. \n
  168. \n
  169. \n
  170. \n
  171. \n
  172. \n
  173. \n
  174. \n
  175. \n
  176. \n
  177. \n
  178. \n
  179. \n
  180. \n
  181. \n
  182. \n
  183. \n
  184. \n
  185. \n
  186. \n
  187. \n
  188. \n
  189. \n
  190. \n
  191. \n
  192. \n
  193. \n
  194. \n
  195. \n
  196. \n
  197. \n
  198. \n
  199. \n
  200. \n
  201. \n
  202. \n