Erlang in Persistence

with 

       KVS

DATA

CONFIG

BACKUP

DATA

BerkeleyDB

LDAP X.500

SQL

CAP

  Availability    |    Consistency

Partitioning

Protocols

GOSSIP PAXOS RAFT LE 2PC ZAB


CouchDB Riak
Mnesia KAI LeoDB 
Hibari HanoiDB

Erlang 

mekao/pg

mnesia 2K

riak 500

KVS

riak

time ordering

nodes ring

consistent hashing

hand-offs

splits handling

replicated

CRDT 

PAXOS GOSSIP

riak

memory

bitcask

leveldb

core pipe kv dt

control

disc_copies   LOG
disc_only_copies  DETS 2G

table partitioning

      + unsplit

 + linear hashing

+ cluster interconnect

mnesia

CRDT

Register Counter Set Map

CONFIG

etcd raft

ZooKeeper zab

riak_ensemble paxos

Pitfalls

 

Secondary Indexes

 

1. LevelDB — HanoiDB, Riak

2. DETS — Mnesia, KAI

Pitfalls

 

Consistency

 

1. Reconcile — editing history

2. Sequence Lock — Process

Riak/WebMachine 
CouchDB/Own
FarWest/Cowboy

REST/N2O

REST

#phone

#otp

#application

#termination

#transfer

#charge

#withdraw

#client

ACT

#process

#sequenceFlow

#messageEvent #task

#serviceTask

#receiveTask

#userTask

#beginEvent

#endEvent #history

BPE

#account

#customer

#program

#card

#transaction

#cashback

#currency

DBS

#iterator

#container

#subscription

#user

#client

#config

KVS

#user { id, mail, name }

#product { id, name }

#review { id, body, product }

 

Record

#user { id, next, prev, ... }

#product { id, next, prev, ... }

#review { id, next, prev, ... }

Iterator

 

 #subscription { who,

                                  whom,

                                 what }

Indexes

Container

#container { id, top, count } 

         #iterator { idcontainer, 

                               prev, next

                               feeds = [] }

-define(CONTAINER, id, top, count=0).
-define(ITERATOR(Container),
          id, container=Container,
          feed_id, prev, next, feeds=[]).

-record(feed, {?CONTAINER, aclver}).
-record(user, {?ITERATOR(feed), name, email}).
-record(product, {?ITERATOR(feed), name}).

For each Container

we spawn Erlang Lock Process 

for Feed Write Operations 

ordering and consistensy

KVS

> kvs:dir().

[{table,history},
 {table,config},
 {table,feed},
 {table,beginEvent},
 {table,account},
 {table,schema},
 {table,otp},...]
> #user{}.

#user{id = undefined,version = undefined,
      container = feed, feed_id = undefined,
      prev = undefined,next = undefined,
      feeds = [],guard = true,
      etc = undefined,email = undefined,
      username = undefined,password = undefined,
      display_name = undefined,
      register_date = undefined,
      tokens = [],avatar = undefined,
      names = undefined, surnames = undefined,
      birth = undefined,sex = undefined,
      date = undefined,status = undefined,
      zone = undefined, type = undefined}

Erlang in Persistence

By Maxim Sokhatsky

Erlang in Persistence

  • 1,290
Loading comments...

More from Maxim Sokhatsky