SlideShare uma empresa Scribd logo
1 de 41
Functional Distributed Programming with Irmin
QCon NYC 2015, New York
Anil Madhavapeddy (speaker)
with Benjamin Farinier, Thomas Gazagnaire, Thomas Leonard
University of Cambridge Computer Laboratory
June 12, 2015
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 1 / 29
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/irmin
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Background
Git in the datacenter
Irmin, a large-scale, immutable, branch-consistent storage
Weakly consistent data structures
Mergeable queues
Mergeable ropes
Benchmarking Irmin
Use Cases
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 2 / 29
Background Git in the datacenter
Common features every distributed system needs
• Persistence for fault tolerance and scaling
• Scheduling of communication between nodes
• Tracing across nodes for debugging and profiling
Most distributed systems run over an operating system, and so are
stuck with the OS kernel exerting control. We use unikernels, which
are application VMs that have complete control over their resources.
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 3 / 29
Background Git in the datacenter
What if we just used Git?
• Persistence
• git clone of a shared repository across nodes
• git commit of local operations in the node
• Scheduling
• git pull to receive events from other nodes
• git push to publish events to other nodes
• Tracing and Debugging
• git log to see global operations
• git checkout to roll back time to a snapshot
• git bisect to locate problem messages
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 4 / 29
Background Git in the datacenter
Problems with using Git?
• Garbage Collection
• Git records all operations permanently, so our database will grow
permanently!
• git rebase is needed to compact history.
• Shell Control
• Calling the git command-line is slow and lacks fine control.
• Makes it hard to extend the Git protocol for additional features.
• Programming Model
• Git is designed for distributed source code manipulation.
• Built-in merge functions designed around text files.
• Let’s use it for distributed data structures instead!
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 5 / 29
Background Irmin, a large-scale, immutable, branch-consistent storage
Irmin, large-scale, immutable, branch-consistent storage
• Irmin is a library to persist and synchronize distributed data
structures both on-disk and in-memory
• It enables a style of programming very similar to the Git workflow,
where distributed nodes fork, fetch, merge and push data between
each other
• The general idea is that you want every active node to get a local
(partial) copy of a global database and always be very explicit
about how and when data is shared and migrated
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 6 / 29
Background Irmin, a large-scale, immutable, branch-consistent storage
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 7 / 29
Background Irmin, a large-scale, immutable, branch-consistent storage
type t = ...
(** User -defined contents. *)
type result = [
‘Ok of t
| ‘Conflict of string
]
val merge:
old:t → t → t → result
(** 3-way merge functions. *)
old
x y
?
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 8 / 29
Background Irmin, a large-scale, immutable, branch-consistent storage
Demo: Distributed Logging
Multiple nodes all logging to a central store:
1 Design the logging data structure.
• A log is a list of (string + timestamp)
• When merging, the timestamps must be in increasing order
• Equal timestamps can be in any order
• With this logic, merge conflicts are impossible
2 Every node clones the log repository
3 A log is recorded locally, then pushed centrally.
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 9 / 29
Weakly consistent data structures
Weakly consistent data structures
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 10 / 29
Weakly consistent data structures Mergeable queues
Mergeable queues
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 11 / 29
Weakly consistent data structures Mergeable queues
module type IrminQueue.S = sig
type t
type elt
val create : unit → t
val length : t → int
val is_empty : t → bool
val push : t → elt → t
val pop : t → (elt * t)
val peek : t → (elt * t)
val merge : IrminMerge.t
end
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 12 / 29
Weakly consistent data structures Mergeable queues
I0
n01
n02
n03
n04
n05
n06
n07
I1
n11
n12
n13
n14
top
bottom
top
bottom
Index
Node
Elt
pop list
push list
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 13 / 29
Weakly consistent data structures Mergeable queues
I old
A
B
C
D
I 1
A
B
C
D
E
I 2
B
C
D
F
G
I 1
B
C
D
E
I 2
F
G
I 1
B
C
D
E
I 2
F
G
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 14 / 29
Weakly consistent data structures Mergeable queues
Current state
Operation Read Write
Push 0 2 O(1)
Pop 2 on average 1 on average O(1)
Merge n 1 O(n)
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 15 / 29
Weakly consistent data structures Mergeable queues
Current state
Operation Read Write
Push 0 2 O(1)
Pop 2 on average 1 on average O(1)
Merge n 1 O(n)
With a little more work
Operation Read Write
Push 0 2 O(1)
Pop 2 on average 1 on average O(1)
Merge log n 1 O(log n)
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 15 / 29
Weakly consistent data structures Mergeable ropes
Mergeable ropes
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 16 / 29
Weakly consistent data structures Mergeable ropes
module type IrminRope.S = sig
type t
type value (* e.g char *)
type cont (* e.g string *)
val create : unit → t
val make : cont → t
...
val set : t → int → value → t
val get : t → int → value
val insert : t → int → cont → t
val delete : t → int → int → t
val append : t → t → t
val split : t → int → (t * t)
val merge : IrminMerge.t
end
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 17 / 29
Weakly consistent data structures Mergeable ropes
Operation Rope String
Set/Get O(log n) O(1)
Split O(log n) O(1)
Concatenate O(log n) O(n)
Insert O(log n) O(n)
Delete O(log n) O(n)
Merge log (f (n)) f (n)
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 18 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
5
2 2
lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
5
2 2
lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
5
2 2 2
lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
5
2 2 2 4
3lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
5 5
2 2 2 4
3lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
10
5 5
2 2 2 4
3lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Weakly consistent data structures Mergeable ropes
10
5 2
2 2 1
lo rem ip sum
do
a met
10
5 5
2 2 2 1
lo rem ip sum do lor a met
10
5 2
2 2 4
3lo rem ip sum
do
sit a
met
10
5 5
2 2 2 4
3lo rem ip sum do lor
sit a
met
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
Benchmarking Irmin
Benchmarking Irmin
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 20 / 29
Benchmarking Irmin
0
100000
200000
300000
400000
500000
0 500 1000 1500 2000 2500 3000 3500 4000 4500
Timespentforwholeoperations(µs)
Number of push/pop successively applied
Core
Obj
Memory
GitMem
GitDsk
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 21 / 29
Benchmarking Irmin
module ObjBackend ... = struct
type t = unit
type key = K.t
type value = V.t
let create () = return ()
let clear () = return ()
let add t value =
return (Obj.magic (Obj.repr value))
let read t key =
return (Obj.obj (Obj.magic key))
let mem t key = return true
...
end
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 22 / 29
Benchmarking Irmin
0
100
200
300
400
500
0 500 1000 1500 2000 2500 3000 3500 4000 4500
Timespentforwholeoperations(µs)
Number of push/pop successively applied
Core
Obj
Memory
GitMem
GitDsk
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 23 / 29
Use Cases
Use Cases
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 24 / 29
Use Cases
Demo: Dog, a loyal synchronization tool
Command line interface to logging clients at
https://github.com/samoht/dog
1 dog listen to setup the server listener
• Server maintains list of clients in a subtree
• It regularly merges all clients in parallel to master branch
2 dog init starts up a client logger
3 dog push syncs the client with the server
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 25 / 29
Use Cases
Demo: CueKeeper, an Irmin TODO manager
Do Git programming in the browser
https://github.com/talex5/cuekeeper
http://test.roscidus.com/CueKeeper/
1 Irmin is written in OCaml, and compiles to efficient JavaScript
• Git objects are mapped into IndexedDB
• Uses LocalStorage to sync between tabs
2 DOM elements are computed from the Git store (a React-like
model)
3 Client has full history, snapshotting and custom merge logic.
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 26 / 29
Use Cases
Demo: XenStore TNG
The Xen hypervisor toolstack
https://www.youtube.com/watch?v=DSzvFwIVm5s
1 Xen is a widely deployed hypervisor (Amazon EC2, Rackspace
Cloud, ...)
• Every VM boot needs a lot of communication
• Tracing when something goes wrong is hard
• Programming model is quite reactive
2 Dave Scott from Citrix ported the core toolstack to use Irmin,
and made it faster!
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 27 / 29
Use Cases
Why OCaml?
• Let us prototype complex functional datastructures very quickly
• Efficient compilation to native code (x86, ARM, PowerPC,
Sparc, ...), unikernels (MirageOS), JavaScript and Java
• Execution model is strict and predictable, important for
systems programming
• Native code compilation is statically linked, or can be used as a
normal shared library
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 28 / 29
Use Cases
Irmin Status (“Not Entirely Insane”)
• Still pre 1.0, but several useful datastructures such as
distributed queues and efficient ropes.
• HTTP REST for remote clients, library via OCaml, or
command-line interface.
• Bidirectional operation, so git commits map to Irmin commits
from any direction.
• Open source at https://irmin.io, installable via the OPAM
package manager at https://opam.ocaml.org
• Feedback welcome at
mirageos-devel@lists.xenproject.org or
https://github.com/mirage/irmin/issues
Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 29 / 29
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/irmin

