Key-value VST store James R. Wilcox, Doug Woos, Pavel - - PowerPoint PPT Presentation

key value vst store james r wilcox doug woos pavel
SMART_READER_LITE
LIVE PREVIEW

Key-value VST store James R. Wilcox, Doug Woos, Pavel - - PowerPoint PPT Presentation

Verdi: A Framework for Implementing and Formally Verifying Distributed Systems Key-value VST store James R. Wilcox, Doug Woos, Pavel Panchekha, Zach Tatlock, Xi Wang, Michael D. Ernst, Thomas Anderson Challenges Distributed systems


slide-1
SLIDE 1

Verdi: A Framework for Implementing and Formally Verifying Distributed Systems

James R. Wilcox, Doug Woos, Pavel Panchekha,

Zach Tatlock, Xi Wang, Michael D. Ernst, Thomas Anderson

VST

Key-value store

slide-2
SLIDE 2

Distributed systems run in unreliable environments Many types of failure can occur Fault-tolerance mechanisms are challenging to implement correctly

Challenges

slide-3
SLIDE 3

Distributed systems run in unreliable environments Many types of failure can occur Fault-tolerance mechanisms are challenging to implement correctly

Challenges

Formalize network as

  • perational semantics

Build semantics for a variety of fault models Verify fault-tolerance as transformation between semantics

Contributions

slide-4
SLIDE 4

Client Key-value store I/O

V S T

I/O Client

Consensus

KV

Consensus

KV

Consensus

KV

Verdi Workflow

Build, verify system in simple semantics Apply verified system transformer End-to-end correctness by composition

slide-5
SLIDE 5

Find environments in your problem domain Formalize these environments as operational semantics Verify layers as transformations between semantics

General Approach

Formalize network as

  • perational semantics

Build semantics for a variety of fault models Verify fault-tolerance as transformation between semantics

Contributions

slide-6
SLIDE 6

Verdi Successes

Applications Key-value store Lock service Fault-tolerance mechanisms Sequence numbering Retransmission Primary-backup replication Consensus-based replication linearizability

slide-7
SLIDE 7

Important data Replicated KV store Replicated KV store Replicated KV store

Replicated for availability

slide-8
SLIDE 8

Environment is unreliable

Crash Reorder Drop Duplicate Partition ...

Replicated KV store Replicated KV store Replicated KV store

slide-9
SLIDE 9

Implementations often have bugs Decades of research; still difficult to implement correctly

Crash Reorder Drop Duplicate Partition ...

Replicated KV store Replicated KV store Replicated KV store

slide-10
SLIDE 10

Bug-free Implementations

Several inspiring successes in formal verification CompCert, seL4, Jitk, Bedrock, IronClad, Frenetic, Quark Goal: formally verify distributed system implementations

slide-11
SLIDE 11

Formally Verify Distributed Implementations

Separate independent system components

slide-12
SLIDE 12

Separate independent system components

Fault tolerance

App

Verify application logic independently from fault-tolerance

application logic fault tolerance

Formally Verify Distributed Implementations

Fault tolerance

App

Fault tolerance

App

slide-13
SLIDE 13

Separate independent system components

Consensus KV Consensus KV Consensus KV

Verify application logic independently from consensus

key-value store consensus

Formally Verify Distributed Implementations

  • 1. Verify application logic
  • 2. Verify fault tolerance

mechanism

  • 3. Run the system!
slide-14
SLIDE 14

1. Verify Application Logic

Client Key-value store I/O

Simple model, prove “good map”

slide-15
SLIDE 15

Client Key-value store I/O

V S T

I/O Client

Consensus

KV

Consensus

KV

Consensus

KV

2. Verify Fault Tolerance Mechanism

Simple model, prove “good map” Apply verified system transformer, prove “properties preserved” End-to-end correctness by composition

slide-16
SLIDE 16

Consensus

KV

Consensus

KV

Consensus

KV

  • 3. Run the System!

Extract to OCaml, link unverified shim Run on real networks

