BETTING THE COMPANYBETTING THE COMPANY
(LITERALLY) ON A
GRAPH DATABASEGRAPH DATABASE
TIPS, TRICKS, AND LESSONS LEARNED
Ase...
START user=node(1), other=node(2)
MATCH (user) -[r1:has|wants]-> (thing) <-[r2:has|wants]- (other)
WHERE TYPE(r1) <> TYPE(...
Daniel Gasienica
@gasi
SO…
JUST WHAT IS A
GRAPH DATABASEGRAPH DATABASE?
# adjacency list:
nodes = List<Node>
neighbors = Map<Node, List<Node>>
neighbors[node1].add(node2)
# adjacency matrix:
nod...
“ By definition, a graph database is any storage
system that provides index-free adjacency. ”
“ This means that every elem...
QUERYING
1. Start somewhere
2. Traverse elsewhere
QUERYING IN NEO4J
1. Start somewhere
Root node
ID directly (file offset)
Lucene index
2. Traverse elsewhere
Traversal APIs...
NEO4J USAGE
Embedded mode (Java API)
Server mode (REST API)
Cypher query language (both)
OUR USAGE
NODE.JS
+
REST API
+
CYPHER
NEO4J EDITIONS
Community edition
Single instance
Offline backup
Advanced edition
Meh
Enterprise edition
Multi-instance clu...
NEO4J SCALING
Master-slave replication
Cache-based sharding
Feature-based polyglot'ing
64B limit on nodes, rels, props
But...
OKAY...
LET'S TALK ABOUT
WHAT WE LEARNEDWHAT WE LEARNED
WHAT WE LEARNED
Unique, expressive relationship types
WHAT WE LEARNED
Unique, expressive relationship types
Cache stats where possible
WHAT WE LEARNED
Unique, expressive relationship types
Cache stats where possible
Capture history through event nodes
WHAT WE LEARNED
Unique, expressive relationship types
Cache stats where possible
Capture history through event nodes
First...
WHAT WE LEARNED
Unique, expressive relationship types
Cache stats where possible
First-class objects ⇒ nodes, not rels
Cap...
WHAT WE LEARNED
Unique, expressive relationship types
Cache stats where possible
First-class objects ⇒ nodes, not rels
Cap...
NEO4J ROADMAP
Overhaul of indexing API
Relationship type grouping
Socket and/or binary protocol
Automatic sharding?
THANKS!
TWITTER: @ASEEMK
GITHUB: @ASEEMK
EMAIL: ASEEM.KISHORE@GMAIL.COM
Questions?
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013
Upcoming SlideShare
Loading in …5
×

Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013

1,193 views

Published on

  • Be the first to comment

Betting the Company on a Graph Database - Aseem Kishore @ GraphConnect Boston 2013

  1. 1. BETTING THE COMPANYBETTING THE COMPANY (LITERALLY) ON A GRAPH DATABASEGRAPH DATABASE TIPS, TRICKS, AND LESSONS LEARNED Aseem Kishore Jan 2013
  2. 2. START user=node(1), other=node(2) MATCH (user) -[r1:has|wants]-> (thing) <-[r2:has|wants]- (other) WHERE TYPE(r1) <> TYPE(r2) RETURN TYPE(r1), TYPE(r2), thing
  3. 3. Daniel Gasienica @gasi
  4. 4. SO… JUST WHAT IS A GRAPH DATABASEGRAPH DATABASE?
  5. 5. # adjacency list: nodes = List<Node> neighbors = Map<Node, List<Node>> neighbors[node1].add(node2) # adjacency matrix: nodes = List<Node> connections = Map<Node, Map<Node, bool>> connections[node1][node2] = true
  6. 6. “ By definition, a graph database is any storage system that provides index-free adjacency. ” “ This means that every element contains a direct pointer to its adjacent element and no index lookups are necessary. ”
  7. 7. QUERYING 1. Start somewhere 2. Traverse elsewhere
  8. 8. QUERYING IN NEO4J 1. Start somewhere Root node ID directly (file offset) Lucene index 2. Traverse elsewhere Traversal APIs Cypher patterns Built-in graph algos (Djikstra, A*, etc.)
  9. 9. NEO4J USAGE Embedded mode (Java API) Server mode (REST API) Cypher query language (both)
  10. 10. OUR USAGE NODE.JS + REST API + CYPHER
  11. 11. NEO4J EDITIONS Community edition Single instance Offline backup Advanced edition Meh Enterprise edition Multi-instance cluster! Online backup!
  12. 12. NEO4J SCALING Master-slave replication Cache-based sharding Feature-based polyglot'ing 64B limit on nodes, rels, props But can be easily upped; just flipping some bits 100 props/node (high) ⇒ 640M nodes
  13. 13. OKAY... LET'S TALK ABOUT WHAT WE LEARNEDWHAT WE LEARNED
  14. 14. WHAT WE LEARNED Unique, expressive relationship types
  15. 15. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible
  16. 16. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible Capture history through event nodes
  17. 17. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible Capture history through event nodes First-class objects ⇒ nodes, not rels
  18. 18. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible First-class objects ⇒ nodes, not rels Capture history through event nodes Connected data ⇒ nodes, not props
  19. 19. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible First-class objects ⇒ nodes, not rels Capture history through event nodes Connected data ⇒ nodes, not props Maintain linked lists for O(1) queries
  20. 20. NEO4J ROADMAP Overhaul of indexing API Relationship type grouping Socket and/or binary protocol Automatic sharding?
  21. 21. THANKS! TWITTER: @ASEEMK GITHUB: @ASEEMK EMAIL: ASEEM.KISHORE@GMAIL.COM Questions?

×