This webinar covered Neo4j 1.9.1, 2.0 features and hands-on demonstrations. Key highlights included:
- Neo4j 1.9.1 improvements to high availability, operations and Cypher performance.
- Neo4j 2.0 introduces node labels for improved querying and indexing, transactional Cypher via REST, and a focus on using Cypher everywhere.
- Hands-on sessions demonstrated migrating data to use labels, indexing, transactional HTTP endpoint, and other new 2.0 features.
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 config
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 certificate 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
• fix 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
• profiling
• string functions, show reduce
• WITH with ORDER BY LIMIT
• SET with predicates, SET with other nodes
• FOREACH with CREATE UNIQUE
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...
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,
27. • Simply: a label identifies a set of nodes
Introducing Node Labels
name: 'Soren'
28. • Simply: a label identifies a set of nodes
Introducing Node Labels
name: 'Soren'
Dane
29. • Simply: a label identifies a set of nodes
• Nodes can have multiple labels
Introducing Node Labels
name: 'Soren'
Dane
30. • Simply: a label identifies a set of nodes
• Nodes can have multiple labels
Introducing Node Labels
name: 'Soren'
Negated Dane
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. • 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. • 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. • 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. 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 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
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
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"
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 (+ profile)
• Add an Index on :Person(name) :Movie(title)
• Show MATCH on Labels and Properties (+ profile)
• 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
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'})
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