Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FoundationDB (next)

FoundationDB (next)

En 2018, Apple open-source une base de donnée qu'elle a racheté quelques années avant. Qu'est ce qui se cache derrière ce nom faramineux?! Quand et pourquoi utiliser cette base de données? Quelles sont les connaissances requises pour démarrer la programmation avec FoundationDB?

_amirouche_

November 06, 2019
Tweet

More Decks by _amirouche_

Other Decks in Programming

Transcript

  1. What? Who? Why? When? How? What is FoundationDB? Who use

    FoundationDB? Why and when to use FoundationDB? How to program FoundationDB?
  2. What is FoundationDB? jespen.io + simulation tested ⇒ ACID predictable

    ⇒ C(A)P reasonably scalable ⇒ Ordered Key-Value Store ⇒ versatile
  3. Why and When to use FoundationDB? Need more than 1

    TB? Need Fault Tolerance? Need Replication? Have money to spare? Want to have fun?!
  4. When not to use FoundationDB? When SQLite LSM extension is

    enough? When MongoDB WiredTiger is not free anymore?! When you understand Facebook RocksDB API? When Google LevelDB is fast enough? (Oracle Berkeley Database)
  5. How to program FoundationDB? (1/5) Ordered Key Value Store =

    Lexicographic Order = Natural Language Dictionary Order = 1 < 10 < 42 < “2” < “car” < “care” < “careful”
  6. How to program FoundationDB? (2/5) Ordered Key Value Store =

    “Natural” Ordering != Insertion Order
  7. from fdb import tuple # FDB manipulates bytes, but expose

    Python objects via fdb.tuple. expected = (42, 42.0, “\x42”, “42”, (“hello”, “world”)) assert tuple.pack(tuple.unpack(expected)) == expected # Remember that fdb.tuple will preserve natural ordering for base data types: # int, float, byte, string, tuples
  8. How to program FoundationDB? (4/5) Insertion order does not matter

    ⇒ The key space has a predictable order ⇒ Slices of keys are predictable ⇒ One can build data-structures on top ordered key-values
  9. How to program FoundationDB? (5/5) Key Value (‘article’, ‘metadata’, ‘rows’)

    (‘title’, ‘body’) (‘article’, ‘row’, 1) (‘basic’, ‘a range is a slice’) (‘article’, ‘row’, 2) (‘idiom’, ‘read the documentation’) (‘article’, ‘row’, 3) (‘more’, ‘ranges and prefixes for the win’) (‘article’, ‘index’, ‘title’, ‘basic’) ... ... ...