Disorderly programming for a distributed world Peter Alvaro UC Berkeley.

Slides:



Advertisements
Similar presentations
Declarative Networking: Language, Execution and Optimization Boon Thau Loo 1, Tyson Condie 1, Minos Garofalakis 2, David E. Gay 2, Joseph M. Hellerstein.
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,
BloomUnit Declarative testing for distributed programs Peter Alvaro UC Berkeley.
Peer to Peer and Distributed Hash Tables
Case Study - Amazon. Amazon r Amazon has many Data Centers r Hundreds of services r Thousands of commodity machines r Millions of customers at peak times.
Logic and Lattices for Distributed Programming Neil Conway, William R. Marczak, Peter Alvaro, Joseph M. Hellerstein UC Berkeley David Maier Portland State.
Distributed Programming and Consistency: Principles and Practice Peter Alvaro Neil Conway Joseph M. Hellerstein UC Berkeley.
Distributed Databases John Ortiz. Lecture 24Distributed Databases2  Distributed Database (DDB) is a collection of interrelated databases interconnected.
Giovanni Chierico | May 2012 | Дубна Consistency in a distributed world.
Consistency analysis in bloom a CALM and collected approach peter alvaro, neil conway, joseph m. hellerstein, william r. marczak uc berkeley.
Virtual Synchrony Jared Cantwell. Review Multicast Causal and total ordering Consistent Cuts Synchronized clocks Impossibility of consensus Distributed.
CS 584. A Parallel Programming Model We need abstractions to make it simple. The programming model needs to fit our parallel machine model. Abstractions.
Concurrency CS 510: Programming Languages David Walker.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 9: Time, Coordination and Replication Dr. Michael R. Lyu Computer.
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Establishing the overall structure of a software system
Lecture 2 – MapReduce CPE 458 – Parallel Programming, Spring 2009 Except as otherwise noted, the content of this presentation is licensed under the Creative.
SS ZG653Second Semester, Topic Architectural Patterns Pipe and Filter.
Web-based Portal for Discovery, Retrieval and Visualization of Earth Science Datasets in Grid Environment Zhenping (Jane) Liu.
Amazon’s Dynamo System The material is taken from “Dynamo: Amazon’s Highly Available Key-value Store,” by G. DeCandia, D. Hastorun, M. Jampani, G. Kakulapati,
Maria-Cristina Marinescu Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology A Synthesis Algorithm for Modular Design of.
1 Developing Rules Driven Workflows in Windows Workflow Foundation Jurgen Willis COM318 Program Manager Microsoft Corporation.
Chapter 7: Architecture Design Omar Meqdadi SE 273 Lecture 7 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
Orbe: Scalable Causal Consistency Using Dependency Matrices & Physical Clocks Jiaqing Du, EPFL Sameh Elnikety, Microsoft Research Amitabha Roy, EPFL Willy.
Consistency And Replication
Architectural Design portions ©Ian Sommerville 1995 Establishing the overall structure of a software system.
HBase A column-centered database 1. Overview An Apache project Influenced by Google’s BigTable Built on Hadoop ▫A distributed file system ▫Supports Map-Reduce.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
Architecture styles Pipes and filters Object-oriented design Implicit invocation Layering Repositories.
Molecular Transactions G. Ramalingam Kapil Vaswani Rigorous Software Engineering, MSRI.
(Superficial!) Review of Uniprocessor Architecture Parallel Architectures and Related concepts CS 433 Laxmikant Kale University of Illinois at Urbana-Champaign.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Reliable Communication in the Presence of Failures Based on the paper by: Kenneth Birman and Thomas A. Joseph Cesar Talledo COEN 317 Fall 05.
Consistent and Efficient Database Replication based on Group Communication Bettina Kemme School of Computer Science McGill University, Montreal.
Cloud Programming: From Doom and Gloom to BOOM and Bloom Peter Alvaro, Neil Conway Faculty Recs: Joseph M. Hellerstein, Rastislav Bodik Collaborators:
Architectural Design Yonsei University 2 nd Semester, 2014 Sanghyun Park.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
The Vesta Parallel File System Peter F. Corbett Dror G. Feithlson.
Hadi Salimi Distributed Systems Lab, Computer Engineering School, Iran University of Schience and Technology, Tehran, Iran Winter 2011.
Disorderly programming. CALM analysis.. The future is already here Nearly all nontrivial systems are (or are becoming) distributed Programming distributed.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Views of Data Data – nouns of programming world the objects that are manipulated information that is processed Humans like to group information Classes,
Chapter 4 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University Building Dependable Distributed Systems.
Distributed Systems CS Consistency and Replication – Part IV Lecture 13, Oct 23, 2013 Mohammad Hammoud.
Blazes: coordination analysis for distributed program Peter Alvaro, Neil Conway, Joseph M. Hellerstein David Maier UC Berkeley Portland State.
Threaded Programming Lecture 1: Concepts. 2 Overview Shared memory systems Basic Concepts in Threaded Programming.
EEC 688/788 Secure and Dependable Computing Lecture 9 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
2000 Research Overview Dr. Kim Mens Programming Technology Lab Vrije Universiteit Brussel.
Consistency and Replication CSCI 6900/4900. FIFO Consistency Relaxes the constraints of the causal consistency “Writes done by a single process are seen.
uses of DB systems DB environment DB structure Codd’s rules current common RDBMs implementations.
Chapter 8 Fault Tolerance. Outline Introductions –Concepts –Failure models –Redundancy Process resilience –Groups and failure masking –Distributed agreement.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Data Grids, Digital Libraries and Persistent Archives: An Integrated Approach to Publishing, Sharing and Archiving Data. Written By: R. Moore, A. Rajasekar,
Bloom: Big Systems, Small Programs Neil Conway UC Berkeley.
Consistency Analysis in Bloom: a CALM and Collected Approach Authors: Peter Alvaro, Neil Conway, Joseph M. Hellerstein, William R. Marczak Presented by:
Introduction toData structures and Algorithms
Distributed Systems – Paxos
SOFTWARE DESIGN AND ARCHITECTURE
CS 440 Database Management Systems
Distributed Systems, Consensus and Replicated State Machines
Princess Nourah bint Abdulrahman University
Active replication for fault tolerance
EEC 688/788 Secure and Dependable Computing
Background and Motivation
EEC 688/788 Secure and Dependable Computing
EEC 688/788 Secure and Dependable Computing
Presentation transcript:

Disorderly programming for a distributed world Peter Alvaro UC Berkeley

Joint work Peter Alvaro Neil Conway Joseph M. Hellerstein William R. Marczak National Science Foundation Air Force Office of Scientific Research Gifts from IBM, Microsoft and Yahoo! Research Thanks to

The future is already here All systems are (or are becoming) distributed Programming distributed systems is hard Reasoning about them is harder

Outline 1.Disorderly Programming 2.The Bloom programming language 3.CALM Analysis and visualization 4.Challenge app: replicated shopping carts

Programming distributed systems

The state of the art Order is pervasive in the Von Neumann model Program state is an ordered array Program logic is a sequence of instructions

The state of the art Order is pervasive in the Von Neumann model Parallelism and concurrency via retrofits: Threads Event-driven programming

The state of the art In distributed systems, order is

The state of the art In distributed systems, order is expensive to enforce

The state of the art In distributed systems, order is expensive to enforce often unnecessary

The state of the art In distributed systems, order is expensive to enforce often unnecessary easy to get wrong

The art of the stateThe state of the art

The art of the state Disorderly programming

The art of the state Disorderly programming: Computation as transformation

The art of the state Disorderly programming: Program state is unordered collections Program logic is an unordered ``bag’’ of rules

The art of the state Disorderly programming: Independence and concurrency are assumed Ordering is explicit

