Erlang in Persistence

with 

       KVS

SCHEMA

VERSIONING

BACKUP

FAILOVER

DATA

BerkeleyDB/LevelDB/RocksDB

LDAP/X.500/Alfresco

SQL (Offline)

CAP theorem

  Availability    |    Consistency

Partitioning

Protocols

GOSSIP PAXOS RAFT LE 2PC/CR/MDTC ZAB BFT

CouchDB Riak Cassandra (Apple)
ISO MUMPS/InterSystems Caché (VISA, Дія СЕВ ОВВ)
BerkleyDB/LevelDB/RocksDB (Google, Meta)
Erlang/OTP Mnesia (ПриватБанк, МВС)

MongoDB (ЕСОЗ)

Erlang 

AP DB

replicas = 3

nodes = ЕСОЗ 6

consensus = 66%

CTO Amazon Dynamo

AP DB

time ordering

nodes ring

consistent hashing

hand-offs

splits handling

replicated CRDT 

PAXOS GOSSIP

Cassandra

memory

bitcask (time series)

leveldb

disc_copies   LOG
disc_only_copies  DETS 2G

table partitioning

      + unsplit

 + linear hashing

+ cluster interconnect

Mnesia

CONFIG

etcd raft

ZooKeeper zab

riak_ensemble paxos

LDAP

LDAP

HL7/FHIR

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

  • 2,506