Nadia Odunayo
April 22, 2015
780

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.

April 22, 2015

Transcript

4. –John von Neumann “Real life consists of blufﬁng, 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.”
5. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

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

: Auction 4. ADAPTING the Rules 5. Game over

agents.

and run!

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

: Auction 4. ADAPTING the Rules 5. Game over

14. 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

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

should be allocated within a distributed system.

18. HOW CAN WE MODEL THIS?     I can complete

5 jobs every second! Oh! I can only complete 2. :-(

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

jobs!! WAT?! :-( Yay! Only 1 job to do!

jobs/sec  B

4 jobs/sec
23. We want to distribute the jobs in such a way

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

y) Computer’s job processing rate Rate of jobs arriving at computer THE PROBLEM

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

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

jobs/sec  A  B
29. 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
30. 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 efﬁciently distribute jobs.
31. 1. Instructions 2. GAME ONE : Bargaining 3. GAME TWO

: Auction 4. ADAPTING the Rules 5. Game over

helen

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

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

of machines within a distributed system.

39. HOW CAN WE MODEL THIS?     I have lots

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

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

got to run all of the jobs? Yay! No work to do!

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

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

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

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

to truthfully report their capabilities. 15GB bidA = 15
48. 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.
49. 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.

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

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

: Auction 4. ADAPTING the Rules 5. Game over
53. -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
54. 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
55. Source: Grosu - Load Balancing In Distributed Systems: A Game

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

- App Placement In Cloud Foundry Diego
58. VICKREY–CLARKE–GROVES Proﬁt = 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
59. –Nassim Nicholas Taleb “Antifragility is beyond resilience or robustness. The

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

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

problems. Start basic and build in more realistic assumptions.

66. 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

PLAY AGAIN?