SlideShare a Scribd company logo
You are not alone
Scaling Multiplayer Games
Jesper Richter-Reichhelm - @jrirei
Knut Nesheim - @knutin
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
> 1,000,000 daily users
> 1,000,000 daily users
> 50,000 concurrent users
> 1,000,000 daily users
> 50,000 concurrent users
> 10,000 requests / second
Ok, you can
handle that.
Ok, you can
handle that.

But why only
single player?
The Games
   The Past
 The Present
  The Future
The Foundation
Server   Database
Server   Database
Server   Database
Server   Database
Server   Database
Server   Database
DB is the bottleneck
You are not alone - Scaling multiplayer games
Server   Database
Server   Database
Server   Database
Server                        Database




         One  Game  Session
Server                        Database




         One  Game  Session
session
session
    session
  session
session
Server


      session
    session
  session
session
Server


      session
    session
  session
session
Server


      session
    session
  session
session
Server


      session
    session
  session
session
Server          Server          Server


      session
    session           session
                    session           session
                                    session
  session
session           session
                session           session
                                session
The Games
   The Past
 The Present
  The Future
The Foundation
es
      Thoughts
 t
       Client
ent
       Server
 re
      Operation
ation
es
      Thoughts
 t
       Client
ent
       Server
 re
      Operation
ation
You are not alone - Scaling multiplayer games
You are not alone
Pessimistic
Pessimistic
Schizophrenic
Pessimistic
Schizophrenic
 Optimistic
Pessimistic
Client   Server
   A       A




Client   Server
   B       B
Client    Server
A  @  B     A




Client    Server
   B        B
Client    Server
A  @  B     A




Client    Server
   B        B
Client    Server
A  @  B     A




Client    Server
   B        B
Client    Server
A  @  B     A




Client    Server
   B        B’
Client    Server
A  @  B     A




Client    Server
   B        B’
Client    Server
A  @  B     A




Client    Server
   B        B’
Client     Server
A  @  B’     A




Client     Server
   B         B’
Client     Server
A  @  B’     A




Client     Server
   B         B’
Client     Server
A  @  B’     A




Client     Server
  B’         B’
Waiting on server
  responses?
Waiting on server
  responses?

   Are you out
  of your mind?
Schizophrenic
Client   Server
   A       A




Client   Server
   B       B
Client    Server
A  @  B     A




Client    Server
   B        B
Client    Server
A  @  B    A  +  B




Client    Server
   B        B
Client     Server
A  @  B’    A  +  B




Client     Server
   B         B
Client     Server
A  @  B’    A  +  B




Client     Server
   B         B
Client     Server
A  @  B’   A  +  B’




Client     Server
   B         B
Client     Server
A  @  B’   A  +  B’




Client     Server
   B         B
Client     Server
A  @  B’   A  +  B’




Client     Server
   B         B
Client     Server
A  @  B’   A  +  B’




Client     Server
  B’         B
Client     Server
A  @  B’   A  +  B’




Client     Server
  B’         B
Client     Server
A  @  B’   A  +  B’




Client     Server
  B’         B’
What about real
 interactions?
What about real
 interactions?

And what about
   complexity
in the backend?
Optimistic
Client   Server
   A       A




Client   Server
   B       B
Client    Server
A  @  B     A




Client    Server
   B        B
Client     Server
A  @  B’     A




Client     Server
   B         B
Client     Server
A  @  B’     A




Client     Server
   B         B
Client     Server
A  @  B’     A




Client     Server
   B         B
Client     Server
A  @  B’     A




Client     Server
   B         B’
Client     Server
A  @  B’     A




Client     Server
   B         B’
Client     Server
A  @  B’     A




Client     Server
   B         B’
Client     Server
A  @  B’     A




Client     Server
  B’’        B’
Client     Server
A  @  B’     A




Client     Server
  B’’        B’
Client     Server
A  @  B’     A




Client     Server
  B’’        B’
Client     Server
A  @  B’     A




Client     Server
  B’         B’
Hmm, client
 rollbacks?
Hmm, client
   rollbacks?

Are you sure you
 can build that?
es
 t
ent
 re
ation
es
      Thoughts
 t
       Client
ent
       Server
 re
      Operation
ation
Client   Server
   A       A




Client   Server
   B       B
