시작은 Mobile DB
LevelDB,
Couchbase,
CloudantSync-android,
JasDB,
RocksDB,
LMDB,
OrientDB,
MapDB,
TSDocDB,
waspdb,
BananaDB,
SynchronizedDB
…
“이미 잘나가고 있는 제품을
쫓아갈 필요가 있을까?”
차별화가 필요해!
Conflict-free Replicated DataTypes
CRDT model
읽기
쓰기
쓰기
op
• 쓰기가 빠르다. (로컬 리모트)
• 쓰기 Operation을 통해 변경된 값만 교환
• 읽기가 빠르다. (No network)
• Offline에서도 동작한다.
• 또는 Replicated Abstract Data Types 연구
• Replicated-connected 모델
• Operation 기반의 동기화
local first, remote later
• Eventual consistencydata
type
data
type
data
type
data
type
data
type
• 유한한 element들의array
• Element에 대한 iteration 지원
• Newer Operation Wins on each element
Counter
Array
Variable
HashMap
LinkedList
Array<E>
Write op set(int i, E e)
Read op get(int i)
HashMap<K,V>
Write op put(K k, V v), remove(K k)
Read op get(K k)
• Key에 대해 Value를 mapping
• Key, value set에 대한 iteration 지원
• Newer Operation Wins on each key
Variable<V>
Write op set(V v)
Read op get()
• 하나의 value를 저장
• Newer Operation Wins
• V, E : boolean, integer, long, double, String, byte[], Date, JSON
• K: boolean, integer, long, double, String, byte[], Date, JSON
Kaleido
Data Types
• 2011. 06출시
• 2013. 04 Facebook 인수
• 2016. 01 parse.com 종료 발표(`17. 01)
open-source 전환
Amazon Cognito
디바이스 간의 계정 정보 동기화
• 2014. 07 공개
출처: Google I/O 2016 https://www.youtube.com/watch?v=tb2GZ3Bh4p8
• 2016. 05 renewal @ google I/O
• 2011. 09 출시
• 2014. 10 Google 인수
비교 대상
객체가 업데이트 되는방식: 단방향 전송
character
uniqueId S50WnnG6k
name 조조
war 96
power 72
intelli 91
politics 94
charisma 96
exp 1
skills
[“상업”, “치안“,
“논파”]
character.put(“power”, 82);
character.inc(“exp”);
character
uniqueId S50WnnG6k
name 조조
war 96
power 72
intelli 91
politics 94
charisma 96
exp 1
skills
[“상업”, “치안“,
“논파”]
character.put(“war”, 62);
character.inc(“exp”);
Client Server
변경 사항만 전송 or 전체 값 전송?
동기화를 위한 세가지선택 사항?
Stateless
or
Stateful objects
Unidirectional snapshot
or
Bidirectional changes
Conflict-not-free
or
Conflict-free
52.
• Attach: 데이터타입의생성 및 Push-Pull 을 등록
• Push-Pull: client / server 간에 operation들을
교환
• Detach: 데이터타입을 Push-Pull을 해제
Connect replicated objects
APPD model
Kaleido
Data Type
Client
ATTACH
DETACH
PUSH-PULL
53.
COUNTER
VARIABLE
ARRAY
HASH MAP
LINKED LISTKaleido
Server
COUNTER
VARIABLE
ARRAY
HASH MAP
LINKED LIST
COUNTER
VARIABLE
ARRAY
HASH MAP
LINKED LIST
COUNTER
VARIABLE
ARRAY
HASH MAP
LINKED LIST
Client (SQLite)
Attach
some of them
3
4
5
6
7
8
9
Snapshot
4
5
6
7
8
operations
+
operations
KaleidoClient
Client DB of attached data type
데이터 타입
객체 관리
동기화
54.
Conflict-free, but Iknow what
you did last operations
3
4
5
6
7
8
9
3
4
5
6
7
pulled
ops
pushed
ops8
9
10
11
Client Server
3
4
5
6
7
8
9
3
4
5
6
7
Client Server
Newly
generated
ops
Newly
arrived
ops
PushPull
8 9
PushPull
동일한 상태에서
sync?