origodb - your data fits in ram
TRANSCRIPT
![Page 2: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/2.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/3.jpg)
Your data fits in RAM!
![Page 4: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/5.jpg)
What’s the problem?
ServiceLayer
DomainLayer
Data AccessLayer
RelationalModel
Views/SP’s
CacheX
![Page 6: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/7.jpg)
THE RDBMS Architecture is
Obsolete
![Page 8: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/8.jpg)
3. OrigoDBBuild faster systems faster
![Page 9: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/9.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/10.jpg)
... 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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/12.jpg)
Complete history of events• Point in time • Debugging• Restore• Queries
• Audit trail• New interpretations
![Page 13: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/13.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/14.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/15.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/17.jpg)
Demos!Geekstream
Graphsorigodb.com
spatial modeling – shortest path
![Page 18: OrigoDB - Your data fits in RAM](https://reader036.vdocuments.mx/reader036/viewer/2022082908/5872afce1a28ab523c8b53e1/html5/thumbnails/18.jpg)
Thank you!• Try Origo!• Contribute, it’s open source• http://origodb.com• @robertfriberg, [email protected]