Mais conteúdo relacionado

Destaque

Williams Brochure Welding Products
Williams Brochure Welding ProductsWilliams Brochure Welding Products
Williams Brochure Welding ProductsJohn Turley
 
Przestrzeń Miasta - Maciej Jędraszek
Przestrzeń Miasta - Maciej JędraszekPrzestrzeń Miasta - Maciej Jędraszek
Przestrzeń Miasta - Maciej Jędraszekecommerce poland expo
 
Virtual and Augmented Reality Analytics Digility
Virtual and Augmented Reality Analytics DigilityVirtual and Augmented Reality Analytics Digility
Virtual and Augmented Reality Analytics DigilityJoerg Osarek
 
updated BE RETRO FINAL PROJECT
updated BE RETRO FINAL PROJECTupdated BE RETRO FINAL PROJECT
updated BE RETRO FINAL PROJECTKamyle Glover
 
Colombia Prospera con Tolima
Colombia Prospera con TolimaColombia Prospera con Tolima
Colombia Prospera con TolimaColombia Prospera
 
Freds Resume&Portfolio08
Freds Resume&Portfolio08Freds Resume&Portfolio08
Freds Resume&Portfolio08FredBratteson
 
Actividades para el desarrollo de la ejecucion verbal
Actividades para el desarrollo de la ejecucion verbalActividades para el desarrollo de la ejecucion verbal
Actividades para el desarrollo de la ejecucion verbalRafael Martínez Gallardo
 
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...Asociación Europea de Arbitraje Arbitraje
 
