origodb - your data fits in ram

18
OrigoDB Your data fits in RAM @robertfriberg [email protected] origodb.com

Upload: robert-friberg

Post on 16-Apr-2017

681 views

Category:

Software


2 download

TRANSCRIPT

Page 1: OrigoDB - Your data fits in RAM

OrigoDBYour data fits in RAM

@[email protected]

origodb.com

Page 2: OrigoDB - Your data fits in RAM

Price/GB vs GB/Server 1980- 2015

8 USD

6.480.000 USD

0.001 GB

2000 GB

Page 3: OrigoDB - Your data fits in RAM

Your data fits in RAM!

Page 4: OrigoDB - Your data fits in RAM

Speed of light vs spinning metalWhat Time ScaleL1 Cache 0.5 ns 0.008 2 mL2 Cache 7 ns 0.23RAM 60 ns 1 240 m 1 second1K over Gbit network 10 µs 167 2.5 minutes4K read SSD 150 µs 2500Rotating disk seek 10 ms 167000 40000 km 46 hours

Page 5: OrigoDB - Your data fits in RAM

What’s the problem?

ServiceLayer

DomainLayer

Data AccessLayer

RelationalModel

Views/SP’s

CacheX

Page 6: OrigoDB - Your data fits in RAM

B-trees and Transactions

LOG

DATA 64KB blocks w 8x8KB pagesLogical BTREE of 8kb data pagesIn the buffer pool (cache)

BufferManager

Transactions append inserted, deleted, original and modified pages to the LOG

CHECKPOINT

Page 7: OrigoDB - Your data fits in RAM

THE RDBMS Architecture is

Obsolete

Page 8: OrigoDB - Your data fits in RAM

3. OrigoDBBuild faster systems faster

Page 9: OrigoDB - Your data fits in RAM

One simple idea...

Keep state in memoryPersist operations, not system state

s0 s1 s2op1 op2

Sn = apply(opn, Sn-1)

Page 10: OrigoDB - Your data fits in RAM

... with many names• System prevalance – Prevayler, java• MongoDB op log• Redis AOF• Memory Image – Martin Fowler• VoltDB – logical logging• Akka persistence – logging per actor• Event Sourcing

Page 11: OrigoDB - Your data fits in RAM

OrigoDB

Kernel

Engine

Model

Storage

App Code

Server

Command

Query

FileSqlEvent StoreCustom

ConsistencyIsolationconcurrency

Sends commands and queries

JournalingSnapshotsBinaryFormatterProtoBufJSON

tcpJSON/http

In-processcalls

Domain specificobject-graph

Domain specific operations

ReplicationAd-hoc queriesWeb uiConsole or win svc

Page 12: OrigoDB - Your data fits in RAM

Complete history of events• Point in time • Debugging• Restore• Queries

• Audit trail• New interpretations

Page 13: OrigoDB - Your data fits in RAM

Example – the model[Serializable]public class CommerceModel : Model{ internal SortedDictionary<Guid, Customer> Customers { get; set; } internal SortedDictionary<Guid, Order> Orders { get; set; } internal SortedDictionary<Guid, Product> Products { get; set; }

public CommerceModel() { Customers = new SortedDictionary<Guid, Customer>(); Orders = new SortedDictionary<Guid, Order>(); Products = new SortedDictionary<Guid, Product>(); } }

Page 14: OrigoDB - Your data fits in RAM

Command[Serializable]public class AddCustomer : Command<CommerceModel>{ public readonly Guid Id; public readonly string Name;

public AddCustomer(Guid id, String name) { Id = id; Name = name; }

public override void Execute(CommerceModel model) { if (model.Customers.ContainsKey(Id)) Abort("Duplicate customer id"); var customer = new Customer {Id = Id, Name = Name}; model.Customers.Add(Id, customer); }}

Page 15: OrigoDB - Your data fits in RAM

Query[Serializable]public class CustomerById : Query<CommerceModel, CustomerView>{ public readonly Guid Id;

public CustomerById(Guid id) { Id = id; } public override CustomerView Execute(CommerceModel model) { if (!model.Customers.ContainsKey(Id)) throw new Exception("no such customer"); return new CustomerView(model.Customers[Id]); }}

Page 16: OrigoDB - Your data fits in RAM

Start your engines!static void Main(string[] args){ var engine = Engine.For<CommerceModel>(); Guid id = Guid.NewGuid(); var customerCommand = new AddCustomer(id, "Homer"); engine.Execute(customerCommand);

var customerView = engine.Execute(new CustomerById(id));

Console.WriteLine(customerView.Name); Console.WriteLine("{0} orders", customerView.OrderIds.Count); Console.ReadLine();}

Page 17: OrigoDB - Your data fits in RAM

Demos!Geekstream

Graphsorigodb.com

spatial modeling – shortest path

Page 18: OrigoDB - Your data fits in RAM

Thank you!• Try Origo!• Contribute, it’s open source• http://origodb.com• @robertfriberg, [email protected]