Walkthrough Neo4j 1.9 & 2.0

download Walkthrough Neo4j 1.9 & 2.0

of 68

  • date post

    20-May-2015
  • Category

    Business

  • view

    997
  • download

    2

Embed Size (px)

description

This Presentations gives an over

Transcript of Walkthrough Neo4j 1.9 & 2.0

  • 1. Webinar June 25 2013 Walkthrough Neo4j 1.9.1 & 2.0 Michael Hunger, Neo Technology @mesirii

2. Overview 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. Neo4j 1.9.1 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. 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 cong 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. Server Traversal Javascript is sandboxed X-Forwarded-Host and X-Forwarded-Proto headers to support running behind a proxy SSL certicate chain support REST-batch-operations performance improvements Gremlin plugin as separate project to allow different versions and decouple from neo4j release cycle 9. Cypher upgrade to scala 2.10 concurrent parsing execution plan description x non-lazyness faster pattern matcher (bi-directional traversal) top-n select for order by limit 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. Hands-On Cypher proling string functions, show reduce WITH with ORDER BY LIMIT SET with predicates, SET with other nodes FOREACH with CREATE UNIQUE 12. Why 2.0? 13. (0.x) --> (1.x) --> (2.x) 14. (0.x) --> (1.x) --> (2.x) 0.x was about embedded java 15. (0.x) --> (1.x) --> (2.x) 0.x was about embedded java 1.x introduced indexes, the server and REST 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. (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. This guy 19. Focus on Cypher 20. Focus on Cypher Cypher, a carefully crafted language for working with graphs 21. Focus on Cypher Cypher, a carefully crafted language for working with graphs Declarative, friendly, easy to read and write 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. 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. What is new in 2.0? 25. There will be some sad Danes "Once you label me, you negate me. - Sren Kierkegaard 26. Introducing Node Labels name: 'Soren' 27. Simply: a label identies a set of nodes Introducing Node Labels name: 'Soren' 28. Simply: a label identies a set of nodes Introducing Node Labels name: 'Soren' Dane 29. Simply: a label identies a set of nodes Nodes can have multiple labels Introducing Node Labels name: 'Soren' Dane 30. Simply: a label identies a set of nodes Nodes can have multiple labels Introducing Node Labels name: 'Soren' Negated Dane 31. Simply: a label identies a set of nodes Nodes can have multiple labels Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane 32. Simply: a label identies a set of nodes Nodes can have multiple labels Find nodes by label Introducing Node Labels name: 'Soren' Negated name: 'Soren' img: Dane 33. Simply: a label identies 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. Simply: a label identies 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. 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. 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. MERGE operation a combination of MATCH + CREATE replaces CREATE UNIQUE attempts to MATCH, with specied 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. Transactional Cypher 39. begin, commit, or rollback a transaction Transactional Cypher 40. begin, commit, or rollback a transaction transaction as RESTful resource Transactional Cypher 41. begin, commit, or rollback a transaction transaction as RESTful resource issue multiple statements per request Transactional Cypher 42. begin, commit, or rollback a transaction transaction as RESTful resource issue multiple statements per request multiple requests per transaction Transactional Cypher 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. 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. Anything else? 46. Anything else? Performance improvements 47. Anything else? Performance improvements Breaking changes to some APIs (read CHANGES.txt) 48. Anything else? Performance improvements Breaking changes to some APIs (read CHANGES.txt) Migration of "legacy" indexes (stop STARTing) 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. 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. 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. How to use labels? 53. Label - special nodes replace built-in reference node, with domain specic reference nodes 42 54. Label - special nodes replace built-in reference node, with domain specic reference nodes 42 Answer 55. Labels - rules of thumb 56. Labels - rules of thumb Use a label to make queries easier to read & write 57. Labels - rules of thumb Use a label to make queries easier to read & write And to improve performance through indexing 58. Labels - rules of thumb Use a label to make queries easier to read & write And to improve performance through indexing 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. 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. Hands-On Cypher Migrate Cineasts dataset to use Labels Show MATCH on Labels and Properties (+ prole) Add an Index on :Person(name) :Movie(title) Show MATCH on Labels and Properties (+ prole) Show MERGE 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. Is that it for 2.0? 64. Well, there is this... 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. What is new in 2.0? 67. What is new in 2.0? It's all about Cypher, starting with Labels, the rst signicant change in over 12 years Mix in schema indexing Then transactional REST, new clauses, functions A fresh Web UI that is Cypher-focused 68. Thanks :) MATCH (you)-[:HAVE]->(question) RETURN question.text @neo4j or @mesirii to keep in touch