You are not alone - Scaling multiplayer games
You are not alone - Scaling multiplayer games
Client  A
state
count  0
 max  3




           Client  A
user  A
               move
                   

                    
 state
count  0
 max  3




           Client  A
user  A
               move
               pick

                    
 state
count  0
 max  3




           Client  A
user  A
               move
               pick

                    
 state
count  1
 max  3




           Client  A
user  A
               move
               pick

                    
 state
count  1
 max  3




           Client  A     Server
user  A
               user  A
               move
               pick

                    
 state
count  1
 max  3




           Client  A     Server
user  A
               user  A
               move
               pick
                          loca,on
                    
 state                    count  0
count  1
 max  3




           Client  A     Server
user  A
               user  A
               move
               pick
                          loca,on
                    
 state                    count  1
count  1
 max  3




           Client  A     Server
user  A
               user  A
               move
               pick
                          loca,on
                    
 state                    count  1
count  1
 max  3




           Client  A     Server
user  A
               user  A
               move
               pick
                                    loca,on
                    
 state                              count  1
count  1
 max  3
                         history
                         move  A
                         pick  A

                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  1
count  1
 max  3
                         history
                         move  A
                         pick  A
                              
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  1
count  1
 max  3
                         history
                         move  A
                         pick  A
                              
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  1
count  1
 max  3
                                    user  B
                         history
                         move  A
                         pick  A
                              
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  1
count  1
 max  3
                                    user  B
                         history
                         move  A
                         pick  A
                                    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  1
 max  3
                                    user  B
                         history
                         move  A
                         pick  A
                                    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  1
 max  3
                                    user  B
                         history
                         move  A
                         pick  A
                                    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  1
 max  3
                                    user  B
                         history
                         move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  1
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  2
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  2
count  2
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  2
count  2
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  2
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  2
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  2
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  3
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  3
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                 loca,on
                   
 state                              count  3
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                              


           Client  A               Server
user  A
               user  A
               move
               pick
               pick                   loca,on
                   
 state                                count  3
count  3
 max  3
                                      user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B      loca,on
                         pick  B  


           Client  A                 Server
user  A
               user  A
               move
               pick
               pick                   loca,on
                   
 state                                count  3
count  3
 max  3
                                      user  B
               user  B   history
                pick     move  A
                pick     pick  A
                         pick  B      loca,on
                         pick  B  


           Client  A                 Server
user  A
               user  A
               move
               pick
               pick                   loca,on
                   
 state                                count  3
count  3
 max  3
                                      user  B
               user  B   history
                pick     move  A
                pick     pick  A
                         pick  B      loca,on
                         pick  B  


           Client  A                 Server
user  A
               user  A
               move
               pick
               pick                   loca,on
                   
 state                                count  3
count  3
 max  3
                                      user  B
               user  B   history
                pick     move  A
                pick     pick  A
                         pick  B      loca,on
                         pick  B  


           Client  A                 Server
user  A
               user  A
               move
               pick
               pick                   loca,on
                   
 state                                count  3
count  3
 max  3
                                      user  B
               user  B   history
                pick     move  A
                pick     pick  A
                         pick  B      loca,on
                         pick  B  


           Client  A                 Server
user  A
               user  A
                    
                    
                                    loca,on
                    
 state                              count  3
count  0
 max  3
                                    user  B
               user  B   history
                         move  A
                         pick  A
                         pick  B    loca,on
                         pick  B


           Client  A               Server
user  A
               user  A
               move
                   
                                    loca,on
                   
 state                              count  3
count  0
 max  3
                                    user  B
               user  B   history
                         move  A
                         pick  A
                         pick  B    loca,on
                         pick  B


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  3
count  1
 max  3
                                    user  B
               user  B   history
                         move  A
                         pick  A
                         pick  B    loca,on
                         pick  B


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  3
count  2
 max  3
                                    user  B
               user  B   history
                pick     move  A
                         pick  A
                         pick  B    loca,on
                         pick  B


           Client  A               Server
user  A
               user  A
               move
               pick
                                    loca,on
                   
 state                              count  3
count  3
 max  3
                                    user  B
               user  B   history
                pick     move  A
                pick     pick  A
                         pick  B    loca,on
                         pick  B


           Client  A               Server
...

(Let’s look
  inside)
es
 t