The art of the state Disorderly programming

BUD: Bloom Under Development Ruby internal DSL Set comprehension style of programming Declarative semantics

Operational model

Bloom Rules do |mes, mem| [mem.address, mes.id, mes.payload] end multicast <~ (message * members)

Bloom Rules do |mes, mem| [mem.address, mes.id, mes.payload] end multicast<~(message * members)

Bud language features Module system – Encapsulation and composition via mixins – Abstract interfaces, concrete implementations Metaprogramming and reflection – The program is data Pay-as-you-code schemas – Default is key => value CALM Analysis

Writing distributed programs in Bloom

Abstract Interfaces and Declarations 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

Concrete Implementations module BestEffortDelivery include DeliveryProtocol state do channel :pipe_chan, pipe_in.schema end bloom :snd do pipe_chan <~ pipe_in end bloom :done do pipe_sent <= pipe_in pipe_out <= pipe_chan end Asynchrony

A simple key/value store module KVSProtocol state do interface input, :kvput, [:key] => [:reqid, :value] interface input, :kvdel, [:key] => [:reqid] interface input, :kvget, [:reqid] => [:key] interface output, :kvget_response, [:reqid] => [:key, :value] end

A simple key/value store module BasicKVS include KVSProtocol state do table :kvstate, [:key] => [:value] end bloom :mutate do kvstate <+ kvput {|s| [s.key, s.value]} kvstate :key) end bloom :get do temp :getj :key) kvget_response <= getj do |g, t| [g.reqid, t.key, t.value] end bloom :delete do kvstate :key) end Nonmonotonic operation

CALM Analysis

Asynchronous messaging You never really know

Asynchronous messaging AB C send AB C

Monotonic Logic The more you know, the more you know.

Monotonic Logic AB C E D A C E select/ filter

Monotonic Logic AB C project / map f(A)f(B) f(C)

Monotonic Logic A B C D E B D B D join / compose F

Monotonic Logic is order-insensitive AB C E D A C E

Monotonic Logic is pipelineable AB C E D A C E

Nonmonotonic Logic When do you know for sure?

Nonmonotonic Logic A B C D E B D set minus A B C D E Retraction! X Y Z

Nonmonotonic logic is order-sensitive A B C D E B D set minus A C E

Nonmonotonic logic is blocking A set minus A ? A?

Nonmonotonic logic is blocking A set minus A ? ``Sealed’’

CALM Analysis Asynchrony => loss of order Nonmonotonicity => order-sensitivity Asynchrony ; Nonmonotonicity => Inconsistency […]

CALM Analysis Asynchrony => loss of order Nonmonotonicity => order-sensitivity Asynchrony ; Nonmonotonicity => Inconsistency ? ``Point of Order’’ […]

Resolving points of order

1.Ask for permission

Resolving points of order 1.Ask for permission Coordination => strong consistency

Resolving points of order 1.Ask for permission 2.Ask for forgiveness

Resolving points of order 1.Ask for permission 2.Ask for forgiveness Compensation, weak consistency

Resolving points of order 1.Ask for permission 2.Ask for forgiveness 3.Ask differently? Rewrite to reduce consistency cost…

Shopping Carts

Replicated Shopping Carts Replicated for high availability and low latency Challenge: Ensure that replicas are ``eventually consistent’’

Replicated Shopping Carts module CartClientProtocol state do interface input, :client_action, [:server, :session, :reqid] => [:item, :action] interface input, :client_checkout, [:server, :session, :reqid] interface output, :client_response, [:client, :server, :session] => [:items] end

Replicated Shopping Carts module CartClientProtocol state do interface input, :client_action, [:server, :session, :reqid] => [:item, :action] interface input, :client_checkout, [:server, :session, :reqid] interface output, :client_response, [:client, :server, :session] => [:items] end

Carts done two ways 1.A “destructive” cart 2.A “disorderly” cart

