SlideShare a Scribd company logo
1 of 41
Download to read offline
AT	
  SCALE	
  WITH	
  STYLE
                      Erlang	
  <3	
  <3	
  <3	
  Ruby




Mar$n	
  Rehfeld,	
  @klickmich
At	
  Scale	
  With	
  Style

 How	
  we	
  roll

 Server	
  architectures

 How	
  to	
  innovate

 Mind	
  the	
  limits
Typical	
  game	
  architecture

         Client         HTTP      Backend
                         API
Typical	
  game	
  architecture

                                  Backend




     State	
  Changes
       ValidaHon
      Persistence
The	
  scale	
  is	
  interesHng


              14	
  billion	
  requests	
  /	
  month



          >100,000	
  DB	
  operaHons	
  /	
  second



             >50,000	
  DB	
  updates	
  /	
  second
Wooga’s	
  approach	
  to	
  development

Small	
  independent	
  teams	
  for	
  each	
  game

Team	
  gets	
  to	
  choose	
  tools	
  and	
  technologies
  Same	
  team	
  also	
  does	
  ops	
  a,er	
  going	
  live

Culture	
  of	
  sharing
  Look	
  around	
  what	
  is	
  there,	
  pick/adapt	
  exis;ng	
  
   solu;ons,	
  but	
  take	
  ownership	
  for	
  what	
  you	
  
   include
ExisHng	
  backends	
  –	
  Technology	
  landscape
At	
  Scale	
  With	
  Style

 How	
  we	
  roll

 Server	
  architectures

 How	
  to	
  innovate

 Mind	
  the	
  limits
Most	
  games	
  use	
  stateless	
  applicaHon	
  servers

         Server                          Database
And	
  then	
  there’s	
  sharding

                                  lb




        app   app   app   app     app    app    app   app   app




                          My            My
                          SQL           SQL


                          slave         slave
More	
  app	
  servers,	
  more	
  sharding

                                              lb




            app         app     app   app     app   app     app      app         app


            app     app         app   app     app   app     app      app         app




    My            My          My      My            My       My            My          My
    SQL           SQL         SQL     SQL           SQL      SQL           SQL         SQL


    slave     slave           slave   slave         slave    slave     slave           slave
Wait,	
  seriously?!

                                               lb         lb


app     app      app     app     app   app          app        app     app      app   app     app   app


app     app      app     app     app   app          app        app     app      app   app     app   app


app     app      app     app     app   app          app        app     app      app   app     app   app


My       My            My      My      My
                                                               redis    redis     redis     redis   redis
SQL      SQL           SQL     SQL     SQL


slave    slave     slave       slave   slave                   slave    slave     slave     slave   slave
Find	
  the	
  flaw

 “Stateless	
  applicaHon	
  servers	
  
      guarantee	
  one	
  thing:
       The	
  data	
  is	
  never
      where	
  you	
  need	
  it!”
          Paolo	
  Negri,	
  Developer	
  @	
  Wooga
Strong	
  session	
  pa`ern


   User	
  starts	
  playing

     many	
  transformaHons
     of	
  the	
  same	
  set	
  of	
  data


   User	
  stops	
  playing
Stateful	
  servers	
  and	
  DBs

          Server                              Database




                     One	
  Game	
  Session
Stateful	
  game	
  server

One	
  process	
  per	
  acHve	
  user	
  gaming	
  session

    ...	
  holds	
  the	
  current	
  state	
  and	
  is	
  the	
  only	
  one	
  that	
  can	
  
         modify	
  it	
  (strong	
  encapsulaHon)

    ...	
  handles	
  all	
  API	
  calls	
  for	
  the	
  given	
  user	
  one	
  a,er	
  the	
  other	
  
         (concurrency	
  control	
  through	
  actor	
  model)

    ...	
  loads	
  the	
  game	
  state	
  from	
  storage	
  and	
  writes	
  it	
  back	
  
         periodically	
  and	
  on	
  process	
  termina;on
         (;meout	
  =	
  user	
  stopped	
  playing)
The	
  DB	
  is	
  no	
  longer	
  the	
  bo`leneck


                     Stateless                     Stateful

  30.000
  22.500
  15.000
                                                   700
   7.500
        0
                      DB	
  operations	
  /	
  second
