Introduction data structure for GraphDB

shunya kimura
shunya kimuradevelopment at mixi
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!
1 of 76

Recommended

CIS14: I Left My JWT in San JOSE by
CIS14: I Left My JWT in San JOSECIS14: I Left My JWT in San JOSE
CIS14: I Left My JWT in San JOSECloudIDSummit
711 views39 slides
ソーシャルグラフ分析 by
ソーシャルグラフ分析ソーシャルグラフ分析
ソーシャルグラフ分析shunya kimura
2.5K views102 slides
情報処理学会第74回全国大会 私的勉強会と学会の未来 by
情報処理学会第74回全国大会 私的勉強会と学会の未来情報処理学会第74回全国大会 私的勉強会と学会の未来
情報処理学会第74回全国大会 私的勉強会と学会の未来shunya kimura
2.7K views47 slides
グラフデータベース「Neo4j」の 導入の導入 by
グラフデータベース「Neo4j」の 導入の導入グラフデータベース「Neo4j」の 導入の導入
グラフデータベース「Neo4j」の 導入の導入Hisao Soyama
20.9K views66 slides
「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜 by
「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜
「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜Takahiro Inoue
49.1K views91 slides
大規模グラフアルゴリズムの最先端 by
大規模グラフアルゴリズムの最先端大規模グラフアルゴリズムの最先端
大規模グラフアルゴリズムの最先端Takuya Akiba
54.4K views51 slides

More Related Content

Similar to Introduction data structure for GraphDB

2011 03-31 Riak Stockholm Meetup by
2011 03-31 Riak Stockholm Meetup2011 03-31 Riak Stockholm Meetup
2011 03-31 Riak Stockholm MeetupMårten Gustafson
561 views85 slides
Webinar: General Technical Overview of MongoDB by
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDBMongoDB
2K views47 slides
NoSQL - how it works (@pavlobaron) by
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)Pavlo Baron
2.1K views96 slides
Introduction to Node.js by
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
2.9K views68 slides
BADCamp 2008 DB Sync by
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB SyncShaun Haber
693 views85 slides
Spring one2gx2010 spring-nonrelational_data by
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataRoger Xia
1.3K views86 slides

Similar to Introduction data structure for GraphDB(20)

Webinar: General Technical Overview of MongoDB by MongoDB
Webinar: General Technical Overview of MongoDBWebinar: General Technical Overview of MongoDB
Webinar: General Technical Overview of MongoDB
MongoDB2K views
NoSQL - how it works (@pavlobaron) by Pavlo Baron
NoSQL - how it works (@pavlobaron)NoSQL - how it works (@pavlobaron)
NoSQL - how it works (@pavlobaron)
Pavlo Baron2.1K views
Introduction to Node.js by Rob O'Doherty
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
Rob O'Doherty2.9K views
BADCamp 2008 DB Sync by Shaun Haber
BADCamp 2008 DB SyncBADCamp 2008 DB Sync
BADCamp 2008 DB Sync
Shaun Haber693 views
Spring one2gx2010 spring-nonrelational_data by Roger Xia
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
Roger Xia1.3K views
Ruby On Rails by Gautam Rege
Ruby On RailsRuby On Rails
Ruby On Rails
Gautam Rege4.6K views
OrientDB the graph database by artem_orobets
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
artem_orobets5.8K views
OrientDB the graph database by Artem Orobets
OrientDB the graph databaseOrientDB the graph database
OrientDB the graph database
Artem Orobets882 views
Facebook architecture by drewz lin
Facebook architectureFacebook architecture
Facebook architecture
drewz lin1K views
Facebook architecture by mysqlops
Facebook architectureFacebook architecture
Facebook architecture
mysqlops 10.1K views
Qcon 090408233824-phpapp01 by jgregory1234
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01
jgregory1234266 views
Facebook的架构 by yiditushe
Facebook的架构Facebook的架构
Facebook的架构
yiditushe1.2K views
Inside Sql Azure - Cihan Biyikoglu - SQL Azure by Cihan Biyikoglu
Inside Sql Azure - Cihan Biyikoglu - SQL AzureInside Sql Azure - Cihan Biyikoglu - SQL Azure
Inside Sql Azure - Cihan Biyikoglu - SQL Azure
Cihan Biyikoglu978 views
Cs c -3_0_cookbook_3rd_edition_-_o_reilly by thanhduoc
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
thanhduoc220 views
Practical Use of MongoDB for Node.js by async_io
Practical Use of MongoDB for Node.jsPractical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io19.9K views

Recently uploaded

NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
437 views30 slides
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023BookNet Canada
44 views19 slides
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueShapeBlue
137 views13 slides
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsShapeBlue
247 views13 slides
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...ShapeBlue
120 views17 slides
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...ShapeBlue
183 views18 slides

Recently uploaded(20)

NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu437 views
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada44 views
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue by ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlueCloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
CloudStack Managed User Data and Demo - Harikrishna Patnala - ShapeBlue
ShapeBlue137 views
Why and How CloudStack at weSystems - Stephan Bienek - weSystems by ShapeBlue
Why and How CloudStack at weSystems - Stephan Bienek - weSystemsWhy and How CloudStack at weSystems - Stephan Bienek - weSystems
Why and How CloudStack at weSystems - Stephan Bienek - weSystems
ShapeBlue247 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue120 views
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... by ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue183 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue224 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue303 views
LLMs in Production: Tooling, Process, and Team Structure by Aggregage
LLMs in Production: Tooling, Process, and Team StructureLLMs in Production: Tooling, Process, and Team Structure
LLMs in Production: Tooling, Process, and Team Structure
Aggregage57 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue196 views
The Role of Patterns in the Era of Large Language Models by Yunyao Li
The Role of Patterns in the Era of Large Language ModelsThe Role of Patterns in the Era of Large Language Models
The Role of Patterns in the Era of Large Language Models
Yunyao Li91 views
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue by ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue139 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue129 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc176 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash162 views
The Power of Generative AI in Accelerating No Code Adoption.pdf by Saeed Al Dhaheri
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdf
Saeed Al Dhaheri39 views
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue108 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue199 views

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

  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