SlideShare a Scribd company logo
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!
Ad

More Related Content

Similar to Introduction data structure for GraphDB (20)

2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup
Mårten Gustafson
 
Webinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDB
MongoDB
 
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.js
Rob O'Doherty
 
BADCamp 2008 DB Sync
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB Sync
Shaun Haber
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
Roger Xia
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
Gautam Rege
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
artem_orobets
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
Artem Orobets
 
Context at design
Context at designContext at design
Context at design
Kranthi Kumar
 
Neo4j Davide Francesconi
Neo4j Davide FrancesconiNeo4j Davide Francesconi
Neo4j Davide Francesconi
Davide Francesconi
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
Arun Kumar Arjunan
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01
jgregory1234
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
drewz lin
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
mysqlops
 
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 Azure
Cihan 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_reilly
thanhduoc
 
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
Karsten 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.js
async_io
 
2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm Meetup
Mårten Gustafson
 
Webinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDB
MongoDB
 
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.js
Rob O'Doherty
 
BADCamp 2008 DB Sync
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB Sync
Shaun Haber
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
Roger Xia
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
artem_orobets
 
OrientDB the graph database
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
Artem Orobets
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01
jgregory1234
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
drewz lin
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
mysqlops
 
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 Azure
Cihan 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_reilly
thanhduoc
 
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
Karsten 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.js
async_io
 

Recently uploaded (20)

AI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptxAI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptx
Shikha Srivastava
 
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
UXPA Boston
 
Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025
Peter Morgan
 
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
UXPA Boston
 
The fundamental misunderstanding in Team Topologies
The fundamental misunderstanding in Team TopologiesThe fundamental misunderstanding in Team Topologies
The fundamental misunderstanding in Team Topologies
Patricia Aas
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 
Pushing the Limits: CloudStack at 25K Hosts
Pushing the Limits: CloudStack at 25K HostsPushing the Limits: CloudStack at 25K Hosts
Pushing the Limits: CloudStack at 25K Hosts
ShapeBlue
 
Apache CloudStack 101 - Introduction, What’s New and What’s Coming
Apache CloudStack 101 - Introduction, What’s New and What’s ComingApache CloudStack 101 - Introduction, What’s New and What’s Coming
Apache CloudStack 101 - Introduction, What’s New and What’s Coming
ShapeBlue
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025
Neo4j
 
RDM Training: Publish research data with the Research Data Repository
RDM Training: Publish research data with the Research Data RepositoryRDM Training: Publish research data with the Research Data Repository
RDM Training: Publish research data with the Research Data Repository
CSUC - Consorci de Serveis Universitaris de Catalunya
 
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Precisely
 
Assurance Best Practices: Unlocking Proactive Network Operations
Assurance Best Practices: Unlocking Proactive Network OperationsAssurance Best Practices: Unlocking Proactive Network Operations
Assurance Best Practices: Unlocking Proactive Network Operations
ThousandEyes
 
TAFs on WebDriver API - By - Pallavi Sharma.pdf
TAFs on WebDriver API - By - Pallavi Sharma.pdfTAFs on WebDriver API - By - Pallavi Sharma.pdf
TAFs on WebDriver API - By - Pallavi Sharma.pdf
Pallavi Sharma
 
AI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological ImpactAI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological Impact
SaikatBasu37
 
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UXPA Boston
 
Building the plane as it flies through a black hole: revising five UX researc...
Building the plane as it flies through a black hole: revising five UX researc...Building the plane as it flies through a black hole: revising five UX researc...
Building the plane as it flies through a black hole: revising five UX researc...
UXPA Boston
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 
Breaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP DevelopersBreaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP Developers
pmeth1
 
Interactive SQL: SQL, Features of SQL, DDL & DML
Interactive SQL: SQL, Features of SQL,  DDL & DMLInteractive SQL: SQL, Features of SQL,  DDL & DML
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
AI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptxAI needs Hybrid Cloud - TEC conference 2025.pptx
AI needs Hybrid Cloud - TEC conference 2025.pptx
Shikha Srivastava
 
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
Bridging AI and Human Expertise: Designing for Trust and Adoption in Expert S...
UXPA Boston
 
Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025Agentic AI, A Business Overview - May 2025
Agentic AI, A Business Overview - May 2025
Peter Morgan
 
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
Outcome Over Output: How UXers Can Leverage an Outcome-Based Mindset by Malin...
UXPA Boston
 
The fundamental misunderstanding in Team Topologies
The fundamental misunderstanding in Team TopologiesThe fundamental misunderstanding in Team Topologies
The fundamental misunderstanding in Team Topologies
Patricia Aas
 
Build your own NES Emulator... with Kotlin
Build your own NES Emulator... with KotlinBuild your own NES Emulator... with Kotlin
Build your own NES Emulator... with Kotlin
Artur Skowroński
 
Pushing the Limits: CloudStack at 25K Hosts
Pushing the Limits: CloudStack at 25K HostsPushing the Limits: CloudStack at 25K Hosts
Pushing the Limits: CloudStack at 25K Hosts
ShapeBlue
 
Apache CloudStack 101 - Introduction, What’s New and What’s Coming
Apache CloudStack 101 - Introduction, What’s New and What’s ComingApache CloudStack 101 - Introduction, What’s New and What’s Coming
Apache CloudStack 101 - Introduction, What’s New and What’s Coming
ShapeBlue
 
Secondary Storage for a microcontroller system
Secondary Storage for a microcontroller systemSecondary Storage for a microcontroller system
Secondary Storage for a microcontroller system
fizarcse
 
GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025GraphSummit Singapore Master Deck - May 20, 2025
GraphSummit Singapore Master Deck - May 20, 2025
Neo4j
 
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Outdated Tech, Invisible Expenses – How Data Silos Undermine Operational Effi...
Precisely
 
Assurance Best Practices: Unlocking Proactive Network Operations
Assurance Best Practices: Unlocking Proactive Network OperationsAssurance Best Practices: Unlocking Proactive Network Operations
Assurance Best Practices: Unlocking Proactive Network Operations
ThousandEyes
 
TAFs on WebDriver API - By - Pallavi Sharma.pdf
TAFs on WebDriver API - By - Pallavi Sharma.pdfTAFs on WebDriver API - By - Pallavi Sharma.pdf
TAFs on WebDriver API - By - Pallavi Sharma.pdf
Pallavi Sharma
 
AI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological ImpactAI and Gender: Decoding the Sociological Impact
AI and Gender: Decoding the Sociological Impact
SaikatBasu37
 
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UX Change Fatigue: Building Resilient Teams in Times of Transformation by Mal...
UXPA Boston
 
Building the plane as it flies through a black hole: revising five UX researc...
Building the plane as it flies through a black hole: revising five UX researc...Building the plane as it flies through a black hole: revising five UX researc...
Building the plane as it flies through a black hole: revising five UX researc...
UXPA Boston
 
John Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 TalkJohn Carmack’s Slides From His Upper Bound 2025 Talk
John Carmack’s Slides From His Upper Bound 2025 Talk
Razin Mustafiz
 
Breaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP DevelopersBreaking it Down: Microservices Architecture for PHP Developers
Breaking it Down: Microservices Architecture for PHP Developers
pmeth1
 
Interactive SQL: SQL, Features of SQL, DDL & DML
Interactive SQL: SQL, Features of SQL,  DDL & DMLInteractive SQL: SQL, Features of SQL,  DDL & DML
Interactive SQL: SQL, Features of SQL, DDL & DML
IsakkiDeviP
 
Ad

Introduction data structure for GraphDB

  • 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