Advertisement
Advertisement

More Related Content

Advertisement
Advertisement

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

  1. BETTING THE COMPANYBETTING THE COMPANY (LITERALLY) ON A GRAPH DATABASEGRAPH DATABASE TIPS, TRICKS, AND LESSONS LEARNED Aseem Kishore Jan 2013
  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. Daniel Gasienica @gasi
  4. SO… JUST WHAT IS A GRAPH DATABASEGRAPH DATABASE?
  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. “ 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. QUERYING 1. Start somewhere 2. Traverse elsewhere
  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. NEO4J USAGE Embedded mode (Java API) Server mode (REST API) Cypher query language (both)
  10. OUR USAGE NODE.JS + REST API + CYPHER
  11. NEO4J EDITIONS Community edition Single instance Offline backup Advanced edition Meh Enterprise edition Multi-instance cluster! Online backup!
  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. OKAY... LET'S TALK ABOUT WHAT WE LEARNEDWHAT WE LEARNED
  14. WHAT WE LEARNED Unique, expressive relationship types
  15. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible
  16. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible Capture history through event nodes
  17. WHAT WE LEARNED Unique, expressive relationship types Cache stats where possible Capture history through event nodes First-class objects ⇒ nodes, not rels
  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. 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. NEO4J ROADMAP Overhaul of indexing API Relationship type grouping Socket and/or binary protocol Automatic sharding?
  21. THANKS! TWITTER: @ASEEMK GITHUB: @ASEEMK EMAIL: ASEEM.KISHORE@GMAIL.COM Questions?
Advertisement