ent
 re
ation
es
      Thoughts
 t
       Client
ent
       Server
 re
      Operation
ation
Erlang
Erlang
Process isolation
Erlang
Process isolation
  Networking
Erlang
Process isolation
  Networking
  Distribution
User process
User process
Stores user state
User process
   Stores user state
Real-time push to client
World process
World process
Serializes updates
World process
  Serializes updates
Concurrency “control”
World process
  Serializes updates
Concurrency “control”
   Runs game logic
Game logic
Game logic
   Pure
Game logic
              Pure
f(State, Cmd) -> {NewState, Reply}
Game logic
              Pure
f(State, Cmd) -> {NewState, Reply}

         Transactions
Real-time push
Real-time push
Browser support
Real-time push
   Browser support
“Transfer-Encoding: chunked”
Real-time push
   Browser support
“Transfer-Encoding: chunked”

State updates as JSON
es
 t
ent
 re
ation
es
      Thoughts
 t
       Client
ent
       Server
 re
      Operation
ation
Elli
Elli
Efficient, robust
Elli
      Efficient, robust
High-throughput, low latency
Elli
      Efficient, robust
High-throughput, low latency
 Request-response model
Elli
      Efficient, robust
High-throughput, low latency
 Request-response model
   github.com/knutin/elli
Distribution
Distribution
Idea: Identical nodes, Riak
Distribution
  Idea: Identical nodes, Riak
No centralization/serialization
Distribution
  Idea: Identical nodes, Riak
No centralization/serialization
          No SPOF
Distribution needs
Distribution needs
      Locking
Distribution needs
      Locking
  Dynamic cluster
Meet “locker”
Meet “locker”
Distributed lock table
Meet “locker”
Distributed lock table
        CAS
Meet “locker”
Distributed lock table
        CAS
Write quorum, 2PC
Meet “locker”
 Distributed lock table
         CAS
  Write quorum, 2PC
Asynchronous replication
Meet “locker”
  Distributed lock table
          CAS
   Write quorum, 2PC
Asynchronous replication
330 SLOC, one gen_server
The Games
   The Past
 The Present
  The Future
The Foundation
Research
Research
Aka “hacking”
Everything is possible
Everything is possible
      First person
Everything is possible
      First person
   Real-time strategy
Everything is possible
      First person
   Real-time strategy
      Turn-based
Everything is possible
      First person
   Real-time strategy
      Turn-based
          Etc
Nothing is possible
Nothing is possible
Network latency kills
    gameplay
Lag compensation
Lag compensation
  Many solutions
Lag compensation
  Many solutions
 Depends on game
FPS
FPS
Speed is king
FPS
    Speed is king
Divergent simulations
FPS
    Speed is king
Divergent simulations
Server keeps history
FPS
       Speed is king
   Divergent simulations
   Server keeps history
Validates delayed commands
RTS
RTS
Synchronization is king
RTS
Synchronization is king
 Identical simulations
RTS
 Synchronization is king
  Identical simulations
Server buffers commands
RTS
 Synchronization is king
  Identical simulations
Server buffers commands
  Broadcasts, lockstep
The Games
   The Past
 The Present
  The Future
The Foundation
Small independent teams
Each team adds something
Based on previous learnings
Standing on the
shoulders of giants
Slides: http://woo.ga/backend
Slides: http://woo.ga/backend
Code: http://github.com/wooga
Questions?
Questions?
 @jrirei @knutin
http://wooga.com/jobs

More Related Content

KEY
Zipkin - Runtime open house
KEY
Zipkin - Strangeloop
PDF
More than syntax
PDF
Stateful_Application_Server_RuPy 2012_Brno
PDF
NoSQL Games
PDF
Wooga: Internationality meets Agility @Zutaten 2013
PDF
WebConf_Riga_Confessions of-a-traitor_Krzsysztof Szafranek
PDF
2013 01-03 sgf-mobile_first_sebastian kriese
Zipkin - Runtime open house
Zipkin - Strangeloop
More than syntax
Stateful_Application_Server_RuPy 2012_Brno
NoSQL Games
Wooga: Internationality meets Agility @Zutaten 2013
WebConf_Riga_Confessions of-a-traitor_Krzsysztof Szafranek
2013 01-03 sgf-mobile_first_sebastian kriese

