6. Neo4j
• OSS implement of GraphDB
• High availability
• Scales to billions of nods and relationships
• High speed querying through traversals
• For more Information about Neo4j
• http://www.slideshare.net/skimura/
13. A node data structure
Node Manager
Node Cache Relation Cache
14. A node data structure
Node Manager
Node Cache Relation Cache Cache Manager
15. A node data structure
Node Manager
Node Cache Relation Cache Cache Manager
Property Index
Manager
16. A node data structure
Node Manager
Node Cache Relation Cache Cache Manager
Property Index
Transaction Manager
Manager
17. A node data structure
Node Manager
Node Cache Relation Cache Cache Manager
Property Index
Transaction Manager Persistence Manager
Manager
18. A node data structure
Node Manager
Node Cache Relation Cache Cache Manager
Property Index
Transaction Manager Persistence Manager
Manager
id id id id
relationships relationships relationships relationships
Node Node Node Node
19. Node Manager
• NodeCache: Caching node id and node object
• RelationCache: Caching rel id and Relation object
• Cache Manager: Management cache threads
• Property Index Manager: Management all nodes
Properties
• Persistence Manager: Management store
29. Relationship structure
Node
id
relationships
relationships
In blocks
ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9
30. Relationship structure
Node
id
relationships
relationships
In blocks
ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9
Out blocks
ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
31. Relationship structure
Node
id Last In block
relationships
relationships
In blocks
ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9
Out blocks
ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
32. Relationship structure
Node
id Last In block
relationships Last Out block
relationships
In blocks
ID:1 ID:2 ID:3 ID:4 ID:5 ID:6 ID:7 ID:8 ID:9
Out blocks
ID:10 ID:11 ID:12 ID:13 ID:14 ID:15 ID:16 ID:17 ID:18
42. Introduction Create Node
Create New ID id
Node Manager
Node Cache
Persistence Manager
Relation Cache
NodeA
43. Introduction Create Node
Create New ID id
Create Node
Node Manager
id
Node Cache
relationships
Persistence Manager
NodeA
Relation Cache
NodeA
44. Introduction Create Node
Create New ID id
Create Node
Node Manager
id
register Node cache
Node Cache
relationships
Persistence Manager
NodeA
Relation Cache
NodeA
45. Introduction Create Node
Create New ID id
Create Node
Node Manager
id
register Node cache
Node Cache
relationships
Persistence Manager
register Persistence Manager
NodeA
Relation Cache
NodeA
46. Cache
• You can choice some cache type
• Strong Reference Cache
• Soft LRU Cache (default)
• Weak LRU Cache
• No Cache
47. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
48. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
1 VAL_1
2 VAL_2
3 VAL_3
4 VAL_4
5 VAL_5
49. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
1 VAL_1
2 VAL_2
Priority 3 VAL_3
4 VAL_4
5 VAL_5
50. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
GET KEY:5 1 VAL_1
2 VAL_2
Priority 3 VAL_3
4 VAL_4
5 VAL_5
51. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
GET KEY:5 5 VAL_5
1 VAL_1
Priority 2 VAL_2
3 VAL_3
4 VAL_4
52. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
5 VAL_5
1 VAL_1
Priority 2 VAL_2
3 VAL_3
4 VAL_4
53. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
PUT KEY:6 5 VAL_5
1 VAL_1
Priority 2 VAL_2
3 VAL_3
4 VAL_4
54. What is LRU Cache
• discards the least recently used items first.
http://en.wikipedia.org/wiki/Cache_algorithms
On memory
KEY VALUE
PUT KEY:6 6 VAL_6
5 VAL_5
Priority 1 VAL_1
2 VAL_2
3 VAL_3
65. Introduction Create Node
id
Node Manager relationships
Node Cache NodeA
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB
66. Introduction Create Node
id
Node Manager relationships
Node Cache NodeA
Register OUT direction to NodeB
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB
67. Introduction Create Node
id
Node Manager relationships
Node Cache NodeA
Register OUT direction to NodeB
Persistence Manager
id
Relation Cache
relationships
Register IN direction from NodeA
NodeB
NodeA NodeB
68. Introduction Create Node
id
Node Manager relationships
Node Cache NodeA
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB
69. Introduction Create Node
Create New Relation ID
rel id id
Node Manager relationships
Node Cache NodeA
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB
70. Introduction Create Node
Create New Relation ID
create Relationship
rel id id
Node Manager relationships
Node Cache NodeA
Relation
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB
71. Introduction Create Node
Create New Relation ID
create Relationship
rel id id
Node Manager relationships
Node Cache NodeA
Relation
Persistence Manager
id
Relation Cache
relationships
NodeB
NodeA NodeB