Magic	
  Land	
  uses	
  Erlang

Details:
Awesome	
  presentaHon	
  on
the	
  Magic	
  Land	
  game	
  server
by	
  @knuHn	
  &	
  @hungryblank


h`p://www.slideshare.net/wooga/from-­‐0-­‐to-­‐1000000-­‐daily-­‐users-­‐with-­‐erlang
At	
  Scale	
  With	
  Style

 How	
  we	
  roll

 Server	
  architectures

 How	
  to	
  innovate

 Mind	
  the	
  limits
Erlang	
  &	
  Ruby

Erlang	
  is	
  great
   Concurrent,	
  robust
   Great	
  for	
  opera;on

Ruby	
  is	
  great
  Concise,	
  expressive,	
  flexible
  Great	
  for	
  development
Bringing	
  two	
  worlds	
  together




                 Server                 Worker

       session
                          sender        Worker

       session
                                        Worker

         ...
                                        Worker
                          receiver
       session
                                        Worker
Do	
  you	
  know	
  Mongrel2?

                          Web	
  Server	
  that	
  hooks
                          up	
  applicaHons	
  via


➡ We	
  chose	
  the	
  same	
  queue	
  setup	
  &	
  
  message	
  format
                                            Server              Worker

                                  session

                                                     sender
                                                                Worker

                                  session
                                                                Worker

                                    ...
                                                                Worker
                                                     receiver


                                  session
                                                                Worker
ConnecHng	
  the	
  dots

Mongrel2	
  h`p://mongrel2.org/	
  protocol	
  &	
  ZeroMQ	
  setup