``Destructive’’ Cart module DestructiveCart include CartProtocol include KVSProtocol bloom :on_action do kvget <= action_msg {|a| [a.reqid, a.session] } kvput :reqid) do |a,r| val = (r.value || {}) [a.client, a.session, a.reqid, val.merge({a.item => a.action}) do |k,old,new| old + new end] end bloom :on_checkout do kvget <= checkout_msg {|c| [c.reqid, c.session] } response_msg <~ (kvget_response * checkout_msg).pairs (:reqid => :reqid) do |r,c| [c.client, c.server, r.key, r.value.select {|k,v| v > 0}.to_a.sort] end

``Destructive’’ Cart module DestructiveCart include CartProtocol include KVSProtocol bloom :on_action do kvget <= action_msg {|a| [a.reqid, a.session] } kvput :reqid) do |a,r| val = (r.value || {}) [a.client, a.session, a.reqid, val.merge({a.item => a.action}) do |k,old,new| old + new end] end bloom :on_checkout do kvget <= checkout_msg {|c| [c.reqid, c.session] } response_msg <~ (kvget_response * checkout_msg).pairs (:reqid => :reqid) do |r,c| [c.client, c.server, r.key, r.value.select {|k,v| v > 0}.to_a.sort] end React to client updates React to client checkout

Destructive Cart Analysis

Collapsed SCC Asynchrony Nonmonotonicity Divergent results?

Destructive Cart Analysis Add coordination? E.g., Synchronous replication Paxos n = |client_action| m = |client_checkout| = 1 n rounds of coordination

``Disorderly Cart’’ module DisorderlyCart include CartProtocol state do table :action_log, [:session, :reqid] => [:item, :action] scratch :item_sum, [:session, :item] => [:num] scratch :session_final, [:session] => [:items, :counts] end bloom :on_action do action_log <= action_msg { |c| [c.session, c.reqid, c.item, c.action] } end bloom :on_checkout do temp :checkout_log :session) item_sum <= checkout_log.group([action_log.session, action_log.item], sum(action_log.action)) do |s| s if s.last > 0 end session_final <= item_sum.group([:session], accum(:item), accum(:num)) response_msg :session) do |c,m| [m.client, m.server, m.session, c.items.zip(c.counts).sort] end

``Disorderly Cart’’ module DisorderlyCart include CartProtocol state do table :action_log, [:session, :reqid] => [:item, :action] scratch :item_sum, [:session, :item] => [:num] scratch :session_final, [:session] => [:items, :counts] end bloom :on_action do action_log <= action_msg { |c| [c.session, c.reqid, c.item, c.action] } end bloom :on_checkout do temp :checkout_log :session) item_sum <= checkout_log.group([action_log.session, action_log.item], sum(action_log.action)) do |s| s if s.last > 0 end session_final <= item_sum.group([:session], accum(:item), accum(:num)) response_msg :session) do |c,m| [m.client, m.server, m.session, c.items.zip(c.counts).sort] end Actions Checkout

Disorderly Cart Analysis Asynchrony Nonmontonicity Divergent Results?

Disorderly Cart Analysis n = |client_action| m = |client_checkout| = 1 1 round of coordination

Replicated Disorderly Cart Asynchronous (uncoordinated) replication Still just 1 round of coordination

Teaching

Summary Why disorderly? – Order is a scarce (and distracting!) resource When is order really needed? – To resolve nonmonotonicity What is coordination for? – Re-establishing order, to guarantee consistency. CALM – A disorderly programming language – Tools to identify points of order

More Resources: Writeups: Consistency Analysis in Bloom: A CALM and Collected Approach (CIDR’11) Dedalus: Datalog in Time and Space (Datalog2.0) The Declarative Imperative (PODS’10 Keynote address) Model-theoretic Correctness Criteria for Distributed Systems (in submission)

Queries?

Languages regarding languages Other Languages Bloom Other Languages