Your SlideShare is downloading. ×
0
Webinar
June 25 2013
Walkthrough Neo4j 1.9.1 & 2.0
Michael Hunger, Neo Technology
@mesirii
Overview
Overview
• Neo4j 1.9.1
• High Availability & Operations
• Performance & Cypher
• Neo4j 2.0
• Extension Property Graph Mode...
Neo4j 1.9.1
High Availability & Operations
• new HA cluster management implementation (paxos) w/o ZK
• ZK compatibility layer for roll...
Hands-On High Availability
• Manual 1.8 vs. Manual 1.9
• Live
• 3 node cluster
• runs without zookeeper
• show that replic...
General
• Java 7 support
• Store-Locks to limit access of Readonly-Instances
• Online backup enabled by default, works wit...
Server
• Traversal Javascript is sandboxed
• X-Forwarded-Host and X-Forwarded-Proto headers to support
running behind a pr...
Cypher
• upgrade to scala 2.10
• concurrent parsing
• execution plan description
• fix non-lazyness
• faster pattern matche...
Cypher
• predicates as expressions
• Functions: reduce, string functions
• order by, skip, limit with WITH
• automatic con...
Hands-On Cypher
• profiling
• string functions, show reduce
• WITH with ORDER BY LIMIT
• SET with predicates, SET with othe...
Why 2.0?
(0.x) --> (1.x) --> (2.x)
(0.x) --> (1.x) --> (2.x)
• 0.x was about embedded java
(0.x) --> (1.x) --> (2.x)
• 0.x was about embedded java
• 1.x introduced indexes, the server and REST
(0.x) --> (1.x) --> (2.x)
• 0.x was about embedded java
• 1.x introduced indexes, the server and REST
• 2.x ease of use, b...
(0.x) --> (1.x) --> (2.x)
• 0.x was about embedded java
• 1.x introduced indexes, the server and REST
• 2.x ease of use, b...
This guy
Focus on Cypher
Focus on Cypher
• Cypher, a carefully crafted language for working with graphs
Focus on Cypher
• Cypher, a carefully crafted language for working with graphs
• Declarative, friendly, easy to read and w...
Focus on Cypher
• Cypher, a carefully crafted language for working with graphs
• Declarative, friendly, easy to read and w...
Focus on Cypher
• Cypher, a carefully crafted language for working with graphs
• Declarative, friendly, easy to read and w...
What is new in 2.0?
There will be
some sad Danes
"Once you label me,
you negate me.”
- Søren Kierkegaard
Introducing Node Labels
name: 'Soren'
• Simply: a label identifies a set of nodes
Introducing Node Labels
name: 'Soren'
• Simply: a label identifies a set of nodes
Introducing Node Labels
name: 'Soren'
Dane
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
Introducing Node Labels
name: 'Soren'
Dane
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
Introducing Node Labels
name: 'Soren'
Negated ...
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
Introducing Node Labels
name: 'Soren'
Negated
...
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
• Find nodes by label
Introducing Node Labels
...
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
• Find nodes by label
• Constrain properties a...
• Simply: a label identifies a set of nodes
• Nodes can have multiple labels
• Find nodes by label
• Constrain properties a...
Find friends who like cheese
MATCH (max:People)-[:FRIENDS]->(cheesy: People),
(cheesy)-[:LIKE]->(cheese:Things)
WHERE max....
Schema Indexing
• Indexes for labels, based on a property
• Simple lookups for now
• Unique indexing coming soon
• Full-te...
MERGE operation
• a combination of MATCH + CREATE
• replaces CREATE UNIQUE
• attempts to MATCH, with specified properties a...
Transactional Cypher
• begin, commit, or rollback a transaction
Transactional Cypher
• begin, commit, or rollback a transaction
• transaction as RESTful resource
Transactional Cypher
• begin, commit, or rollback a transaction
• transaction as RESTful resource
• issue multiple statements per request
Trans...
• begin, commit, or rollback a transaction
• transaction as RESTful resource
• issue multiple statements per request
• mul...
• begin, commit, or rollback a transaction
• transaction as RESTful resource
• issue multiple statements per request
• mul...
• begin, commit, or rollback a transaction
• transaction as RESTful resource
• issue multiple statements per request
• mul...
Anything else?
Anything else?
• Performance improvements
Anything else?
• Performance improvements
• Breaking changes to some APIs (read CHANGES.txt)
Anything else?
• Performance improvements
• Breaking changes to some APIs (read CHANGES.txt)
• Migration of "legacy" index...
Anything else?
• Performance improvements
• Breaking changes to some APIs (read CHANGES.txt)
• Migration of "legacy" index...
Anything else?
• Performance improvements
• Breaking changes to some APIs (read CHANGES.txt)
• Migration of "legacy" index...
Anything else?
• Performance improvements
• Breaking changes to some APIs (read CHANGES.txt)
• Migration of "legacy" index...
How to use labels?
Label - special nodes
• replace built-in reference node,
with domain specific reference nodes
42
Label - special nodes
• replace built-in reference node,
with domain specific reference nodes
42
Answer
Labels - rules of thumb
Labels - rules of thumb
• Use a label to make queries easier to read & write
Labels - rules of thumb
• Use a label to make queries easier to read & write
• And to improve performance through indexing
Labels - rules of thumb
• Use a label to make queries easier to read & write
• And to improve performance through indexing
Labels - rules of thumb
• Use a label to make queries easier to read & write
• And to improve performance through indexing...
Labels - rules of thumb
• Use a label to make queries easier to read & write
• And to improve performance through indexing...
Hands-On Cypher
• Migrate Cineasts dataset to use Labels
• Show MATCH on Labels and Properties (+ profile)
• Add an Index o...
Hands-On 2.0
• Show Transactional HTTP-Endpoint
• POST initial statements, look at result, check currently running tx in
s...
Is that it for 2.0?
Well, there is this...
Googlehttp://localhost:7474/
Neo4j
LoadTransactions
Neo4j
2.0.0
Active Queries 12Master
/var/neo4j/webui.graphdb Active Qu...
What is new in 2.0?
What is new in 2.0?
• It's all about Cypher, starting with
• Labels, the first significant change in over 12 years
• Mix in ...
Thanks :)
MATCH (you)-[:HAVE]->(question)
RETURN question.text
@neo4j or @mesirii to keep in touch
Upcoming SlideShare
Loading in...5
×

