BloomUnit Declarative testing for distributed programs Peter Alvaro UC Berkeley.

Slides:



Advertisements
Similar presentations
Bounded Model Checking of Concurrent Data Types on Relaxed Memory Models: A Case Study Sebastian Burckhardt Rajeev Alur Milo M. K. Martin Department of.
Advertisements

Disorderly Distributed Programming with Bloom
Edelweiss: Automatic Storage Reclamation for Distributed Programming Neil Conway Peter Alvaro Emily Andrews Joseph M. Hellerstein University of California,
Translation-Based Compositional Reasoning for Software Systems Fei Xie and James C. Browne Robert P. Kurshan Cadence Design Systems.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Declarative sensor networks David Chu Computer Science Division EECS Department UC Berkeley DBLunch UC Berkeley 2 March 2007.
LIFE CYCLE MODELS FORMAL TRANSFORMATION
Software Engineering-II Sir zubair sajid. What’s the difference? Verification – Are you building the product right? – Software must conform to its specification.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Bookshelf.EXE - BX A dynamic version of Bookshelf –Automatic submission of algorithm implementations, data and benchmarks into database Distributed computing.
Train Control Language Teaching Computers Interlocking By: J. Endresen, E. Carlson, T. Moen1, K. J. Alme, Haugen, G. K. Olsen & A. Svendsen Synthesizing.
PTIDES: Programming Temporally Integrated Distributed Embedded Systems Yang Zhao, EECS, UC Berkeley Edward A. Lee, EECS, UC Berkeley Jie Liu, Microsoft.
CS 582 / CMPE 481 Distributed Systems Fault Tolerance.
Model Checking. Used in studying behaviors of reactive systems Typically involves three steps: Create a finite state model (FSM) of the system design.
Software Engineering, COMP201 Slide 1 Protocol Engineering Protocol Specification using CFSM model Lecture 30.
Models of Computation for Embedded System Design Alvise Bonivento.
©Ian Sommerville 2000Software Engineering, 6/e, Chapter 91 Formal Specification l Techniques for the unambiguous specification of software.
7th Biennial Ptolemy Miniconference Berkeley, CA February 13, 2007 PTIDES: A Programming Model for Time- Synchronized Distributed Real-time Systems Yang.
Designing Predictable and Robust Systems Tom Henzinger UC Berkeley and EPFL.
November 18, 2004 Embedded System Design Flow Arkadeb Ghosal Alessandro Pinto Daniele Gasperini Alberto Sangiovanni-Vincentelli
Real-Time System Requirements & Design Specs Shaw - Chapters 3 & 4 Homework #2: 3.3.1, 3.4.1, Add Error states to Fig 4.1 Lecture 4/17.
MCA –Software Engineering Kantipur City College. Topics include  Formal Methods Concept  Formal Specification Language Test plan creation Test-case.
Architectural Design.
Cheng/Dillon-Software Engineering: Formal Methods Model Checking.
Chapter 10 Architectural Design
Requirements Expression and Modelling
©Ian Sommerville 2000Software Engineering, 6th edition. Chapter 9 Slide 1 Formal Specification l Techniques for the unambiguous specification of software.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Disorderly programming for a distributed world Peter Alvaro UC Berkeley.
1 Managing Your Integrations an Operations Science Approach Steven Rdzak Infrastructure Services
Mathematical Modeling and Formal Specification Languages CIS 376 Bruce R. Maxim UM-Dearborn.
Scientific Computing By: Fatima Hallak To: Dr. Guy Tel-Zur.
Introduction to Formal Methods Based on Jeannette M. Wing. A Specifier's Introduction to Formal Methods. IEEE Computer, 23(9):8-24, September,
(Business) Process Centric Exchanges
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
Cloud Programming: From Doom and Gloom to BOOM and Bloom Peter Alvaro, Neil Conway Faculty Recs: Joseph M. Hellerstein, Rastislav Bodik Collaborators:
1 Introduction to Software Engineering Lecture 1.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
Fault-Tolerant Parallel and Distributed Computing for Software Engineering Undergraduates Ali Ebnenasir and Jean Mayo {aebnenas, Department.
Requirements Specification. Welcome to Software Engineering: “Requirements Specification” “Requirements Specification”  Verb?  Noun?  “Specification”
Loop Analysis and Repair Nafi Diallo Computer Science NJIT Advisor: Dr. Ali Mili.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Software Requirements: A More Rigorous Look 1. Features and Use Cases at a High Level of Abstraction  Helps to better understand the main characteristics.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
HACNet Simulation-based Validation of Security Protocols Vinay Venkataraghavan Advisors: S.Nair, P.-M. Seidel HACNet Lab Computer Science and Engineering.
Software Engineering1  Verification: The software should conform to its specification  Validation: The software should do what the user really requires.
Modelling Reactive Systems 4 Professor Muffy Calder Dept. of Computing Science University of Glasgow
Blazes: coordination analysis for distributed program Peter Alvaro, Neil Conway, Joseph M. Hellerstein David Maier UC Berkeley Portland State.
Prof. Hany H. Ammar, CSEE, WVU, and
G.v. Bochmann, revised Jan Comm Systems Arch 1 Different system architectures Object-oriented architecture (only objects, no particular structure)
Object-Oriented Parsing and Transformation Kenneth Baclawski Northeastern University Scott A. DeLoach Air Force Institute of Technology Mieczyslaw Kokar.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Formal Methods in Software Engineering1 Today’s Agenda  Mailing list  Syllabus  Introduction.
Capturing Requirements. Questions to Ask about Requirements 1)Are the requirements correct? 2)Consistent? 3)Unambiguous? 4)Complete? 5)Feasible? 6)Relevant?
Specifying Multithreaded Java semantics for Program Verification Abhik Roychoudhury National University of Singapore (Joint work with Tulika Mitra)
1 CEN 4020 Software Engineering PPT4: Requirement analysis.
Rely: Verifying Quantitative Reliability for Programs that Execute on Unreliable Hardware Michael Carbin, Sasa Misailovic, and Martin Rinard MIT CSAIL.
Application architectures Advisor : Dr. Moneer Al_Mekhlafi By : Ahmed AbdAllah Al_Homaidi.
Copyright 1999 G.v. Bochmann ELG 7186C ch.1 1 Course Notes ELG 7186C Formal Methods for the Development of Real-Time System Applications Gregor v. Bochmann.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
Consistency Analysis in Bloom: a CALM and Collected Approach Authors: Peter Alvaro, Neil Conway, Joseph M. Hellerstein, William R. Marczak Presented by:
Formal Specification.
An Overview of Requirements Engineering Tools and Methodologies*
Chapter 13 & 14 Software Testing Strategies and Techniques
CHAPTER 2 CREATING AN ARCHITECTURAL DESIGN.
Gabor Madl Ph.D. Candidate, UC Irvine Advisor: Nikil Dutt
Logical architecture refinement
Software testing.
Presentation transcript:

