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

Playing Games In The Clouds

Playing Games In The Clouds

What does haggling at a garage sale have to do with load balancing in distributed systems? How does bidding in an art auction relate to cloud service orchestration? Familiarity with the ideas and technologies involved in cloud computing is becoming ever more important for developers. This talk will demonstrate how you can use game theory — the study of strategic decision making — to design more efficient, and innovative, distributed systems.

A talk at RailsConf, GORUCO, and Brighton Ruby 2015.

Nadia Odunayo

April 22, 2015
Tweet

More Decks by Nadia Odunayo

Other Decks in Programming

Transcript

  1. –John von Neumann “Real life consists of bluffing, of little

    tactics of deception, of asking yourself what is the other man going to think I mean to do. And that is what games are about in my theory.”
  2. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  3. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  4. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  5. Gemma gets all of the sweets You get all of

    the sweets The bag of sweets is split in half between you and Gemma Gemma’s payoff Your payoff Payoff set 0,0 Nash bargaining solution point
  6. We can use Bargaining Theory to think about how resources

    should be allocated within a distributed system.
  7. HOW CAN WE MODEL THIS? 
 
 I can complete

    5 jobs every second! Oh! I can only complete 2. :-(
  8. HOW CAN WE MODEL THIS? 
 
 I got 4

    jobs!! WAT?! :-( Yay! Only 1 job to do!
  9. We want to distribute the jobs in such a way

    that optimally minimises overall execution time.
  10. Each computer has the following payoff (happiness) function: log(x -

    y) Computer’s job processing rate Rate of jobs arriving at computer THE PROBLEM
  11. The function we want to maximise is: THE PROBLEM yA+

    yB = 4 where log(5 - yA) + log(2 - yB) Computer A’s job processing rate Rate of jobs arriving at computer A Computer B’s job processing rate Rate of jobs arriving at computer B
  12. THE SOLUTION log(5 - yA) + log(2 - yB) Jobs

    to send to computer A Total happiness 3.5
  13. Computer B’s payoff Computer A’s payoff Payoff set 0,0 Nash

    Bargaining Solution point 3.5 jobs to computer A, 0.5 jobs to computer B Optimal response time = 1.33s yA = 3.8 jobs/sec yB = 0.2 jobs/sec Response time = 1.39s yA = 3.3 jobs/sec yB = 0.7 jobs/sec Response time = 1.36s THE SOLUTION
  14. A NASH BARGAINING SOLUTION Approaching load balancing with Game Theory

    leads us to Nash Bargaining solutions. We can use the results to develop algorithms that dynamically and efficiently distribute jobs.
  15. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  16. A strategy is dominant if that strategy gives the player

    their highest possible payoff regardless of what the other players do.
  17. It is the dominant strategy to bid truthfully in a

    second-price auction. $5 mark $25 lucy $10 Helen Payoff = true value - b2 $15 $0 $0
  18. It is the dominant strategy for agents to bid truthfully

    in a second- price auction. $5 mark $25 lucy $10 Helen $0 $-16 $0 $5 mark $25 lucy $26 Helen Payoff = true value - b2 $15 $0 $0 Payoff = true value - b2
  19. We can use Auction Theory to reveal the resource capabilities

    of machines within a distributed system.
  20. HOW CAN WE MODEL THIS? 
 
 I have lots

    of memory, but I’m not telling anyone! I can’t remember a thing! :-(
  21. HOW CAN WE MODEL THIS? 
 
 I’ve got like

    5GB of memory… I honestly have just 1GB…
  22. HOW CAN WE MODEL THIS? 
 
 Why have I

    got to run all of the jobs? Yay! No work to do!
  23. THE PROBLEM Let’s focus on the computer A’s payoff: 15GB

    If a bid is not submitted, the payoff is 0.
  24. THE PROBLEM Let’s focus on the computer A’s payoff: 15GB

    If bidA > bidB, the payoff to computer A is 15 − bidB.
  25. THE SOLUTION It is the dominant strategy for the computers

    to truthfully report their capabilities. 15GB bidA = 15
  26. THE SOLUTION 7 bidA = 15 bidB = 8 7

    bidA = 15 Payoff = 0 bidB = 17 15 bidA = 20 -2 bidB = 17 15 bidA = 20 bidB = 8 7 Payoff 15 − bidB.
  27. THE SOLUTION 7 bidA = 15 Payoff = 0 bidB

    = 17 15 bidA = 11 bidB = 17 Payoff = 0 bidA = 15 bidB = 8 7 15 bidA = 6 bidB = 8 Payoff = 0 Payoff 15 − bidB.
  28. OPTIMAL JOB PLACEMENT Auction frameworks enable us to develop algorithms

    that distribute jobs based on accurate representations of the resources available in a system.
  29. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  30. -0.7 jobs 2.3 jobs 5.3 jobs ALLOCATION ALGORITHM A
 8

    jobs/sec
 B
 5 jobs/sec
 C
 2 jobs/sec
 T = 7 jobs/sec Source: Grosu - Load Balancing In Distributed Systems: A Game Theoretic Approach
  31. 0 2 jobs 5 jobs ALLOCATION ALGORITHM A
 8 jobs/sec


    B
 5 jobs/sec
 C
 2 jobs/sec
 T = 7 jobs/sec Source: Grosu - Load Balancing In Distributed Systems: A Game Theoretic Approach
  32. I want three application instances. App placement in cloud foundry

    I have loads of room! I guess I can run one app. Don’t talk to me. No space here. Computers, give me your bids! Auctioneer Source: Gupta - App Placement In Cloud Foundry Diego
  33. VICKREY–CLARKE–GROVES Profit = Payment - Cost Paid by the auctioneer

    to each machine after a round of bidding The more work the computer has to do, the greater the cost Source: Grosu - Load Balancing In Distributed Systems: A Game Theoretic Approach
  34. –Nassim Nicholas Taleb “Antifragility is beyond resilience or robustness. The

    resilient resists shocks and stays the same; the antifragile gets better.”
  35. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  36. RESULTS When we know the capabilities of the machines in

    a distributed system, we can use the Nash Bargaining Solution to determine how we should allocate resources.
  37. RESULTS When we don’t know the capabilities of the machines

    in a distributed system, we can use second- price auctions to reveal what the capabilities are.
  38. LEVELLING UP Game Theory can help you break down complex

    problems. Start basic and build in more realistic assumptions.
  39. SOURCES LOAD BALANCING IN DISTRIBUTED SYSTEMS: A GAME THEORETIC APPROACH

    Daniel Grosu http://www.cs.utsa.edu/uploads/theses/DGrosu.pdf APP PLACEMENT IN CLOUD FOUNDRY DIEGO: A CLASSICAL OPTIMIZATION PROBLEM Amit Gupta http://blog.pivotal.io/cloud-foundry-pivotal/products/app-placement-in-cloud-foundry-diego-a-classical-optimization-problem NETWORKS, CROWDS, AND MARKETS: REASONING ABOUT A HIGHLY CONNECTED WORLD David Easly & Jon Kleinberg http://www.cs.cornell.edu/home/kleinber/networks-book/ AUCTIONS AND BIDDING: A GUIDE FOR COMPUTER SCIENTISTS Simon Parsons, Juan A. Rodriguez-Aguilar, and Mark Klein https://cgi.csc.liv.ac.uk/~sp/publications/journals/acs.pdf