Walkthrough Neo4j 1.9 & 2.0

1,026

Published on

This Presentations gives an over

Published in: Business, Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,026
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
44
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Transcript of "Walkthrough Neo4j 1.9 & 2.0"

  1. 1. Webinar June 25 2013 Walkthrough Neo4j 1.9.1 & 2.0 Michael Hunger, Neo Technology @mesirii
  2. 2. Overview
  3. 3. Overview • Neo4j 1.9.1 • High Availability & Operations • Performance & Cypher • Neo4j 2.0 • Extension Property Graph Model - Labels & Indexes • Cypher • Transactional Http Endpoint
  4. 4. Neo4j 1.9.1
  5. 5. High Availability & Operations • new HA cluster management implementation (paxos) w/o ZK • ZK compatibility layer for rolling upgrades from 1.8 • faster consistency check with new implementation • new HA JMX information -> JConsole • Arbiter instance for clusters < 3 • Slave only mode • new endpoint for load balancers /db/manage/server/ha/{master,slave}
  6. 6. Hands-On High Availability • Manual 1.8 vs. Manual 1.9 • Live • 3 node cluster • runs without zookeeper • show that replication works • show management endpoint and JMX • show config
  7. 7. General • Java 7 support • Store-Locks to limit access of Readonly-Instances • Online backup enabled by default, works with port-range • Performance • caching & property access improvements • REST-Batch-Operations speedup
  8. 8. Server • Traversal Javascript is sandboxed • X-Forwarded-Host and X-Forwarded-Proto headers to support running behind a proxy • SSL certificate chain support • REST-batch-operations performance improvements • Gremlin plugin as separate project • to allow different versions and decouple from neo4j release cycle
  9. 9. Cypher • upgrade to scala 2.10 • concurrent parsing • execution plan description • fix non-lazyness • faster pattern matcher (bi-directional traversal) • top-n select for order by limit
  10. 10. Cypher • predicates as expressions • Functions: reduce, string functions • order by, skip, limit with WITH • automatic conversion • SET can work with other nodes or maps
  11. 11. Hands-On Cypher • profiling • string functions, show reduce • WITH with ORDER BY LIMIT • SET with predicates, SET with other nodes • FOREACH with CREATE UNIQUE
  12. 12. Why 2.0?
  13. 13. (0.x) --> (1.x) --> (2.x)
  14. 14. (0.x) --> (1.x) --> (2.x) • 0.x was about embedded java
  15. 15. (0.x) --> (1.x) --> (2.x) • 0.x was about embedded java • 1.x introduced indexes, the server and REST
  16. 16. (0.x) --> (1.x) --> (2.x) • 0.x was about embedded java • 1.x introduced indexes, the server and REST • 2.x ease of use, big data, cloud
  17. 17. (0.x) --> (1.x) --> (2.x) • 0.x was about embedded java • 1.x introduced indexes, the server and REST • 2.x ease of use, big data, cloud which means a focus on...
  18. 18. This guy
  19. 19. Focus on Cypher
  20. 20. Focus on Cypher • Cypher, a carefully crafted language for working with graphs
  21. 21. Focus on Cypher • Cypher, a carefully crafted language for working with graphs • Declarative, friendly, easy to read and write
  22. 22. Focus on Cypher • Cypher, a carefully crafted language for working with graphs • Declarative, friendly, easy to read and write • One language, used everywhere
  23. 23. Focus on Cypher • Cypher, a carefully crafted language for working with graphs • Declarative, friendly, easy to read and write • One language, used everywhere • REST for management, Java for extensions,
  24. 24. What is new in 2.0?
  25. 25. There will be some sad Danes "Once you label me, you negate me.” - Søren Kierkegaard
  26. 26. Introducing Node Labels name: 'Soren'
  27. 27. • Simply: a label identifies a set of nodes Introducing Node Labels name: 'Soren'
  28. 28. • Simply: a label identifies a set of nodes Introducing Node Labels name: 'Soren' Dane
  29. 29. • Simply: a label identifies a set of nodes • Nodes can have multiple labels Introducing Node Labels name: 'Soren' Dane
  30. 30. • Simply: a label identifies a set of nodes • Nodes can have multiple labels Introducing Node Labels name: 'Soren' Negated Dane
  31. 31. • Simply: a label identifies a set of nodes • Nodes can have multiple labels Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane
  32. 32. • Simply: a label identifies a set of nodes • Nodes can have multiple labels • Find nodes by label Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane
  33. 33. • Simply: a label identifies a set of nodes • Nodes can have multiple labels • Find nodes by label • Constrain properties and values (lightweight, optional schema) Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane
  34. 34. • Simply: a label identifies a set of nodes • Nodes can have multiple labels • Find nodes by label • Constrain properties and values (lightweight, optional schema) • A simple idea, with powerful applications Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane
  35. 35. Find friends who like cheese MATCH (max:People)-[:FRIENDS]->(cheesy: People), (cheesy)-[:LIKE]->(cheese:Things) WHERE max.name = "Max De Marzi" AND cheese.name = "Cheese" RETURN cheesy;
  36. 36. Schema Indexing • Indexes for labels, based on a property • Simple lookups for now • Unique indexing coming soon • Full-text, other special indexes in planning CREATE INDEX ON :People(name)
  37. 37. MERGE operation • a combination of MATCH + CREATE • replaces CREATE UNIQUE • attempts to MATCH, with specified properties and labels • if match fails, new graph data is created • optional sub-clauses for handling ON CREATE, and ON MATCH MERGE (charlie { name:'Charlie Sheen', age:10 }) ON CREATE charlie SET charlie.created = timestamp() RETURN charlie
  38. 38. Transactional Cypher
  39. 39. • begin, commit, or rollback a transaction Transactional Cypher
  40. 40. • begin, commit, or rollback a transaction • transaction as RESTful resource Transactional Cypher
  41. 41. • begin, commit, or rollback a transaction • transaction as RESTful resource • issue multiple statements per request Transactional Cypher
  42. 42. • begin, commit, or rollback a transaction • transaction as RESTful resource • issue multiple statements per request • multiple requests per transaction Transactional Cypher
  43. 43. • begin, commit, or rollback a transaction • transaction as RESTful resource • issue multiple statements per request • multiple requests per transaction • compact response format Transactional Cypher
  44. 44. • begin, commit, or rollback a transaction • transaction as RESTful resource • issue multiple statements per request • multiple requests per transaction • compact response format Transactional Cypher
  45. 45. Anything else?
  46. 46. Anything else? • Performance improvements
  47. 47. Anything else? • Performance improvements • Breaking changes to some APIs (read CHANGES.txt)
  48. 48. Anything else? • Performance improvements • Breaking changes to some APIs (read CHANGES.txt) • Migration of "legacy" indexes (stop STARTing)
  49. 49. Anything else? • Performance improvements • Breaking changes to some APIs (read CHANGES.txt) • Migration of "legacy" indexes (stop STARTing) • Mandatory transactions for all DB interactions
  50. 50. Anything else? • Performance improvements • Breaking changes to some APIs (read CHANGES.txt) • Migration of "legacy" indexes (stop STARTing) • Mandatory transactions for all DB interactions • Improving installers (in progress)
  51. 51. Anything else? • Performance improvements • Breaking changes to some APIs (read CHANGES.txt) • Migration of "legacy" indexes (stop STARTing) • Mandatory transactions for all DB interactions • Improving installers (in progress) • Changing everything to be "all Cypher, all the time"
  52. 52. How to use labels?
  53. 53. Label - special nodes • replace built-in reference node, with domain specific reference nodes 42
  54. 54. Label - special nodes • replace built-in reference node, with domain specific reference nodes 42 Answer
  55. 55. Labels - rules of thumb
  56. 56. Labels - rules of thumb • Use a label to make queries easier to read & write
  57. 57. Labels - rules of thumb • Use a label to make queries easier to read & write • And to improve performance through indexing
  58. 58. Labels - rules of thumb • Use a label to make queries easier to read & write • And to improve performance through indexing
  59. 59. Labels - rules of thumb • Use a label to make queries easier to read & write • And to improve performance through indexing • Start with anything you might've put in a legacy index
  60. 60. Labels - rules of thumb • Use a label to make queries easier to read & write • And to improve performance through indexing • Start with anything you might've put in a legacy index • Use lightly, as few labels as needed
  61. 61. Hands-On Cypher • Migrate Cineasts dataset to use Labels • Show MATCH on Labels and Properties (+ profile) • Add an Index on :Person(name) :Movie(title) • Show MATCH on Labels and Properties (+ profile) • Show MERGE
  62. 62. Hands-On 2.0 • Show Transactional HTTP-Endpoint • POST initial statements, look at result, check currently running tx in server-info • POST another create statement to the tx • POST a new read statement to a new tx that shows isolation • DELETE second transaction • POST to COMMIT resource
  63. 63. Is that it for 2.0?
  64. 64. Well, there is this...
  65. 65. Googlehttp://localhost:7474/ Neo4j LoadTransactions Neo4j 2.0.0 Active Queries 12Master /var/neo4j/webui.graphdb Active Queries 12 MATCH (n)-[:FRIEND]->(friends) WHERE n.name = 'Andreas'Create a blank node CREATE (n); Clear all MATCH (n)-[r?]->(m) DELETE n,r,m; ad-hoc query Relate People MATCH (from),(to) WHERE n.name = {from} AND to.name = {to} CREATE (from)-[:FRIEND]- >(to); Delia Andreas m People CREATE (n); Andreas Name Metaphysical Mood Delia Excited Friends by name CREATE (n); Andreas From Delia To Delia Tiberius Mood survey CREATE (n); Andreas Name Metaphysical Mood Delia Excited MATCH (n) RETURN n People Books ClassicsAuthors CREATE (me:People {name:'Andreas'})
  66. 66. What is new in 2.0?
  67. 67. What is new in 2.0? • It's all about Cypher, starting with • Labels, the first significant change in over 12 years • Mix in schema indexing • Then transactional REST, new clauses, functions • A fresh Web UI that is Cypher-focused
  68. 68. Thanks :) MATCH (you)-[:HAVE]->(question) RETURN question.text @neo4j or @mesirii to keep in touch
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×