Presentacion cultura rastafari
Presentacion cultura rastafariPresentacion cultura rastafari
Presentacion cultura rastafariluzdelunamitzy
 
Xvii camporee de guias mayores de la mision central de nicaragua3(1)
Xvii camporee de guias mayores de la mision central de nicaragua3(1)Xvii camporee de guias mayores de la mision central de nicaragua3(1)
Xvii camporee de guias mayores de la mision central de nicaragua3(1)Guiasmayores Ebenezer
 
Hu-Friedy Hand Essentials
Hu-Friedy Hand EssentialsHu-Friedy Hand Essentials
Hu-Friedy Hand EssentialsHu-Friedy Mfg.
 
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...Víctor Puig
 
Revista Bimby Março 2015
Revista Bimby Março 2015Revista Bimby Março 2015
Revista Bimby Março 2015Vanda Maio
 
Algoritmo abn
Algoritmo abnAlgoritmo abn
Algoritmo abnnoemipg94
 

Destaque (19)

Williams Brochure Welding Products
Williams Brochure Welding ProductsWilliams Brochure Welding Products
Williams Brochure Welding Products
 
Przestrzeń Miasta - Maciej Jędraszek
Przestrzeń Miasta - Maciej JędraszekPrzestrzeń Miasta - Maciej Jędraszek
Przestrzeń Miasta - Maciej Jędraszek
 
