Deconstructing the Database
Rich Hickey
Deconstructing the Database Rich Hickey Most programs are outside - - PowerPoint PPT Presentation
Deconstructing the Database Rich Hickey Most programs are outside the bounds of and single process we write in any single FP language What is Datomic? A new database A sound model of information, with time Provides database as a
Rich Hickey
... and keep
Value
magnitude, quantity, number... or immutable composite thereof
Identity
associate with a series of causally related values (states) over time
State
moment in time
Time
v1 F v2 F v3 F v4
Process events (pure functions) Observers/perception/memory
States (immutable values)
Identity (succession of states)
Past Next
Process events (pure functions) Observers/perception/memory Identity (succession of states)
DB Connection Transactions Queries
The Database Place
F F F
v1 F v2 F v3 F v4
Process events (pure functions) Observers/perception/memory
States (immutable values)
Identity (succession of states)
DB Connection Transactions DB Values Queries
cache Server Indexing Trans- actions Query App Process I/O App ORM? Caching policy? Strings DDL + DML Result Sets Serialized ??? Serialized ??? Disk
happened or existed’
Server Indexing Trans- actions Query I/O Disk
Releases memory
Index Merging Trans- actions Log Data Segments Live Index Index Data Segments Storage Novelty
Live Index Storage Index Data Segments Novelty
App Server Process Peer Lib Query Cache App Live Index Comm App Server Process Peer Lib Query Cache App Live Index Comm Transactor Indexing Trans- actions App Server Process Peer Lib Query Cache App Live Index Comm Transactor Indexing Trans- actions Data Segments Data Segments Redundant segment storage Storage Service Segment storage memcached cluster (optional) standby
VAET
Past Next
EAVT t VeAET AEVT db atom nextT asOfT Lucene index history live Lucene sinceT index db value live Storage Hierarchical Cache Roots Memory index (live window) Storage-backed index
Identity Value
Sorted Datoms Index Root
T 42 VeAET AEVT AVET Lucene EAVT dirs segs Index ref
Identity Value
redundant, distributed, highly available durable eventually consistent
redundant, durable, consistent (ordered ops + CAS)
Riak ZooKeeper
Index ref Log ref Catalog ref Coord ref
Identities Values
‘first found’ semantics
no vector clocks, siblings etc
Transactor Indexing Trans- actions App Process App Process Peer App Server Process Peer Lib Query Cache App Live Index Comm Transactor Indexing Trans- actions Data Segments Redundant segment storage Storage Server/Service Segment storage Peer Service Peer Service Peer REST Server Query Cache REST Server Live Index Comm App Process App Process Client App Process (any language) App REST Client Data Segments memcached cluster (optional) HTTP + Server-Sent Events Standby
//Peer Database db = connection.db().asOf(1000); Peer.q(aQuery, db); //Client GET /data/mem/test/1000/datoms?index=aevt
basis
[[:fred :likes "Pizza"] [:sally :likes "Ice cream"]]