APLAS 2020
Banyan: Coordination-free distributed transaction over mergeable types
-
Availability
-
Consistency
-
Convergence
Distributed Applications :
Challenges & Expectations

What does CAP say ???

Why Replication ???
If the availability is ensured...


|
|
||
|---|---|---|
|
Balance between availability and coordination |
Eventually Consistent Database |
|
| Resolving conflicts to converge | Data types with support for conflict resolution |
Banyan
-
A programming model based on the principles of Git
-
Works with Mergeable Replicated Datatypes, using 3-way merge to resolve conflicts
-
Provides coordination-free and isolated transactions
-
Works with off-the-shelf distributed datastore
-
Provides per-object causal consistency
What do we get ???
Distributed Build System
Use Case:
-
Large number of developers are continuously creating, modifying and building application libraries

What do we get ???
Distributed Build System
No caching vs Fully cached libraries
What do we get ???
Distributed Build System
Partially cached dependent libraries

Application Programming Interface (API)
API:
-
connect : config -> session
-
close : session -> unit
-
read : session -> key -> value option
-
write : session -> key -> value -> unit
-
refresh : session -> unit
-
publish : session -> unit
Programming Model
S0
S1
P0
p0-c0
p0-c1
p0-c2
p0-c3
p0-c4
s1-c0
s1-c1
s1-c2
s0-c0
s0-c1
P1
p1-c0
p1-c1
p1-c2
p1-c3
connect
connect
publish
publish
publish
refresh
publish
publish
refresh
remote
refresh
remote
Replica1
Replica2
Irmin Data Model
Session S0
Session S1
c0
c1
/
foo
v0
Tag Store
Block Store
S0 : Write foo v0
S1 : Write foo v0
Session S0
Session S1
Pub P0
c0
c2
c1
/
/
foo
bar
v0
v1
Tag Store
Block Store
S1 : Write bar v1
S1 : Publish
Irmin Data Model
Replica1
Replica2
0
0
1
2
9
3
7
3
5
3
clone
merge
merge
+1
+2
+2
+4
Counter.merge 0 2 1
Counter.merge 0 1 2
Resolving Conflicts (3-way merge)
Counter.merge 3 5 7
How versioning happens ???
User Command : Write s1 k1 v1
Tag Store
Block Store
Read Count
0
Write Count
0
v1
Hash
0x1AB523
Banyan_Write bs 0x1AB523 v1
Step 1:
User Command : Write s1 k1 v1
0x1AB523
v1
Tag Store
Block Store
Read Count
Write Count
1
1
(k1, 0x1AB523)
Hash
0xEF53A6
Banyan_Write bs 0xEF53A6 (k1, 0x1AB523)
Step 2:
User Command : Write s1 k1 v1
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
Tag Store
Block Store
Read Count
Write Count
1
1
2
(0xEF53A6,[])
Hash
0x58CD12
Banyan_Write bs 0x58CD12 (0xEF53A6,[])
Step 3:
User Command : Write s1 k1 v1
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
Tag Store
Block Store
Read Count
Write Count
1
3
2
Banyan_Write ts s1 0x58CD12
Step 4:
User Command : Write s1 k1 v1
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
Tag Store
Block Store
Read Count
Write Count
1
3
4
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
Tag Store
Block Store
Read Count
Write Count
1
4
2
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
Tag Store
Block Store
Read Count
Write Count
3
4
2
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
Tag Store
Block Store
Read Count
Write Count
3
4
4
Banyan_Write bs 0x20AC45 v2
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
v2
Hash
0x20AC45
Step 1:
0x20AC45
v2
Tag Store
Block Store
Read Count
Write Count
4
4
5
Banyan_Write 0xBD268A [(k1, 0x1AB523), (k2, 0x20AC45)]
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
0x20AC45
v2
Hash
0xBD268A
Step 2:
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
[(k1, 0x1AB523), (k2, 0x20AC45)]
Tag Store
Block Store
Read Count
Write Count
4
6
5
Banyan_Write 0xFC98A3 (0xBD268A,[0x58CD12])
User Command : Write s1 k2 v2
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
0x58CD12
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
(0xBD268A, [0x58CD12])
Hash
0xFC98A3
Step 3:
0xFC98A3
(0xBD268A,[0x58CD12])
Tag Store
Block Store
Read Count
Write Count
4
6
7
User Command : Write s1 k2 v2
Tag Store
Block Store
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
0xFC98A3
Banyan_Write s1 0xFC98A3
Step 4:
0xFC98A3
(0xBD268A,[0x58CD12])
Read Count
Write Count
4
8
7
0x58CD12
User Command : Read s1 k2
Tag Store
Block Store
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
0xFC98A3
Banyan_Read ts s1
Step 1:
0xFC98A3
(0xBD268A,[0x58CD12])
Read Count
Write Count
0
0
1
User Command : Read s1 k2
Tag Store
Block Store
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
0xFC98A3
Banyan_Read BlockStore 0xFC98A3
Step 2:
0xFC98A3
(0xBD268A,[0x58CD12])
Read Count
Write Count
2
0
1
User Command : Read s1 k2
Tag Store
Block Store
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
0xFC98A3
Banyan_Read BlockStore 0xBD268A k2
Step 3:
0xFC98A3
(0xBD268A,[0x58CD12])
Read Count
Write Count
2
0
3
User Command : Read s1 k2
Tag Store
Block Store
0x58CD12
(0xEF53A6,[])
0xEF53A6
[(k1, 0x1AB523)]
0x1AB523
v1
s1
0x20AC45
v2
0xBD268A
[(k1, 0x1AB523), (k2, 0x20AC45)]
0xFC98A3
Banyan_Read BlockStore 0x20AC45
Step 4:
0xFC98A3
(0xBD268A,[0x58CD12])
Read Count
Write Count
4
0
3
Performance

Baseline comparison with Cassandra
-
With single client Cassandra is 50 times faster than Banyan
-
With 128 clients Cassandra is 6.2 times faster than Banyan

-
Throughput is proportional to no. of conflicts
-
Larger keyspace results in lesser conflicts and higher throughput
Performance of Counter implementation over Banyan
Thank you
APLAS 2020
By Shashank shekhar Dubey
APLAS 2020
- 39