Virtual and Augmented Reality Analytics Digility
Virtual and Augmented Reality Analytics DigilityVirtual and Augmented Reality Analytics Digility
Virtual and Augmented Reality Analytics Digility
 
Predicador de la gracia
Predicador de la graciaPredicador de la gracia
Predicador de la gracia
 
Espacio aereo
Espacio aereoEspacio aereo
Espacio aereo
 
updated BE RETRO FINAL PROJECT
updated BE RETRO FINAL PROJECTupdated BE RETRO FINAL PROJECT
updated BE RETRO FINAL PROJECT
 
Colombia Prospera con Tolima
Colombia Prospera con TolimaColombia Prospera con Tolima
Colombia Prospera con Tolima
 
Freds Resume&Portfolio08
Freds Resume&Portfolio08Freds Resume&Portfolio08
Freds Resume&Portfolio08
 
Actividades para el desarrollo de la ejecucion verbal
Actividades para el desarrollo de la ejecucion verbalActividades para el desarrollo de la ejecucion verbal
Actividades para el desarrollo de la ejecucion verbal
 
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...
Talleres de mediación CEMED ¡Apúntate antes del 27 de noviembre y podrás bene...
 
Presentacion cultura rastafari
Presentacion cultura rastafariPresentacion cultura rastafari
Presentacion cultura rastafari
 
Xvii camporee de guias mayores de la mision central de nicaragua3(1)
Xvii camporee de guias mayores de la mision central de nicaragua3(1)Xvii camporee de guias mayores de la mision central de nicaragua3(1)
Xvii camporee de guias mayores de la mision central de nicaragua3(1)
 
Musica maldita
Musica malditaMusica maldita
Musica maldita
 
Hu-Friedy Hand Essentials
Hu-Friedy Hand EssentialsHu-Friedy Hand Essentials
Hu-Friedy Hand Essentials
 
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...
¿De qué hablamos cuando hablamos de Social Media? Una charla a futuros commun...
 
Fórmulas prematuros
Fórmulas prematurosFórmulas prematuros
Fórmulas prematuros
 
Revista Bimby Março 2015
Revista Bimby Março 2015Revista Bimby Março 2015
Revista Bimby Março 2015
 
Algoritmo abn
Algoritmo abnAlgoritmo abn
Algoritmo abn
 
Axiom Magazine: Volume 1, Issue 3, October 2013
Axiom Magazine: Volume 1, Issue 3, October 2013Axiom Magazine: Volume 1, Issue 3, October 2013
Axiom Magazine: Volume 1, Issue 3, October 2013
 

Mais de C4Media

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoC4Media
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileC4Media
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020C4Media
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsC4Media
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No KeeperC4Media
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like OwnersC4Media
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaC4Media
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideC4Media
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 

Mais de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Último

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Último (20)

GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Functional Distributed Programming with Irmin

  • 1. Functional Distributed Programming with Irmin QCon NYC 2015, New York Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas Leonard University of Cambridge Computer Laboratory June 12, 2015 Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 1 / 29
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /irmin
  • 3. Presented at QCon New York www.qconnewyork.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. Background Git in the datacenter Irmin, a large-scale, immutable, branch-consistent storage Weakly consistent data structures Mergeable queues Mergeable ropes Benchmarking Irmin Use Cases Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 2 / 29
  • 5. Background Git in the datacenter Common features every distributed system needs • Persistence for fault tolerance and scaling • Scheduling of communication between nodes • Tracing across nodes for debugging and profiling Most distributed systems run over an operating system, and so are stuck with the OS kernel exerting control. We use unikernels, which are application VMs that have complete control over their resources. Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 3 / 29
  • 6. Background Git in the datacenter What if we just used Git? • Persistence • git clone of a shared repository across nodes • git commit of local operations in the node • Scheduling • git pull to receive events from other nodes • git push to publish events to other nodes • Tracing and Debugging • git log to see global operations • git checkout to roll back time to a snapshot • git bisect to locate problem messages Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 4 / 29
  • 7. Background Git in the datacenter Problems with using Git? • Garbage Collection • Git records all operations permanently, so our database will grow permanently! • git rebase is needed to compact history. • Shell Control • Calling the git command-line is slow and lacks fine control. • Makes it hard to extend the Git protocol for additional features. • Programming Model • Git is designed for distributed source code manipulation. • Built-in merge functions designed around text files. • Let’s use it for distributed data structures instead! Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 5 / 29
  • 8. Background Irmin, a large-scale, immutable, branch-consistent storage Irmin, large-scale, immutable, branch-consistent storage • Irmin is a library to persist and synchronize distributed data structures both on-disk and in-memory • It enables a style of programming very similar to the Git workflow, where distributed nodes fork, fetch, merge and push data between each other • The general idea is that you want every active node to get a local (partial) copy of a global database and always be very explicit about how and when data is shared and migrated Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 6 / 29
  • 9. Background Irmin, a large-scale, immutable, branch-consistent storage Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 7 / 29
  • 10. Background Irmin, a large-scale, immutable, branch-consistent storage type t = ... (** User -defined contents. *) type result = [ ‘Ok of t | ‘Conflict of string ] val merge: old:t → t → t → result (** 3-way merge functions. *) old x y ? Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 8 / 29
  • 11. Background Irmin, a large-scale, immutable, branch-consistent storage Demo: Distributed Logging Multiple nodes all logging to a central store: 1 Design the logging data structure. • A log is a list of (string + timestamp) • When merging, the timestamps must be in increasing order • Equal timestamps can be in any order • With this logic, merge conflicts are impossible 2 Every node clones the log repository 3 A log is recorded locally, then pushed centrally. Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 9 / 29
  • 12. Weakly consistent data structures Weakly consistent data structures Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 10 / 29
  • 13. Weakly consistent data structures Mergeable queues Mergeable queues Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 11 / 29
  • 14. Weakly consistent data structures Mergeable queues module type IrminQueue.S = sig type t type elt val create : unit → t val length : t → int val is_empty : t → bool val push : t → elt → t val pop : t → (elt * t) val peek : t → (elt * t) val merge : IrminMerge.t end Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 12 / 29
  • 15. Weakly consistent data structures Mergeable queues I0 n01 n02 n03 n04 n05 n06 n07 I1 n11 n12 n13 n14 top bottom top bottom Index Node Elt pop list push list Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 13 / 29
  • 16. Weakly consistent data structures Mergeable queues I old A B C D I 1 A B C D E I 2 B C D F G I 1 B C D E I 2 F G I 1 B C D E I 2 F G Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 14 / 29
  • 17. Weakly consistent data structures Mergeable queues Current state Operation Read Write Push 0 2 O(1) Pop 2 on average 1 on average O(1) Merge n 1 O(n) Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 15 / 29
  • 18. Weakly consistent data structures Mergeable queues Current state Operation Read Write Push 0 2 O(1) Pop 2 on average 1 on average O(1) Merge n 1 O(n) With a little more work Operation Read Write Push 0 2 O(1) Pop 2 on average 1 on average O(1) Merge log n 1 O(log n) Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 15 / 29
  • 19. Weakly consistent data structures Mergeable ropes Mergeable ropes Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 16 / 29
  • 20. Weakly consistent data structures Mergeable ropes module type IrminRope.S = sig type t type value (* e.g char *) type cont (* e.g string *) val create : unit → t val make : cont → t ... val set : t → int → value → t val get : t → int → value val insert : t → int → cont → t val delete : t → int → int → t val append : t → t → t val split : t → int → (t * t) val merge : IrminMerge.t end Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 17 / 29
  • 21. Weakly consistent data structures Mergeable ropes Operation Rope String Set/Get O(log n) O(1) Split O(log n) O(1) Concatenate O(log n) O(n) Insert O(log n) O(n) Delete O(log n) O(n) Merge log (f (n)) f (n) Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 18 / 29
  • 22. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 23. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 24. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 5 2 2 lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 25. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 5 2 2 lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 26. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 5 2 2 2 lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 27. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 5 2 2 2 4 3lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 28. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 5 5 2 2 2 4 3lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 29. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 10 5 5 2 2 2 4 3lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 30. Weakly consistent data structures Mergeable ropes 10 5 2 2 2 1 lo rem ip sum do a met 10 5 5 2 2 2 1 lo rem ip sum do lor a met 10 5 2 2 2 4 3lo rem ip sum do sit a met 10 5 5 2 2 2 4 3lo rem ip sum do lor sit a met Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 19 / 29
  • 31. Benchmarking Irmin Benchmarking Irmin Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 20 / 29
  • 32. Benchmarking Irmin 0 100000 200000 300000 400000 500000 0 500 1000 1500 2000 2500 3000 3500 4000 4500 Timespentforwholeoperations(µs) Number of push/pop successively applied Core Obj Memory GitMem GitDsk Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 21 / 29
  • 33. Benchmarking Irmin module ObjBackend ... = struct type t = unit type key = K.t type value = V.t let create () = return () let clear () = return () let add t value = return (Obj.magic (Obj.repr value)) let read t key = return (Obj.obj (Obj.magic key)) let mem t key = return true ... end Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 22 / 29
  • 34. Benchmarking Irmin 0 100 200 300 400 500 0 500 1000 1500 2000 2500 3000 3500 4000 4500 Timespentforwholeoperations(µs) Number of push/pop successively applied Core Obj Memory GitMem GitDsk Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 23 / 29
  • 35. Use Cases Use Cases Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 24 / 29
  • 36. Use Cases Demo: Dog, a loyal synchronization tool Command line interface to logging clients at https://github.com/samoht/dog 1 dog listen to setup the server listener • Server maintains list of clients in a subtree • It regularly merges all clients in parallel to master branch 2 dog init starts up a client logger 3 dog push syncs the client with the server Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 25 / 29
  • 37. Use Cases Demo: CueKeeper, an Irmin TODO manager Do Git programming in the browser https://github.com/talex5/cuekeeper http://test.roscidus.com/CueKeeper/ 1 Irmin is written in OCaml, and compiles to efficient JavaScript • Git objects are mapped into IndexedDB • Uses LocalStorage to sync between tabs 2 DOM elements are computed from the Git store (a React-like model) 3 Client has full history, snapshotting and custom merge logic. Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 26 / 29
  • 38. Use Cases Demo: XenStore TNG The Xen hypervisor toolstack https://www.youtube.com/watch?v=DSzvFwIVm5s 1 Xen is a widely deployed hypervisor (Amazon EC2, Rackspace Cloud, ...) • Every VM boot needs a lot of communication • Tracing when something goes wrong is hard • Programming model is quite reactive 2 Dave Scott from Citrix ported the core toolstack to use Irmin, and made it faster! Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 27 / 29
  • 39. Use Cases Why OCaml? • Let us prototype complex functional datastructures very quickly • Efficient compilation to native code (x86, ARM, PowerPC, Sparc, ...), unikernels (MirageOS), JavaScript and Java • Execution model is strict and predictable, important for systems programming • Native code compilation is statically linked, or can be used as a normal shared library Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 28 / 29
  • 40. Use Cases Irmin Status (“Not Entirely Insane”) • Still pre 1.0, but several useful datastructures such as distributed queues and efficient ropes. • HTTP REST for remote clients, library via OCaml, or command-line interface. • Bidirectional operation, so git commits map to Irmin commits from any direction. • Open source at https://irmin.io, installable via the OPAM package manager at https://opam.ocaml.org • Feedback welcome at mirageos-devel@lists.xenproject.org or https://github.com/mirage/irmin/issues Anil Madhavapeddy (speaker) with Benjamin Farinier, Thomas Gazagnaire, Thomas LeonardUniversity of Cambridge CompuFunctional Distributed Programming with Irmin 29 / 29
  • 41. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/irmin