slide-17
SLIDE 17

Verifying application logic

slide-18
SLIDE 18

Simple One-node Model

Key-value

State: {}

Set “k” “v" Resp “k” “v”

State: {“k”: “v”}

Trace: [Set “k” “v", Resp “k” “v”]

slide-19
SLIDE 19

Hinp(σ, i) = (σ0, o) (σ, T) s (σ0, T ++ hi, oi)

Input

Simple One-node Model

System State: σ Input: 풊 Output: o State: σ’ Trace: [풊, o]

slide-20
SLIDE 20

Simple One-node Model

Verify system against semantics by induction

Safety Property

Spec: operations have expected behavior (good map)

Set, Get Del, Get

slide-21
SLIDE 21

Verifying Fault Tolerance

slide-22
SLIDE 22 Consensus provides a 


replicated state machine

Same inputs on each node Calls into original system

Raft Raft Raft

The Raft Transformer

Log of operations Original system

slide-23
SLIDE 23 When input received: Add to log Send to other nodes When op replicated: Apply to state machine Send output

Raft Raft Raft

The Raft Transformer

slide-24
SLIDE 24 For KV store: Ops are Get, Set, Del State is dictionary

Raft Raft Raft

The Raft Transformer

slide-25
SLIDE 25 Correctly transforms systems Preserves traces Linearizability

Raft Raft Raft

Raft Correctness

V S T

slide-26
SLIDE 26 Model global state Model internal communication Model failure

Fault Model

slide-27
SLIDE 27 Machines have names Σ maps name to state

Fault Model: Global State

1 2 3 Σ[1] Σ[2] Σ[3]

slide-28
SLIDE 28

Fault Model: Messages

1 2 3 Σ[1] Σ[2] Σ[3]

Vote? Vote? <1,3,”Vote?”> <1,2,”Vote?”>

Network

Hnet(dst, Σ[dst], src, m)=(σ0, o, P 0) Σ0 =Σ[dst 7! σ0] ({(src, dst, m)} ] P, Σ, T) r (P ] P 0, Σ0, T ++ hoi)

Σ’[2] = σ’ Output: o

<2,1,”+1”>

slide-29
SLIDE 29 Message drop Message duplication Machine crash

Fault Model: Failures

1 2 3 Σ[1] Σ[2] Σ[3]

<1,3,”Vote?”> <1,2,”Vote?”>

Network

<1,3,”Vote?”>

slide-30
SLIDE 30

Fault Model: Drop

<1,2,”hi”> <1,3,”hi”>

({p} ] P, Σ, T) drop (P, Σ, T)

Drop Network

slide-31
SLIDE 31

Toward Verifying Raft

General theory of linearizability 1k lines of implementation, 5k lines for linearizability State machine safety: 30k lines Most state invariants proved, some left to do
slide-32
SLIDE 32

Verified System Transformers

Functions on systems Transform systems between semantics Maintain equivalent traces Get correctness of transformed system for free
slide-33
SLIDE 33

Verified System Transformers

App

Raft Consensus

App

Primary Backup Seq # and Retrans Ghost Variables

slide-34
SLIDE 34

Running Verdi Programs

slide-35
SLIDE 35 Coq extraction to Ocaml Thin, unverified shim Trusted compute base: shim, Coq, Ocaml, OS

Running Verdi Programs

slide-36
SLIDE 36

Performance Evaluation

Compare with etcd, a similar open-source store 10% performance overhead Mostly disk/network bound etcd has had linearizability bugs
slide-37
SLIDE 37

Previous Approaches

EventML [Schiper 2014] Verified Paxos using the NuPRL proof assistant MACE [Killian 2007] Model checking distributed systems in C++ TLA+ [Lamport 2002] Specification language and logic
slide-38
SLIDE 38

Formalize network as

  • perational semantics

Build semantics for a variety of fault models Verify fault-tolerance as transformation between semantics

Contributions

http://verdi.uwplse.org

Thanks!