neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t...
TRANSCRIPT
![Page 1: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/1.jpg)
Neo4j 3.0Benoit Simard (@logisima)
![Page 2: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/2.jpg)
introduction
![Page 3: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/3.jpg)
@logisima
Addicte aux graphes
Formateur
Benoit Simard, consultant
![Page 4: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/4.jpg)
Les prochains évènements
1er juin : Les graphes dans les projets industriels orientés data, par Kernix
15 juin : Venue sur Paris de Andres Taylor (le créateur de Cypher)
28 juin: Graphes & Finance - Plongée dans les Panama Papers
21 septembre : Graph day Paris
![Page 5: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/5.jpg)
L’histoire de Neo4j
![Page 6: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/6.jpg)
API Java
JAR de petite taille
Indexation basique
Neo4j 0.X - 2000 à 2010
![Page 7: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/7.jpg)
API REST
Serveur Neo4j
Mode cluster
Cypher dans la 1.4
Neo4j 1.X - 2010 à 2014
![Page 8: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/8.jpg)
Cypher par defaut (ajout de l’écriture)
Ajout des Labels
Schema
Neo4j Browser
Page Cache
Neo4j 2.X - 2014 à 2016
![Page 9: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/9.jpg)
Neo4j 3.0
![Page 10: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/10.jpg)
Permettre à tout le monde de développer desapplications graphes
Simplement
Rapidement
Sans contrainte de volumétrie
Les fondements
![Page 11: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/11.jpg)
Les fondements
![Page 12: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/12.jpg)
Du coté des architectes
![Page 13: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/13.jpg)
Jusqu’au bout de l’extrême limite !EE : Un nouveau moteur de stockage qui abolit les limites de Neo4j (> 1 quadrillion) !
![Page 14: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/14.jpg)
Mise à jour de lucene en version 5
Indexation en parallèle (meilleure performanceen écriture)
Partitonnement des indexes lucene(suppression de la limitation de 2 milliards)
Les indexes, c’est majeur
![Page 15: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/15.jpg)
Pour les ops !
![Page 16: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/16.jpg)
Amélioration des performances sur lesenvironnements virtualisés (Optimisation dupage-cache)
Image docker o�cielle
Cloud , virtualisation, containers
![Page 17: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/17.jpg)
Refactoring : la structureModi�cation de la structure
├── bin
├── certificates
├── conf
├── data
│ ├── databases
│ │ └── graph.db
│ └── dbms
├── import
├── lib
├── logs
├── plugins
└── run
1
2
3
4
5
6
7
8
9
10
11
12
![Page 18: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/18.jpg)
Refactoring : la con�gurationUn seul �chier de conf conf/neo4j.conf, avec les propriétés namespacés
/!\ Les noms des propriétés ont donc changé !
...
#
# Bolt connector
#
dbms.connector.bolt.type=BOLT
dbms.connector.bolt.enabled=true
dbms.connector.bolt.tls_level=OPTIONAL
# To have Bolt accept non-local connections, uncomment this line:
# dbms.connector.bolt.address=0.0.0.0:7687
...
1
2
3
4
5
6
7
8
9
10
![Page 19: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/19.jpg)
Refactoring : les logsTous les �chiers de logs sont à présent dans le répertoire logs
logs/
├── debug.log <= anciennement messages.log dans graph.db
└── neo4j.log
1
2
3
![Page 20: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/20.jpg)
Le coin des développeurs
![Page 21: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/21.jpg)
Protocole binaire
Transport : TCP & Websocket
Sécurisé : TLS & authenti�cation par défaut
Versionné
bolt://localhost:7687
Bolt
![Page 22: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/22.jpg)
Bolt: drivers o�ciels
![Page 23: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/23.jpg)
Bolt// Javascript
var driver = Graph.Database.driver("bolt://localhost");
var session = driver.session();
var result = session.run("MATCH (u:User) RETURN u.name");
1
2
3
4
// Python
driver = Graph.Database.driver("bolt://localhost")
session = driver.session()
result = session.run("MATCH (u:User) RETURN u.name")
1
2
3
4
// Java
Driver driver = GraphDatabase.driver( "bolt://localhost" );
try ( Session session = driver.session() ) {
StatementResult result = session.run("MATCH (u:User) RETURN u.name");
}
1
2
3
4
5
// .NET
using (var driver = GraphDatabase.Driver("bolt://localhost"))
using (var session = driver.Session())
{
var result = session.Run("MATCH (u:User) RETURN u.name");
}
1
2
3
4
5
6
![Page 24: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/24.jpg)
Ecrivez du code personnalisé :
En Java (compatible JVM)
Stocké sur le serveur (un jar à déployer)
Accessible en Cypher
Les procédures stockées
![Page 25: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/25.jpg)
Les procédures stockées : built-inCALL dbms.procedures() YIELD name
with split(name,".") AS parts
WHERE not parts[0] = 'apoc'
RETURN parts[0..-1] AS package, count(*),collect(parts[-1]) AS procs
1
2
3
4
![Page 26: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/26.jpg)
APOC
Obtenir le meta-graph : CALL apoc.meta.graph()
Charger des données en JDBC :
CALL apoc.load.driver('com.mysql.jdbc.Driver')
CALL apoc.load.jdbc('jdbc:mysql:localhost/mysql', 'SELECT * FROM user') YIELD rowCREATE (:User {name:row.User})
Charger des données JSON
Des fonctions spatiales
…
https://github.com/neo4j-contrib/neo4j-apoc-procedures
![Page 27: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/27.jpg)
Neo4j Browser SyncSynchronisez vos scripts, con�guration, style sur tous vos navigateurs
![Page 28: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/28.jpg)
Cypher
ENDS WITH et CONTAINS se basent maintenant sur les indexes (tout comme STARTS WITH en 2.3)
Amélioration globale des performances sur les aggregations (ex: count sur les labels)
Amélioration des performances d’écritures / écritures
Upgrade de lucene
Planneur basé sur les coûts pour les écritures
![Page 29: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/29.jpg)
Cypher : planneur basé sur les coûts
Basé sur la connaissance des données en base (ie. des statistiques)
A été introduit en 2.2 pour les requêtes en lecture seule
Est disponible à présent aussi pour les requêtes d’écritures
Planneur par défaut
![Page 30: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/30.jpg)
Cypher : exampleCypher version: CYPHER 3.0, planner: RULE. 3060001 total db hits in 7197 ms.
Cypher version: CYPHER 3.0, planner: COST. 50003 total db hits in 3280 ms.
cypher planner=rule
MATCH (p:Product),(c:Category)
WHERE p.category_id = c.id
CREATE (c)-[:CONTAINS]->(p);
1
2
3
4
cypher planner=cost
MATCH (p:Product),(c:Category)
WHERE p.category_id = c.id
CREATE (c)-[:CONTAINS]->(p);
1
2
3
4
![Page 31: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/31.jpg)
Cypher : shortestpathLes prédicats utilisés dans la clause WHERE sont maintenant évalués pendant l’algorithme !
MATCH (a:Loc {name:"Nantes"}),(b:Loc {name:"Paris"})
MATCH trip = shortestPath((a)-[roads:ROAD*]->(b))
WHERE
NONE(r in roads WHERE r.closed or r.speed < 30) AND
ALL (r in roads WHERE r.type = 'Autoroute') AND
reduce(s=0, r in roads | s + r.distance) < 300
RETURN trip;
1
2
3
4
5
6
7
![Page 32: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/32.jpg)
Comment upgrader ?
![Page 33: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/33.jpg)
Upgrader en 3.X
Java 8
Mise à jour du store : dbms.allow_format_migration=true
Mise à jour de lucene : reconstruction des indexes
Mise à jour de la con�guration : java -jar config-migrator.jar path/to/neo4j2.3path/to/neo4j3.0
http://neo4j.com/guides/upgrade/#neo4j-3-0
![Page 34: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/34.jpg)
Merci
![Page 35: Neo4j 3 - sim51.github.iosim51.github.io/presentations/neo4j_3.0/slides.pdf · neo4j 3.0 b eno i t s i mar d (@l o g i si ma) in t ro d u ct io n # nq ikuko c $ f f kevgcw zitcr j](https://reader034.vdocuments.pub/reader034/viewer/2022052101/603b9edd88840168507d78f9/html5/thumbnails/35.jpg)
Des questions ?
Twitter: Suivez les comptes @neojFr & @neo4j
Google group : Avec les groupes Neo4jFr & Neo4j
Stackover�ow : avec les tags neo4j & cypher
Slack : http://neo4j-users-slack-invite.herokuapp.com/