BloomUnit Declarative testing for distributed programs Peter Alvaro UC Berkeley

Team and Benefactors Peter Alvaro Andy Hutchinson Neil Conway Joseph M. Hellerstein William R. Marczak National Science Foundation Air Force Office of Scientific Research Gifts from Microsoft Research and NTT Communications

Distributed Systems and Software To verify or to test?

Verification Formally specify program and behavior – e.g., in Promela Systematically test inputs and schedules – e.g., using SPIN High investment, high returns

Testing Concrete inputs Concrete assertions over outputs / state No control over asynchrony, scheduling Pay-as-you-go investment, diminishing returns

Sweet Spot? Investment similar to unit tests Payoff closer to formal methods

Context Disorderly programming Computation as transformation Uniform representation of state: collections < ~ bloom

Hypothesis Database foundations can simplify distributed systems programming Successes to date: 1.Compact, declarative protocol implementations [Alvaro et al., NetDB `09, Alvaro et al., Eurosys `10] 2.Static analyses for distributed consistency [Alvaro et al., CIDR `10] 3.Software quality assurance? Yes.

The database view of testing 1.Declarative assertions – Correctness specs as queries 2.Constraint-guided input generation – Synthesize inputs from FDs and FKs 3.Exploration of execution nondeterminism – Apply LP-based analyses to reduce state space

Testing a protocol with BloomUnit

An abstract delivery protocol module DeliveryProtocol state do interface input, :pipe_in, [:dst, :src, :ident] => [:payload] interface output, :pipe_sent, pipe_in.schema interface output, :pipe_out, pipe_in.schema end

A delivery protocol sender receiver pipe_in pipe_sent pipe_out

A delivery protocol – Best effort sender receiver pipe_in pipe_sent pipe_out

A delivery protocol – Reliable sender receiver pipe_in pipe_sent pipe_out

A delivery protocol – FIFO sender receiver pipe_in pipe_sent pipe_out

Declarative Assertions – Specifications: queries over execution traces Timestamped log of flow at interfaces – Specifications encode invariants Queries capture incorrect behaviors

pipe_out_log Declarative Assertions module FIFOSpec bloom do fail <= (pipe_out_log * pipe_out_log).pairs do |p1, p2| if p1.src == p2.src and p1.dst == p2.dst and p1.ident = p2.time ["out-of-order delivery: #{p1.inspect} < #{p2.inspect}"] end create view fail as select 'out-of-order delivery: ' + p1 + ' < ' + p2 from pipe_out_log p1, pipe_out_log p2 where p1.src = p2.src and p1.dst = p2.dst and p1.ident = p2.time

Declarative Assertions module FIFOSpec bloom do fail <= (pipe_out_log * pipe_out_log).pairs do |p1, p2| if p1.src == p2.src and p1.dst == p2.dst and p1.ident = p2.time ["out-of-order delivery: #{p1.inspect} < #{p2.inspect}"] end ``delivery order (timestamps) never deviates from sender order (encoded into ident)’’ pipe_out_log

Input Generation

Idea: User supplies constraints (in FO logic) Search for models of the given formula – Let a SAT solver do the hard work Convert models into concrete inputs – Ensure that the models are interestingly different Implementation: Use the Alloy[Jackson ’06] language & solver

Input Generation Exclusion constraints What records cannot appear in an input instance all p1, p2 : pipe_in | (p1.src = p2.src and p1.ident = p2.ident) => p1.payload = p2.payload (ident functionally determines payload)

Input Generation Inclusion constraints: What records must appear in an input instance some p1, p2 : pipe_in | p1 != p2 => (p1.src = p2.src and p1.dst = p2.dst) (there are at least two messages between two endpoints)

Execution Exploration

All distributed executions are nondeterministic Each concrete input => set of executions Message timings / orderings may differ Too large a space to search exhaustively!

Execution Exploration A C B Message orderings: N! Loss scenarios: 2 N D σ π Messages: N

Execution Exploration CALM Theorem [Hellerstein ‘10, Ameloot ‘11] : Consistency as logical monotonicity – Monotonic logic (e.g. select, project, join) is order-insensitive – Monotonic => race-free

Execution Exploration: Monotonic program A C B D σ π Message orderings: 1

Execution Exploration: Hybrid program A C B D σ π Messages: K Message orderings: 1

Execution Exploration Only explore messages orderings when downstream logic is nonmonotonic Search only ``interesting’’ orderings

The system Module under test Inputs

Do you need to learn Bloom? Yes. – But you can take advantage of these techniques without adopting the language Requirements: – A high-level query language – Monotonicity analysis capabilities Prove (or assert) that program fragments are order-insensitive

Queries?

The fold

FIFO delivery in bloom module FifoPerSource state do scratch :enqueue_src, [:source, :ident] => [:payload] scratch :dequeue_src, [:source] => [:reqid] scratch :dequeue_resp_src, [:reqid] => [:source, :ident, :payload] table :storage_tab, [:source, :ident] => [:payload] scratch :tops, [:source] => [:ident] end bloom :logic do storage_tab <= enqueue_src tops <= storage_tab.group([:source], min(storage_tab.ident)) end bloom :actions do temp :deq tops.source, storage_tab.ident => tops.ident, tops.source => dequeue_src.source) dequeue_resp_src <+ deq do |s, t, d| [d.reqid, d.source, s.ident, s.payload] end storage_tab <- deq {|s, t, d| s } end module FifoProto state do interface input, :enqueue, [:source, :ident] => [:payload] interface input, :dequeue, [] => [:reqid] interface output, :dequeue_resp, [:reqid] => [:source, :ident, :payload] scratch :chosen_src, [:ident] end