He Herbert Jordan1, Pavle Subotić3, David Zhao2, and Bernhard Scholz2
PMAM 2019, 17 February 2019, Washington, DC
Brie: A Specialized Trie for Concurrent Datalog
1) University
- f Innsbruck
2) University
- f Sydney
3) Amazon
Brie: A Specialized Trie for Concurrent Datalog Jordan 1 , - - PowerPoint PPT Presentation
Brie: A Specialized Trie for Concurrent Datalog Jordan 1 , Pavle Suboti 3 , Herbert He David Zhao 2 , and Bernhard Scholz 2 PMAM 2019, 17 February 2019, Washington, DC 1) University of Innsbruck 2) University of Sydney 3)
PMAM 2019, 17 February 2019, Washington, DC
1) University
2) University
3) Amazon
2
a b c d e g f
from to a b a c b f c e d a d c … …
edge relation graph
3
a b c d e g f
from to a b a c b f c e d a d c … …
edge relation graph
4
a b c d e g f
from to a b a c b f c e d a d c … …
edge relation graph
5
path(X,Y) :- edge(X,Y). path(X,Z) :- path(X,Y), edge(Y,Z). a b c d e g f
from to a b a c b f c e d a d c … …
graph Da Datalog query edge relation
6
100s of relations and rules, billions of tuples, all in-memory
7
8
path(X,Z) :- path(X,Y), edge(Y,Z).
computational expensive and dominating part
› insertion, › scans, › range queries, › membership tests, › emptiness checks
9
well supported by B-tr trees challenging
› binary search
and inserts in sorted arrays
10
(9,4) (9,2) (8,7) (1,1) (1,2) (3,2) (4,7) (6,9) (7,4) (5,3) (8,2)
11
12
13
› insert sub-trees
demand using CAS
› introduce new root node using CAS
› using atomic bitwise
14
15
(0,3) (3,1) (7,2) 3 7 (3,1) (3,3) (3,4) 3 low density high density
16 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 10 20 30 40 50 60 70 80 90 100
memory [GB] elements in million
btree brie 100% brie 10% brie 5% brie 2% brie 1% brie 0.5% brie 0.1%
17 20 40 60 80 100 1000² 2000² 5000² 10000²
million insertions/s total elements inserted
std::set std::hash_set concurrent btree brie 0.1% brie 1% brie 100% 10 20 30 40 50 1000² 2000² 5000² 10000²
million insertions/s total elements inserted
std::set std::hash_set concurrent btree brie 0.1% brie 1% brie 100%
insertion random
insertion
18 20 40 60 80 100 1000² 2000² 5000² 10000²
million queries/s elements in set and number
queries
std::set std::hash_set concurrent btree brie 0.1% brie 1% brie 100% 200 400 1000² 2000² 5000² 10000²
million entries/s elements in set
std::set std::hash_set concurrent btree brie 0.1% brie 1% brie 100%
membership test (random
full range scan
19 0.1 1 10 100 1000 10000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% 0.1 1 10 100 1000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100%
insertion random
insertion 4x8 core Intel Xeon E5-4650
20 500 1000 1500 2000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% 50 100 150 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100%
insertion random
insertion 4x8 core Intel Xeon E5-4650 up to 11x faster than B-trees up to 15x faster than B-trees
100 200 300 400 500 600 700 800 900 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 total query time [s] number
threads btree brie mixed 21 2 4 6 8 10 12 14 16 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 Memory usage [GB] number
threads btree brie mixed
context sensitive var-points-to analysis ~4x faster
memory
› Developed concurrent set for Datalog relations:
– Trie derived structure + blocked nodes
› enables fast relational
– Low
synchronization
› atomic
synchronization sufficient
› Results:
– up to 5-17 17x faster for sequential insert and query
– up to 15 15x faster for parallel insertion
– up to 4x 4x faster and 50% 50% less memory for real-world qu quer ery proces essing
› Future work:
– investigate
data structures for specialized use cases
22
visit us on https://souffle-lang.github.io sources: https://github.com/souffle- lang/souffle/blob/master/src/Brie.h
23
27 0.1 1 10 100 1000 10000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% reduction btree 0.1 1 10 100 1000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% reduction btree
insertion random
insertion 4x8 core Intel Xeon E5-4650
28 500 1000 1500 2000 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% reduction btree 50 100 150 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
million insertions/s number
threads
tbb::hash_set concurrent btree brie 0.1% brie 1% brie 100% reduction btree
insertion random
insertion 4x8 core Intel Xeon E5-4650 up to 11x faster than B-trees up to 15x faster than B-trees
29
path(X,Z) :- path(X,Y), edge(Y,Z).