Viewers also liked (20)

PDF
How to manage a startup_Gruenderwoche RWTH Aachen_Jan Miczaika
PDF
JRubyConf2013_Tim Lossen_All your core
PDF
Erlang as a Cloud Citizen
PDF
Getting the Most our of your Tools_FrontEnd DevConf2013_Minsk
PDF
Designing for Scale
PDF
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
PDF
When Devs Do Ops
PDF
NoSQL Games_NoSQL Roadshow Berlin
PDF
Stateful Application Server_JRubyConf13_Lukas Rieder
PDF
Stealing Your Heart, Eating your Brain_Casual Connect-Hamburg_2013
PDF
Games for the Masses: Scaling Rails to the Extreme
PDF
Metrics. Driven. Design. (Developer Conference Hamburg 2012)
PDF
How to scale a company - game teams at Wooga
PDF
Event Stream Processing with Kafka (Berlin Buzzwords 2012)
PDF
2013 04-29-evolution of backend
PDF
From Keyboards to Fingertips_Casual Connect HH_2013_Jens Begemann
PDF
Continuous Integration for iOS (iOS User Group Berlin)
PDF
Painful success - lessons learned while scaling up
PDF
Monitoring with Syslog and EventMachine
PDF
"Common Sense" instead of "Command and Control"_Start up Camp 2013
How to manage a startup_Gruenderwoche RWTH Aachen_Jan Miczaika
JRubyConf2013_Tim Lossen_All your core
Erlang as a Cloud Citizen
Getting the Most our of your Tools_FrontEnd DevConf2013_Minsk
Designing for Scale
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
When Devs Do Ops
NoSQL Games_NoSQL Roadshow Berlin
Stateful Application Server_JRubyConf13_Lukas Rieder
Stealing Your Heart, Eating your Brain_Casual Connect-Hamburg_2013
Games for the Masses: Scaling Rails to the Extreme
Metrics. Driven. Design. (Developer Conference Hamburg 2012)
How to scale a company - game teams at Wooga
Event Stream Processing with Kafka (Berlin Buzzwords 2012)
2013 04-29-evolution of backend
From Keyboards to Fingertips_Casual Connect HH_2013_Jens Begemann
Continuous Integration for iOS (iOS User Group Berlin)
Painful success - lessons learned while scaling up
Monitoring with Syslog and EventMachine
"Common Sense" instead of "Command and Control"_Start up Camp 2013
Ad

More from Wooga (20)

PPTX
Story of Warlords: Bringing a turn-based strategy game to mobile
PDF
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
PDF
In it for the long haul - How Wooga boosts long-term retention
PDF
Leveling up in localization! - Susan Alma & Dario Quondamstefano
PDF
Evoloution of Ideas
PDF
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
PDF
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
PDF
Innovation dank DevOps (DevOpsCon Berlin 2015)
PDF
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
PDF
Review mining aps2014 berlin
PDF
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
PDF
Staying in the Game: Game localization practices for the mobile market
PDF
Startup Weekend_Makers and Games_Philipp Stelzer
PDF
DevOps goes Mobile (daho.am)
PDF
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
PDF
CodeFest 2014_Mobile Game Development
PDF
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
PDF
How to hire the best people for your startup-Gitta Blat-Head of People
PDF
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
PDF
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Story of Warlords: Bringing a turn-based strategy game to mobile
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
In it for the long haul - How Wooga boosts long-term retention
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Evoloution of Ideas
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Innovation dank DevOps (DevOpsCon Berlin 2015)
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Review mining aps2014 berlin
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Staying in the Game: Game localization practices for the mobile market
Startup Weekend_Makers and Games_Philipp Stelzer
DevOps goes Mobile (daho.am)
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
CodeFest 2014_Mobile Game Development
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
How to hire the best people for your startup-Gitta Blat-Head of People
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Ad

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Big Data Technologies - Introduction.pptx
PDF
KodekX | Application Modernization Development
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
sap open course for s4hana steps from ECC to s4
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
NewMind AI Weekly Chronicles - August'25 Week I
Big Data Technologies - Introduction.pptx
KodekX | Application Modernization Development
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
Spectral efficient network and resource selection model in 5G networks
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
sap open course for s4hana steps from ECC to s4

You are not alone - Scaling multiplayer games