Erlang:	
  h`ps://github.com/hungryblank/emongrel2
Ruby
    rack-­‐mongrel2	
  fork	
  hKps://github.com/khiltd/khi-­‐rack-­‐mongrel2
    rack	
  protocol	
  hKp://rack.rubyforge.org
    Sinatra	
  hKp://www.sinatrarb.com/


➡      essenHally	
  we	
  are	
  speaking	
  HTTP	
  over	
  ZeroMQ
       and	
  can	
  hook	
  up	
  any	
  Rack-­‐based	
  Ruby	
  web	
  
       framework
Example	
  controller	
  in	
  Ruby
  app.game_action '/:actor/fruit_tree/self/shake',
                  :observable => true,
                  :affects => [:fruit_trees, :user],
                  :params => [:x, :y] do

    x, y = params[:x], params[:y]
    fruit_trees[x, y].shake

 end




DSL-­‐like	
  definiHon	
  of	
  game	
  acHon
Skinny	
  as	
  controllers	
  should	
  be
Example	
  model	
  in	
  Ruby
  class FruitTree < Tree

    property :last_shake_time,         :type => Integer, :default => 0
    property :collectable_fruit_count, :type => Integer, :default => 0

    def shake
      raise G8::Error::Validation, "no fruit!" unless carries_fruit?

      session.user.xp += 1
      session.user.energy -= 1
      self.last_shake_time = game_time
      self.collectable_fruit_count = config.fruit_count
    end

  end


Easily	
  unit	
  testable
Minimal	
  amount	
  of	
  code
Game	
  state

Game	
  state	
  is	
  split	
  in	
  mulHple	
  parts
  user,	
  map,	
  fruit_trees	
  etc.

Erlang	
  does	
  not	
  care	
  about	
  content
   Serialized	
  Ruby	
  objects

Erlang	
  does	
  know	
  mapping	
  of	
  state	
  parts	
  to	
  URLs
Looking	
  back	
  at	
  the	
  game	
  acHon
app.game_action '/:actor/fruit_tree/self/shake',
                :observable => true,
                :affects => [:fruit_trees, :user],
                :params => [:x, :y] do

  x, y = params[:x], params[:y]
  fruit_trees[x, y].shake
end



Mapping	
  of	
  state	
  parts	
  to	
  game	
  acHons
  Worker	
  knows	
  mapping
  Worker	
  pushes	
  mapping	
  to	
  Erlang	
  on	
  startup
  Erlang	
  can	
  query	
  mapping	
  if	
  needed
NICE!
        http://www.flickr.com/photos/aigle_dore/
At	
  Scale	
  With	
  Style

 How	
  we	
  roll

 Server	
  architectures

 How	
  to	
  innovate

 Mind	
  the	
  limits
Performance	
  impact	
  for	
  large	
  payloads
                                200	
  kB	
  payload
                     6000

                     5000
Requests	
  /	
  s




                     4000
                                                            Pure
                     3000                                  Erlang
                     2000
                                                            Ruby
                     1000                                   ZMQ
                                                           400	
  rps
                       0
                            1     #	
  of	
  workers   8
NOT	
  CPU	
  bound




25%



         Fixed	
  bandwith	
  limit	
  @	
  300	
  MB/s
This	
  has	
  happened	
  before
2,000,000"




1,500,000"




1,000,000"




 500,000"




        0"
        Apr*10"   Jul*10"   Oct*10"   Jan*11"   Apr*11"   Jul*11"   Oct*11"
Example	
  controller	
  in	
  Erlang

  shake(Args, State) ->
      Coords      = g8_map:coords(Args),
      Map         = g8_game:get_map(State),
      Tree        = g8_map:find(Coords, Map),

      NewTree     = g8_fruit_tree:shake(Tree),
      UserEffects = [incr_xp, decr_energy],
      NewMap      = g8_map:place(Coords, NewTree, Map),

      [observable,
       {state, g8_game:set_map(NewMap,
                 g8_user:apply(UserEffects, State))}].
Example	
  model	
  in	
  Erlang

  shake(Tree) ->
      validate_carries_fruit(Tree),

      FruitCount = g8_fruit_tree_config:fruit_count(Tree),
      Tree#fruit_tree{last_shake_time = g8_game:gametime(),
                      collectable_fruit_count = FruitCount}.
✓ Y ES
QuesHons?

   MarHn	
  Rehfeld
    @klickmich

slideshare.net/wooga
   wooga.com/jobs

More Related Content

What's hot

DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on InfinispanLance Ball
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011Fabio Akita
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & RailsPeter Lind
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client DevelopmentTamir Khason
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011Lance Ball
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxbobmcwhirter
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaKeith Bennett
 
JUDCon London 2011 - Elastic SOA on the Cloud, Steve Millidge
JUDCon London 2011 - Elastic SOA on the Cloud, Steve MillidgeJUDCon London 2011 - Elastic SOA on the Cloud, Steve Millidge
JUDCon London 2011 - Elastic SOA on the Cloud, Steve MillidgeC2B2 Consulting
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akkanartamonov
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyBruno Oliveira
 
My sql replication advanced techniques presentation
My sql replication advanced techniques presentationMy sql replication advanced techniques presentation
My sql replication advanced techniques presentationepee
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Thomas Lundström
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Mark Menard
 
A tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesA tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesJohan Janssen
 
When Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the EnterpriseWhen Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the Enterprisebenbrowning
 

What's hot (18)

DataMapper on Infinispan
DataMapper on InfinispanDataMapper on Infinispan
DataMapper on Infinispan
 
.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011.NET Architects Day - DNAD 2011
.NET Architects Day - DNAD 2011
 
Java, Ruby & Rails
Java, Ruby & RailsJava, Ruby & Rails
Java, Ruby & Rails
 
Smart Client Development
Smart Client DevelopmentSmart Client Development
Smart Client Development
 
TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011TorqueBox - Ruby Hoedown 2011
TorqueBox - Ruby Hoedown 2011
 
Complex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
 
Devignition 2011
Devignition 2011Devignition 2011
Devignition 2011
 
Jruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-javaJruby synergy-of-ruby-and-java
Jruby synergy-of-ruby-and-java
 
JUDCon London 2011 - Elastic SOA on the Cloud, Steve Millidge
JUDCon London 2011 - Elastic SOA on the Cloud, Steve MillidgeJUDCon London 2011 - Elastic SOA on the Cloud, Steve Millidge
JUDCon London 2011 - Elastic SOA on the Cloud, Steve Millidge
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Above the clouds: introducing Akka
Above the clouds: introducing AkkaAbove the clouds: introducing Akka
Above the clouds: introducing Akka
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
 
Pfm technical-inside
Pfm technical-insidePfm technical-inside
Pfm technical-inside
 
My sql replication advanced techniques presentation
My sql replication advanced techniques presentationMy sql replication advanced techniques presentation
My sql replication advanced techniques presentation
 
Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)Ruby for C#-ers (ScanDevConf 2010)
Ruby for C#-ers (ScanDevConf 2010)
 
Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1Ruby on Rails Training - Module 1
Ruby on Rails Training - Module 1
 
A tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutesA tour of (advanced) Akka features in 40 minutes
A tour of (advanced) Akka features in 40 minutes
 
When Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the EnterpriseWhen Two Worlds Collide: Java and Ruby in the Enterprise
When Two Worlds Collide: Java and Ruby in the Enterprise
 

Similar to At Scale With Style (Erlang User Conference 2012)

Combining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyCombining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyWooga
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of IdeasWooga
 
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)Wooga
 
DB Replication With Rails
DB Replication With RailsDB Replication With Rails
DB Replication With Railsschoefmax
 
Erlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputErlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputPaolo Negri
 
Erlang and the Cloud: A Fractal Approach to Throughput
Erlang and the Cloud: A Fractal Approach to ThroughputErlang and the Cloud: A Fractal Approach to Throughput
Erlang and the Cloud: A Fractal Approach to ThroughputWooga
 
Erlang as a Cloud Citizen
Erlang as a Cloud CitizenErlang as a Cloud Citizen
Erlang as a Cloud CitizenWooga
 
Using Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceUsing Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceDoKC
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)Wooga
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Eric Torreborre
 
AKKA and Scala @ Inneractive
AKKA and Scala @ InneractiveAKKA and Scala @ Inneractive
AKKA and Scala @ InneractiveGal Aviv
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?Altoros
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Wooga
 
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015AboutYouGmbH
 
How Yelp does Service Discovery
How Yelp does Service DiscoveryHow Yelp does Service Discovery
How Yelp does Service DiscoveryJohn Billings
 
Building an App with jQuery and JAXER
Building an App with jQuery and JAXERBuilding an App with jQuery and JAXER
Building an App with jQuery and JAXERBrian Moschel
 
Using Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceUsing Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceDoKC
 

Similar to At Scale With Style (Erlang User Conference 2012) (20)

Combining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and RubyCombining the Strengths or Erlang and Ruby
Combining the Strengths or Erlang and Ruby
 
Evoloution of Ideas
Evoloution of IdeasEvoloution of Ideas
Evoloution of Ideas
 
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
Architecture Evolution at Wooga (AWS Cloud Computing for Developers,)
 
Architecture Evolution at Wooga
Architecture Evolution at WoogaArchitecture Evolution at Wooga
Architecture Evolution at Wooga
 
DB Replication With Rails
DB Replication With RailsDB Replication With Rails
DB Replication With Rails
 
Erlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughputErlang as a cloud citizen, a fractal approach to throughput
Erlang as a cloud citizen, a fractal approach to throughput
 
Erlang and the Cloud: A Fractal Approach to Throughput
Erlang and the Cloud: A Fractal Approach to ThroughputErlang and the Cloud: A Fractal Approach to Throughput
Erlang and the Cloud: A Fractal Approach to Throughput
 
Erlang as a Cloud Citizen
Erlang as a Cloud CitizenErlang as a Cloud Citizen
Erlang as a Cloud Citizen
 
Using Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceUsing Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” service
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)
 
Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)Wire once, rewire twice! (Haskell exchange-2018)
Wire once, rewire twice! (Haskell exchange-2018)
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
 
AKKA and Scala @ Inneractive
AKKA and Scala @ InneractiveAKKA and Scala @ Inneractive
AKKA and Scala @ Inneractive
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)
 
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
Jesper Richter-Reichhelm - Continuous Evolution at Wooga - code.talks 2015
 
From Ruby to Elixir
From Ruby to ElixirFrom Ruby to Elixir
From Ruby to Elixir
 
How Yelp does Service Discovery
How Yelp does Service DiscoveryHow Yelp does Service Discovery
How Yelp does Service Discovery
 
Building an App with jQuery and JAXER
Building an App with jQuery and JAXERBuilding an App with jQuery and JAXER
Building an App with jQuery and JAXER
 
Using Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” serviceUsing Kubernetes to deliver a “serverless” service
Using Kubernetes to deliver a “serverless” service
 

More from Wooga

Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Wooga
 
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Wooga
 
In it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionIn it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionWooga
 
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoLeveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoWooga
 
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid Wooga
 
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferSaying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferWooga
 
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenBig Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenWooga
 
Review mining aps2014 berlin
Review mining aps2014 berlinReview mining aps2014 berlin
Review mining aps2014 berlinWooga
 
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinWooga
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketWooga
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerWooga
 
DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)Wooga
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmWooga
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentWooga
 
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Wooga
 
How to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
How to hire the best people for your startup-Gitta Blat-Head of PeopleWooga
 
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Wooga
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketWooga
 
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...Wooga
 
DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)Wooga
 

More from Wooga (20)

Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile Story of Warlords: Bringing a turn-based strategy game to mobile
Story of Warlords: Bringing a turn-based strategy game to mobile
 
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
Instagram Celebrities: are they the new cats? - Targetsummit Berlin 2015
 
In it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retentionIn it for the long haul - How Wooga boosts long-term retention
In it for the long haul - How Wooga boosts long-term retention
 
Leveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario QuondamstefanoLeveling up in localization! - Susan Alma & Dario Quondamstefano
Leveling up in localization! - Susan Alma & Dario Quondamstefano
 
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
Entitas System Architecture with Unity - Maxim Zaks and Simon Schmid
 
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam TelferSaying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
Saying No to the CEO: A Deep Look at Independent Teams - Adam Telfer
 
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed BidenBig Fish, small pond - strategies for surviving in a maturing market - Ed Biden
Big Fish, small pond - strategies for surviving in a maturing market - Ed Biden
 
Review mining aps2014 berlin
Review mining aps2014 berlinReview mining aps2014 berlin
Review mining aps2014 berlin
 
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 BerlinRiak & Wooga_Geeek2Geeek Meetup2014 Berlin
Riak & Wooga_Geeek2Geeek Meetup2014 Berlin
 
Staying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile marketStaying in the Game: Game localization practices for the mobile market
Staying in the Game: Game localization practices for the mobile market
 
Startup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp StelzerStartup Weekend_Makers and Games_Philipp Stelzer
Startup Weekend_Makers and Games_Philipp Stelzer
 
DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)DevOps goes Mobile (daho.am)
DevOps goes Mobile (daho.am)
 
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-ReichhelmDevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
DevOps goes Mobile - Jax 2014 - Jesper Richter-Reichhelm
 
CodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game DevelopmentCodeFest 2014_Mobile Game Development
CodeFest 2014_Mobile Game Development
 
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014Jelly Splash: Puzzling your way to the top of the App Stores - GDC 2014
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
How to hire the best people for your startup-Gitta Blat-Head of PeopleHow to hire the best people for your startup-Gitta Blat-Head of People
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
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
Two Ann(e)s and one Julia_Wooga Lady Power from Berlin_SGA2014
 
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean MarketPocket Gamer Connects 2014_The Experience of Entering the Korean Market
Pocket Gamer Connects 2014_The Experience of Entering the Korean Market
 
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
How to stand out in a hit driven business - Game Connection Paris 2013 - SebK...
 
DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)DevOps the Wooga way (Webmontag Berlin)
DevOps the Wooga way (Webmontag Berlin)
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

At Scale With Style (Erlang User Conference 2012)

  • 1. AT  SCALE  WITH  STYLE Erlang  <3  <3  <3  Ruby Mar$n  Rehfeld,  @klickmich
  • 2. At  Scale  With  Style How  we  roll Server  architectures How  to  innovate Mind  the  limits
  • 3.
  • 4. Typical  game  architecture Client HTTP Backend API
  • 5. Typical  game  architecture Backend State  Changes ValidaHon Persistence
  • 6. The  scale  is  interesHng 14  billion  requests  /  month >100,000  DB  operaHons  /  second >50,000  DB  updates  /  second
  • 7. Wooga’s  approach  to  development Small  independent  teams  for  each  game Team  gets  to  choose  tools  and  technologies Same  team  also  does  ops  a,er  going  live Culture  of  sharing Look  around  what  is  there,  pick/adapt  exis;ng   solu;ons,  but  take  ownership  for  what  you   include
  • 8. ExisHng  backends  –  Technology  landscape
  • 9. At  Scale  With  Style How  we  roll Server  architectures How  to  innovate Mind  the  limits
  • 10. Most  games  use  stateless  applicaHon  servers Server Database
  • 11. And  then  there’s  sharding lb app app app app app app app app app My My SQL SQL slave slave
  • 12. More  app  servers,  more  sharding lb app app app app app app app app app app app app app app app app app app My My My My My My My My SQL SQL SQL SQL SQL SQL SQL SQL slave slave slave slave slave slave slave slave
  • 13. Wait,  seriously?! lb lb app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app app My My My My My redis redis redis redis redis SQL SQL SQL SQL SQL slave slave slave slave slave slave slave slave slave slave
  • 14. Find  the  flaw “Stateless  applicaHon  servers   guarantee  one  thing: The  data  is  never where  you  need  it!” Paolo  Negri,  Developer  @  Wooga
  • 15. Strong  session  pa`ern User  starts  playing many  transformaHons of  the  same  set  of  data User  stops  playing
  • 16. Stateful  servers  and  DBs Server Database One  Game  Session
  • 17. Stateful  game  server One  process  per  acHve  user  gaming  session ...  holds  the  current  state  and  is  the  only  one  that  can   modify  it  (strong  encapsulaHon) ...  handles  all  API  calls  for  the  given  user  one  a,er  the  other   (concurrency  control  through  actor  model) ...  loads  the  game  state  from  storage  and  writes  it  back   periodically  and  on  process  termina;on (;meout  =  user  stopped  playing)
  • 18. The  DB  is  no  longer  the  bo`leneck Stateless Stateful 30.000 22.500 15.000 700 7.500 0 DB  operations  /  second
  • 19. Magic  Land  uses  Erlang Details: Awesome  presentaHon  on the  Magic  Land  game  server by  @knuHn  &  @hungryblank h`p://www.slideshare.net/wooga/from-­‐0-­‐to-­‐1000000-­‐daily-­‐users-­‐with-­‐erlang
  • 20. At  Scale  With  Style How  we  roll Server  architectures How  to  innovate Mind  the  limits
  • 21.
  • 22. Erlang  &  Ruby Erlang  is  great Concurrent,  robust Great  for  opera;on Ruby  is  great Concise,  expressive,  flexible Great  for  development
  • 23.
  • 24. Bringing  two  worlds  together Server Worker session sender Worker session Worker ... Worker receiver session Worker
  • 25. Do  you  know  Mongrel2? Web  Server  that  hooks up  applicaHons  via ➡ We  chose  the  same  queue  setup  &   message  format Server Worker session sender Worker session Worker ... Worker receiver session Worker
  • 26.
  • 27. ConnecHng  the  dots Mongrel2  h`p://mongrel2.org/  protocol  &  ZeroMQ  setup Erlang:  h`ps://github.com/hungryblank/emongrel2 Ruby rack-­‐mongrel2  fork  hKps://github.com/khiltd/khi-­‐rack-­‐mongrel2 rack  protocol  hKp://rack.rubyforge.org Sinatra  hKp://www.sinatrarb.com/ ➡ essenHally  we  are  speaking  HTTP  over  ZeroMQ and  can  hook  up  any  Rack-­‐based  Ruby  web   framework
  • 28. Example  controller  in  Ruby app.game_action '/:actor/fruit_tree/self/shake', :observable => true, :affects => [:fruit_trees, :user], :params => [:x, :y] do x, y = params[:x], params[:y] fruit_trees[x, y].shake end DSL-­‐like  definiHon  of  game  acHon Skinny  as  controllers  should  be
  • 29. Example  model  in  Ruby class FruitTree < Tree property :last_shake_time, :type => Integer, :default => 0 property :collectable_fruit_count, :type => Integer, :default => 0 def shake raise G8::Error::Validation, "no fruit!" unless carries_fruit? session.user.xp += 1 session.user.energy -= 1 self.last_shake_time = game_time self.collectable_fruit_count = config.fruit_count end end Easily  unit  testable Minimal  amount  of  code
  • 30. Game  state Game  state  is  split  in  mulHple  parts user,  map,  fruit_trees  etc. Erlang  does  not  care  about  content Serialized  Ruby  objects Erlang  does  know  mapping  of  state  parts  to  URLs
  • 31. Looking  back  at  the  game  acHon app.game_action '/:actor/fruit_tree/self/shake', :observable => true, :affects => [:fruit_trees, :user], :params => [:x, :y] do x, y = params[:x], params[:y] fruit_trees[x, y].shake end Mapping  of  state  parts  to  game  acHons Worker  knows  mapping Worker  pushes  mapping  to  Erlang  on  startup Erlang  can  query  mapping  if  needed
  • 32. NICE! http://www.flickr.com/photos/aigle_dore/
  • 33. At  Scale  With  Style How  we  roll Server  architectures How  to  innovate Mind  the  limits
  • 34. Performance  impact  for  large  payloads 200  kB  payload 6000 5000 Requests  /  s 4000 Pure 3000 Erlang 2000 Ruby 1000 ZMQ 400  rps 0 1 #  of  workers 8
  • 35. NOT  CPU  bound 25% Fixed  bandwith  limit  @  300  MB/s
  • 36. This  has  happened  before 2,000,000" 1,500,000" 1,000,000" 500,000" 0" Apr*10" Jul*10" Oct*10" Jan*11" Apr*11" Jul*11" Oct*11"
  • 37.
  • 38. Example  controller  in  Erlang shake(Args, State) -> Coords = g8_map:coords(Args), Map = g8_game:get_map(State), Tree = g8_map:find(Coords, Map), NewTree = g8_fruit_tree:shake(Tree), UserEffects = [incr_xp, decr_energy], NewMap = g8_map:place(Coords, NewTree, Map), [observable, {state, g8_game:set_map(NewMap, g8_user:apply(UserEffects, State))}].
  • 39. Example  model  in  Erlang shake(Tree) -> validate_carries_fruit(Tree), FruitCount = g8_fruit_tree_config:fruit_count(Tree), Tree#fruit_tree{last_shake_time = g8_game:gametime(), collectable_fruit_count = FruitCount}.
  • 41. QuesHons? MarHn  Rehfeld @klickmich slideshare.net/wooga wooga.com/jobs