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.

5bace0ba91ff3182c0e522ab4d67cd56?s=128

Nadia Odunayo

April 22, 2015
Tweet

Transcript

  1. PLAYING GAMES IN THE CLOUDS Nadia Odunayo @nodunayo

  2. None
  3. None
  4. What is the centre of an atom called? (5%) Nucleus

  5. Which tyre was it? (95%)

  6. –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.”
  7. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

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

    : Auction 4. ADAPTING the Rules 5. Game over
  9. Game Theory is the study of strategic interactions between rational

    agents.
  10. JOHN NASH 1928-2015

  11. WHAT IS A GAME? Split the money! Take the money

    and run!
  12. WHAT IS A GAME?

  13. Task distributor ? ? A
 B


  14. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  15. None
  16. How will surplus be split between agents? Bargaining Theory asks:

  17. 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
  18. What has Distributed Systems got to do with it? You

    ask:
  19. We can use Bargaining Theory to think about how resources

    should be allocated within a distributed system.
  20. HOW CAN WE MODEL THIS? 
 


  21. HOW CAN WE MODEL THIS? 
 
 I can complete

    5 jobs every second! Oh! I can only complete 2. :-(
  22. HOW CAN WE MODEL THIS? 
 
 I’ll take 1

    job! Me too!
  23. HOW CAN WE MODEL THIS? 
 
 I got 4

    jobs!! WAT?! :-( Yay! Only 1 job to do!
  24. THE PROBLEM T = 4 jobs/sec 5 jobs/sec
 A
 2

    jobs/sec
 B

  25. Task distributor ? ? 5 jobs/sec
 2 jobs/sec
 A
 B


    4 jobs/sec

  26. We want to distribute the jobs in such a way

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

    y) Computer’s job processing rate Rate of jobs arriving at computer THE PROBLEM
  28. THE PROBLEM Number of jobs per second Happiness

  29. 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
  30. THE SOLUTION log(5 - yA) + log(2 - yB) Jobs

    to send to computer A Total happiness 3.5
  31. Task distributor 3.5 jobs /sec 0.5 jobs/sec 2 jobs/sec
 5

    jobs/sec
 A
 B

  32. 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
  33. 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.
  34. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

    : Auction 4. ADAPTING the Rules 5. Game over
  35. None
  36. None
  37. £25 £5 £10 lucy wins and pays £10 lucy mark

    helen
  38. how should an agent bid? Auction Theory asks:

  39. A strategy is dominant if that strategy gives the player

    their highest possible payoff regardless of what the other players do.
  40. 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
  41. 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
  42. We can use Auction Theory to reveal the resource capabilities

    of machines within a distributed system.
  43. HOW CAN WE MODEL THIS? 
 


  44. HOW CAN WE MODEL THIS? 
 
 I have lots

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

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

    got to run all of the jobs? Yay! No work to do!
  47. THE PROBLEM bidA bidB 15GB A
 10GB B

  48. Task distributor A
 B
 Auctioneer Computers, give me your bids!

    bidA bidB
  49. THE PROBLEM Let’s focus on the computer A’s payoff: 15GB

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

    If bidA < bidB, the payoff is 0.
  51. THE PROBLEM Let’s focus on the computer A’s payoff: 15GB

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

    to truthfully report their capabilities. 15GB bidA = 15
  53. 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.
  54. 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.
  55. Task distributor A
 B
 Auctioneer Computers, give me your bids!

    15 10
  56. OPTIMAL JOB PLACEMENT Auction frameworks enable us to develop algorithms

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

    : Auction 4. ADAPTING the Rules 5. Game over
  58. None
  59. -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
  60. 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
  61. Source: Grosu - Load Balancing In Distributed Systems: A Game

    Theoretic Approach
  62. 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
  63. App placement in cloud foundry Bid components Constraints Source: Gupta

    - App Placement In Cloud Foundry Diego
  64. 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
  65. –Nassim Nicholas Taleb “Antifragility is beyond resilience or robustness. The

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

    : Auction 4. ADAPTING the Rules 5. Game over
  67. 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.
  68. 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.
  69. LEVELLING UP Game Theory can help you break down complex

    problems. Start basic and build in more realistic assumptions.
  70. A WARM UP

  71. OTHER GAMES Clustering Cloud security PaaS Landscape Non-cooperative Evolutionary Coalition

  72. 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
  73. THANK YOU! Nadia Odunayo www.nadiaodunayo.com @nodunayo WOULD YOU LIKE TO

    PLAY AGAIN?