SlideShare una empresa de Scribd logo
1 de 121
Descargar para leer sin conexión
HOW  TO  HANDLE  
            1,000,000  DAILY  USERS
                          (without  using  a  cache)




 Jesper  Richter-­‐Reichhelm,  @jrirei
Tuesday, June 5, 2012
Tuesday, June 5, 2012
The  overall  architecture  is  not  that  complex

                        Flash  client    Backend




Tuesday, June 5, 2012
The  overall  architecture  is  not  that  complex

                        Flash  client



                                            Game  Session
                                        Asynch.  Communica2on




Tuesday, June 5, 2012
The  overall  architecture  is  not  that  complex

                                         Backend


                        State  Changes
                         ValidaMon
                         Persistence




Tuesday, June 5, 2012
But  the  scale  is  interesMng


                        14  billion  requests  /  month




Tuesday, June 5, 2012
But  the  scale  is  interesMng


                        14  billion  requests  /  month




Tuesday, June 5, 2012
But  the  scale  is  interesMng


                           14  billion  requests  /  month



                        >100,000  DB  operaMons  /  second




Tuesday, June 5, 2012
But  the  scale  is  interesMng


                           14  billion  requests  /  month



                        >100,000  DB  operaMons  /  second



                          >50,000  DB  updates  /  second



Tuesday, June 5, 2012
A  journey  to  1,000,000  daily  users

          Start  of  the  journey
          6  weeks  of  pain
          Paradise
          Conclusion




Tuesday, June 5, 2012
October  2009:  wooga’s  first  simulaMon  game




Tuesday, June 5, 2012
Instead  of  PHP  we  used  Ruby




Tuesday, June 5, 2012
Our  database  was  MySQL




Tuesday, June 5, 2012
Our  database  was  MySQL




                        even  user  ids   odd  user  ids




Tuesday, June 5, 2012
And  we  went  into  the  cloud




Tuesday, June 5, 2012
Master-­‐slave  replicaMon  for  DBs  worked  fine

                              lb




                        app   app   app




                        db          db




Tuesday, June 5, 2012
We  added  a  few  applicaMon  servers  over  Mme

                                                lb




                        app   app   app   app   app   app   app   app   app




                                          db          db




Tuesday, June 5, 2012
250K  daily  users  and  no  problems
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"
                                      Life  was  good

                  !"
                  '()*%!"   +,-*%!"       ./0*%!"       +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
Life  was  well  and  I  went  on  a  nice  vacaMon
                                                         TO  DO

                              <picture:  Jesper  in  clot  
                                      canyon>




Tuesday, June 5, 2012
Tuesday, June 5, 2012
Our  bane:  MySQL  hiccups

        (!!"#


          '!"#


          &!"#


          %!"#


          $!"#


            !"#
                        !#   )#   (!#   ()#   $!#   $)#   *!#   *)#   %!#




Tuesday, June 5, 2012
Our  bane:  MySQL  hiccups

        (!!"#


          '!"#


          &!"#


          %!"#


          $!"#


            !"#
                        !#   )#   (!#   ()#   $!#   $)#   *!#   *)#   %!#




Tuesday, June 5, 2012
Our  bane:  MySQL  hiccups

        (!!"#


          '!"#


          &!"#


          %!"#


          $!"#


            !"#
                        !#   )#   (!#   ()#   $!#   $)#   *!#   *)#   %!#




Tuesday, June 5, 2012
A  journey  to  1,000,000  daily  users

          Start  of  the  journey
          6  weeks  of  pain
          Paradise
          Conclusion




Tuesday, June 5, 2012
SQL  queries  generated  by  Rubyamf  gem

          AMF  responses  to  Flash  client




Tuesday, June 5, 2012
SQL  queries  generated  by  Rubyamf  gem

          AMF  responses  to  Flash  client
          Wrong  config...
          ...  so  associated  data  was  included,  too




Tuesday, June 5, 2012
SQL  queries  generated  by  Rubyamf  gem

          AMF  responses  to  Flash  client
          Wrong  config...
          ...  so  associated  data  was  included,  too


          =>  Easy  to  fix




Tuesday, June 5, 2012
More  traffic  using  the  same  cluster

                                                lb




                        app   app   app   app   app   app   app   app   app




                                          db          db




Tuesday, June 5, 2012
Config  tweaks  brought  us  to  300K  DAU
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"
                                      Config  fixes

                  !"
                  '()*%!"   +,-*%!"      ./0*%!"    +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
AcMveRecord’s  checks  caused  20%  extra  DB  

          Checking  connecMon  state
          MySQL  process  list  full  of  ‘status’  calls




Tuesday, June 5, 2012
AcMveRecord’s  checks  caused  20%  extra  DB  

          Checking  connecMon  state
          MySQL  process  list  full  of  ‘status’  calls


          =>  Fixed  by  1  line  of  code




Tuesday, June 5, 2012
I/O  on  MySQL  masters  sMll  was  the  bojleneck

       New  Relic:  60%  of  all  UPDATEs  on  ‘Mles’  table




Tuesday, June 5, 2012
Tiles  are  part  of  the  core  game  loop




                                         Core  game  loop
                                         1)  plant
                                         2)  wait
                                         3)  harvest




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards




                  old      old  
                 master   slave




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards
            1)  Setup  new  masters  as  slaves  of  old  ones




                  old        old            new  
                 master     slave          master




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards
            1)  Setup  new  masters




                  old      old         new     new  
                 master   slave       master   slave




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards
            1)  Setup  new  masters
            2)  Start  using  new  masters




                  old       old               new     new  
                 master    slave             master   slave




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards
            1)  Setup  new  masters
            2)  Start  using  new  masters
            3)  Cut  replicaBon




                  old       old               new     new  
                 master    slave             master   slave




Tuesday, June 5, 2012
We  started  to  shard  on  model,  too

          Adding  new  shards
            1)  Setup  new  masters
            2)  Start  using  new  masters
            3)  Cut  replicaBon
            4)  Truncate



                  old       old               new     new  
                 master    slave             master   slave




Tuesday, June 5, 2012
4  DB  masters  and  a  few  more  servers

                                                     lb




                        app   app   app        app        app      app    app   app


                        app   app   app        app        app      app    app   app



                                                                Bles     Bles
                               db         db
                                                                 db       db




Tuesday, June 5, 2012
Sharding  by  model  brought  us  to  400K  DAU
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"
                                      Shard  by  model


                  !"
                  '()*%!"   +,-*%!"    ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
We  improved  our  MySQL  setup

          RAID-­‐0  of  EBS  volumes




Tuesday, June 5, 2012
We  improved  our  MySQL  setup

          RAID-­‐0  of  EBS  volumes


          Using  XtraDB




Tuesday, June 5, 2012
We  improved  our  MySQL  setup

          RAID-­‐0  of  EBS  volumes


          Using  XtraDB


          Tweaking  my.cnf




Tuesday, June 5, 2012
Sharding  gem  circumvented  AR’s  internal  cache

          AcMveRecord  caches  SQL  queries...




Tuesday, June 5, 2012
Sharding  gem  circumvented  AR’s  internal  cache

          AcMveRecord  caches  SQL  queries...


          ...  only  in  our  development  environment!




Tuesday, June 5, 2012
Sharding  gem  circumvented  AR’s  internal  cache

          AcMveRecord  caches  SQL  queries...


          ...  only  in  our  development  environment!


          =>  Fixed  by  2  lines  of  code




Tuesday, June 5, 2012
I/O  sMll  was  not  fast  enough

          If  2  +  2  is  not  enough,  ...




Tuesday, June 5, 2012
I/O  sMll  was  not  fast  enough

          If  2  +  2  is  not  enough,  ...


          …  perhaps  4  +  4  masters  will  do?




Tuesday, June 5, 2012
It’s  no  fun  to  handle  8+8  MySQL  DBs

                                                 lb




                        app   app    app   app   app   app    app     app   app


                        app   app    app   app   app   app    app     app   app




                                                       Bles    Bles
                                    db     db
                                                        db      db




Tuesday, June 5, 2012
It’s  no  fun  to  handle  8+8  MySQL  DBs

                                                           lb




                             app        app    app   app   app   app    app     app          app


                             app        app    app   app   app   app    app     app      app




                                                                 Bles    Bles         Bles         Bles
                        db         db         db     db
                                                                  db      db           db           db




Tuesday, June 5, 2012
At  500K  DAU  we  were  at  a  dead  end
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
At  500K  DAU  we  were  at  a  dead  end
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
I/O  remained  bojleneck  for  MySQL  UPDATEs



                        Each  DB  master  could  do
                        about  1000  DB  write/s.




Tuesday, June 5, 2012
I/O  remained  bojleneck  for  MySQL  UPDATEs



                        Each  DB  master  could  do
                        about  1000  DB  write/s.


                           That’s  not  enough!




Tuesday, June 5, 2012
Pick  the  right  tool  for  the  job!




Tuesday, June 5, 2012
Pick  the  right  tool  for  the  job!




Tuesday, June 5, 2012
Redis  is  fast  but  goes  beyond  simple  key/value

          Redis  is  a  key-­‐value  store
            Hashes,  Sets,  Sorted  Sets,  Lists
            Atomic  operaBons  like  set,  get,  increment




Tuesday, June 5, 2012
Redis  is  fast  but  goes  beyond  simple  key/value

          Redis  is  a  key-­‐value  store
            Hashes,  Sets,  Sorted  Sets,  Lists
            Atomic  operaBons  like  set,  get,  increment

          50,000  transacMons/s  on  EC2
             Writes  are  as  fast  as  reads




Tuesday, June 5, 2012
We  could  learn  from  another  team  using  Redis




Tuesday, June 5, 2012
We  could  learn  from  another  team  using  Redis




Tuesday, June 5, 2012
Shelf  Mles  :  An  ideal  candidate  for  Redis




                                                Shelf  2les:
                                            {  plant1  =>  184,
                                             plant2  =>  141,
                                             plant3  =>  130,
                                             plant4  =>  112,
                                                    …  }


Tuesday, June 5, 2012
Shelf  Mles  :  An  ideal  candidate  for  using  Redis  

          Redis  Hash
            HGETALL
            HGETSET
            HINCRBY
            …




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
On-­‐demand  migraMons  from  MySQL  to  Redis




Tuesday, June 5, 2012
Typical  migraMon  throughput  over  3  days




Tuesday, June 5, 2012
Migrate  on  the  fly  -­‐  and  clean  up  later

          1. Let  migraMon  run  unMl  everything  cools  down




Tuesday, June 5, 2012
Migrate  on  the  fly  -­‐  and  clean  up  later

          1. Let  migraMon  run  unMl  everything  cools  down
          2. Migrate  the  rest  manually




Tuesday, June 5, 2012
Migrate  on  the  fly  -­‐  and  clean  up  later

          1. Let  migraMon  run  unMl  everything  cools  down
          2. Migrate  the  rest  manually
          3. Remove  migraMon  code




Tuesday, June 5, 2012
Migrate  on  the  fly  -­‐  and  clean  up  later

          1. Let  migraMon  run  unMl  everything  cools  down
          2. Migrate  the  rest  manually
          3. Remove  migraMon  code
          4. Wait  unMl  no  fallback  necessary




Tuesday, June 5, 2012
Migrate  on  the  fly  -­‐  and  clean  up  later

          1. Let  migraMon  run  unMl  everything  cools  down
          2. Migrate  the  rest  manually
          3. Remove  migraMon  code
          4. Wait  unMl  no  fallback  necessary
          5. Remove  SQL  table




Tuesday, June 5, 2012
A  journey  to  1,000,000  daily  users

          Start  of  the  journey
          6  weeks  of  pain
          Paredise  (or  not?)
          Conclusion




Tuesday, June 5, 2012
Again:  Tiles  are  part  of  the  core  game  loop




                                         Core  game  loop
                                         1)  plant
                                         2)  wait
                                         3)  harvest




Tuesday, June 5, 2012
Size  majers  for  migraMons




Tuesday, June 5, 2012
Size  majers  for  migraMons

          MigraMon  check  overload




Tuesday, June 5, 2012
Size  majers  for  migraMons

          MigraMon  check  overload
            MigraBon  only  on  startup




Tuesday, June 5, 2012
Size  majers  for  migraMons

          MigraMon  check  overload
            MigraBon  only  on  startup

          Overlooked  an  edge  case




Tuesday, June 5, 2012
Size  majers  for  migraMons

          MigraMon  check  overload
            MigraBon  only  on  startup

          Overlooked  an  edge  case
            Only  migrate  1%  of  users




Tuesday, June 5, 2012
Size  majers  for  migraMons

          MigraMon  check  overload
            MigraBon  only  on  startup

          Overlooked  an  edge  case
            Only  migrate  1%  of  users
            ConBnue  if  everything  is  ok




Tuesday, June 5, 2012
In-­‐memory  DBs  don’t  like  dumping  to  disk

       Dumping  to  disk




Tuesday, June 5, 2012
In-­‐memory  DBs  don’t  like  dumping  to  disk

       Dumping  to  disk
         SAVE  is  blocking




Tuesday, June 5, 2012
In-­‐memory  DBs  don’t  like  dumping  to  disk

       Dumping  to  disk
         SAVE  is  blocking
         BGSAVE  needs  free  RAM




Tuesday, June 5, 2012
In-­‐memory  DBs  don’t  like  dumping  to  disk

       Dumping  to  disk
         SAVE  is  blocking
         BGSAVE  needs  free  RAM

       Latency  increase  by  100%




Tuesday, June 5, 2012
In-­‐memory  DBs  don’t  like  dumping  to  disk

       Dumping  to  disk
         SAVE  is  blocking
         BGSAVE  needs  free  RAM

       Latency  increase  by  100%

       =>  BGSAVE  on  slaves  every  15  minutes




Tuesday, June 5, 2012
Redis  replicaMon  starts  with  a  BGSAVE

       StarMng  up  a  new  slave  by  replicaMon




Tuesday, June 5, 2012
Redis  replicaMon  starts  with  a  BGSAVE

       StarMng  up  a  new  slave  by  replicaMon
          BGSAVE  on  master




Tuesday, June 5, 2012
Redis  replicaMon  starts  with  a  BGSAVE

       StarMng  up  a  new  slave  by  replicaMon
          BGSAVE  on  master
          Slave  imports  dumped  file




Tuesday, June 5, 2012
Redis  replicaMon  starts  with  a  BGSAVE

       StarMng  up  a  new  slave  by  replicaMon
          BGSAVE  on  master
          Slave  imports  dumped  file

       =>  No  RAM  means  no  new  slaves




Tuesday, June 5, 2012
Redis  had  a  memory  fragmenMon  problem



                                     44  GB

                                         in  8  days

                                    24  GB




Tuesday, June 5, 2012
Redis  had  a  memory  fragmenMon  problem




                                    38  GB
                                         in  3  days
                                    24  GB




Tuesday, June 5, 2012
Redis  had  a  memory  fragmenMon  problem


                                 2.2
                           in  v
               xe       d
            F i                        38  GB
                                            in  3  days
                                       24  GB




Tuesday, June 5, 2012
If  MySQL  is  a  truck
                                                                                 Fast  enough
                                                                                 Disk  based
                                                                                 Robust




                        Fast  enough                    disk  based                    robust

Tuesday, June 5, 2012
If  MySQL  is  a  truck,  Redis  is  a  race  car
                                                                                  Super  fast
                                                                                  RAM  based
                                                                                  Fragile




                        Super  fast                    RAM  based                    fragile

Tuesday, June 5, 2012
Big  and  staMc  data  in  MySQL,  rest  goes  to  Redis




                         256  GB  data                               60  GB  data
                          10%  writes                                50%  writes
                        h"p://www.flickr.com/photos/erix/245657047/




Tuesday, June 5, 2012
Lots  of  boxes,  but  automaMon  helps  a  lot!

                                                           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



     db                 db         db         db     db                    redis    redis     redis     redis   redis




Tuesday, June 5, 2012
We  reached  1  million  daily  users!
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"
                                                1,000,000  -­‐  Big  party!



       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"      +12*%%"     '()*%%"        +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
We  started  archiving  inacMve  users
    &$!!!$!!!"




    %$#!!$!!!"

                                                                    50%  DB
    %$!!!$!!!"
                                                                    reduc2on



       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"     +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
We  even  survived  a  complete  data  center  loss
    &$!!!$!!!"



                                                                              EBS  no
    %$#!!$!!!"
                                                                              more!


    %$!!!$!!!"




       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"       ./0*%%"



Tuesday, June 5, 2012
We  improved  our  MySQL  schema  on-­‐the-­‐fly
    &$!!!$!!!"



                                                                              30%  DB
    %$#!!$!!!"
                                                                              reduc2on


    %$!!!$!!!"




       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"    ./0*%%"



Tuesday, June 5, 2012
Meanwhile  we  have  more  than  2M  daily  users
    &$!!!$!!!"




    %$#!!$!!!"




    %$!!!$!!!"




       #!!$!!!"




                  !"
                  '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"



Tuesday, June 5, 2012
A  journey  to  1,000,000  daily  users

          Start  of  the  journey
          6  weeks  of  pain
          Paredise  (or  not?)
          Conclusion




Tuesday, June 5, 2012
EvoluMon  every  week


                              EVOLUTION
                                                    of  sotware
                        &$!!!$!!!"




                        %$#!!$!!!"




                        %$!!!$!!!"




                         #!!$!!!"




                                !"
                                '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"




Tuesday, June 5, 2012
EvoluMon  every  week


                              EVOLUTION
                                                    of  sotware
                        &$!!!$!!!"




                        %$#!!$!!!"




                        %$!!!$!!!"




                         #!!$!!!"




                                !"
                                '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"




Tuesday, June 5, 2012
EvoluMon  every  week


                        REVOLUTION
                                                    of  sotware
                        &$!!!$!!!"




                        %$#!!$!!!"




                        %$!!!$!!!"




                         #!!$!!!"




                                !"
                                '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"




Tuesday, June 5, 2012
EvoluMon  every  week


                        REVOLUTION
                                                    of  sotware
                        &$!!!$!!!"




                        %$#!!$!!!"




                        %$!!!$!!!"




                         #!!$!!!"




                                !"
                                '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"




Tuesday, June 5, 2012
EvoluMon  every  week


                        REVOLUTION
                                                    of  sotware
                        &$!!!$!!!"




                        %$#!!$!!!"




                        %$!!!$!!!"




                         #!!$!!!"




                                !"
                                '()*%!"   +,-*%!"   ./0*%!"   +12*%%"   '()*%%"   +,-*%%"   ./0*%%"




Tuesday, June 5, 2012
Works  for  teams  ...




Tuesday, June 5, 2012
Each  new  game  is  a  revoluMon




Tuesday, June 5, 2012
Each  new  game  is  a  revoluMon




Tuesday, June 5, 2012
Each  new  game  is  a  revoluMon




Tuesday, June 5, 2012
Each  new  game  is  a  revoluMon




Tuesday, June 5, 2012
Each  new  game  is  a  revoluMon




Tuesday, June 5, 2012
Works  for  teams  and  for  companies




                        !""#$%&"'()"*+,
Tuesday, June 5, 2012
Ques2ons?

                        Jesper  Richter-­‐Reichhelm
                                  @jrirei

                         slideshare.net/wooga
                            wooga.com/jobs




Tuesday, June 5, 2012
Tuesday, June 5, 2012

Más contenido relacionado

Más de Wooga

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
 
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
 
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
 
Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Wooga
 
Beyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenBeyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenWooga
 
Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Wooga
 

Más de Wooga (20)

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
 
Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)Innovation dank DevOps (DevOpsCon Berlin 2015)
Innovation dank DevOps (DevOpsCon Berlin 2015)
 
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)
 
Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)Why Having Impact Matters for Good Developers (GOTO Berlin)
Why Having Impact Matters for Good Developers (GOTO Berlin)
 
Beyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim LossenBeyond Devops_GOTOBerlin2013_Tim Lossen
Beyond Devops_GOTOBerlin2013_Tim Lossen
 
Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013Social games and their clean code_Clean Code Days_Dresden 2013
Social games and their clean code_Clean Code Days_Dresden 2013
 

Último

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 

Último (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
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
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 

How to Handle 1,000,000 Daily Users Without Using a Cache (RailsWayCon 2012)

  • 1. HOW  TO  HANDLE   1,000,000  DAILY  USERS (without  using  a  cache) Jesper  Richter-­‐Reichhelm,  @jrirei Tuesday, June 5, 2012
  • 3. The  overall  architecture  is  not  that  complex Flash  client Backend Tuesday, June 5, 2012
  • 4. The  overall  architecture  is  not  that  complex Flash  client Game  Session Asynch.  Communica2on Tuesday, June 5, 2012
  • 5. The  overall  architecture  is  not  that  complex Backend State  Changes ValidaMon Persistence Tuesday, June 5, 2012
  • 6. But  the  scale  is  interesMng 14  billion  requests  /  month Tuesday, June 5, 2012
  • 7. But  the  scale  is  interesMng 14  billion  requests  /  month Tuesday, June 5, 2012
  • 8. But  the  scale  is  interesMng 14  billion  requests  /  month >100,000  DB  operaMons  /  second Tuesday, June 5, 2012
  • 9. But  the  scale  is  interesMng 14  billion  requests  /  month >100,000  DB  operaMons  /  second >50,000  DB  updates  /  second Tuesday, June 5, 2012
  • 10. A  journey  to  1,000,000  daily  users Start  of  the  journey 6  weeks  of  pain Paradise Conclusion Tuesday, June 5, 2012
  • 11. October  2009:  wooga’s  first  simulaMon  game Tuesday, June 5, 2012
  • 12. Instead  of  PHP  we  used  Ruby Tuesday, June 5, 2012
  • 13. Our  database  was  MySQL Tuesday, June 5, 2012
  • 14. Our  database  was  MySQL even  user  ids odd  user  ids Tuesday, June 5, 2012
  • 15. And  we  went  into  the  cloud Tuesday, June 5, 2012
  • 16. Master-­‐slave  replicaMon  for  DBs  worked  fine lb app app app db db Tuesday, June 5, 2012
  • 17. We  added  a  few  applicaMon  servers  over  Mme lb app app app app app app app app app db db Tuesday, June 5, 2012
  • 18. 250K  daily  users  and  no  problems &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" Life  was  good !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 19. Life  was  well  and  I  went  on  a  nice  vacaMon TO  DO <picture:  Jesper  in  clot   canyon> Tuesday, June 5, 2012
  • 21. Our  bane:  MySQL  hiccups (!!"# '!"# &!"# %!"# $!"# !"# !# )# (!# ()# $!# $)# *!# *)# %!# Tuesday, June 5, 2012
  • 22. Our  bane:  MySQL  hiccups (!!"# '!"# &!"# %!"# $!"# !"# !# )# (!# ()# $!# $)# *!# *)# %!# Tuesday, June 5, 2012
  • 23. Our  bane:  MySQL  hiccups (!!"# '!"# &!"# %!"# $!"# !"# !# )# (!# ()# $!# $)# *!# *)# %!# Tuesday, June 5, 2012
  • 24. A  journey  to  1,000,000  daily  users Start  of  the  journey 6  weeks  of  pain Paradise Conclusion Tuesday, June 5, 2012
  • 25. SQL  queries  generated  by  Rubyamf  gem AMF  responses  to  Flash  client Tuesday, June 5, 2012
  • 26. SQL  queries  generated  by  Rubyamf  gem AMF  responses  to  Flash  client Wrong  config... ...  so  associated  data  was  included,  too Tuesday, June 5, 2012
  • 27. SQL  queries  generated  by  Rubyamf  gem AMF  responses  to  Flash  client Wrong  config... ...  so  associated  data  was  included,  too =>  Easy  to  fix Tuesday, June 5, 2012
  • 28. More  traffic  using  the  same  cluster lb app app app app app app app app app db db Tuesday, June 5, 2012
  • 29. Config  tweaks  brought  us  to  300K  DAU &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" Config  fixes !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 30. AcMveRecord’s  checks  caused  20%  extra  DB   Checking  connecMon  state MySQL  process  list  full  of  ‘status’  calls Tuesday, June 5, 2012
  • 31. AcMveRecord’s  checks  caused  20%  extra  DB   Checking  connecMon  state MySQL  process  list  full  of  ‘status’  calls =>  Fixed  by  1  line  of  code Tuesday, June 5, 2012
  • 32. I/O  on  MySQL  masters  sMll  was  the  bojleneck New  Relic:  60%  of  all  UPDATEs  on  ‘Mles’  table Tuesday, June 5, 2012
  • 33. Tiles  are  part  of  the  core  game  loop Core  game  loop 1)  plant 2)  wait 3)  harvest Tuesday, June 5, 2012
  • 34. We  started  to  shard  on  model,  too Adding  new  shards old   old   master slave Tuesday, June 5, 2012
  • 35. We  started  to  shard  on  model,  too Adding  new  shards 1)  Setup  new  masters  as  slaves  of  old  ones old   old   new   master slave master Tuesday, June 5, 2012
  • 36. We  started  to  shard  on  model,  too Adding  new  shards 1)  Setup  new  masters old   old   new   new   master slave master slave Tuesday, June 5, 2012
  • 37. We  started  to  shard  on  model,  too Adding  new  shards 1)  Setup  new  masters 2)  Start  using  new  masters old   old   new   new   master slave master slave Tuesday, June 5, 2012
  • 38. We  started  to  shard  on  model,  too Adding  new  shards 1)  Setup  new  masters 2)  Start  using  new  masters 3)  Cut  replicaBon old   old   new   new   master slave master slave Tuesday, June 5, 2012
  • 39. We  started  to  shard  on  model,  too Adding  new  shards 1)  Setup  new  masters 2)  Start  using  new  masters 3)  Cut  replicaBon 4)  Truncate old   old   new   new   master slave master slave Tuesday, June 5, 2012
  • 40. 4  DB  masters  and  a  few  more  servers lb app app app app app app app app app app app app app app app app Bles Bles db db db db Tuesday, June 5, 2012
  • 41. Sharding  by  model  brought  us  to  400K  DAU &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" Shard  by  model !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 42. We  improved  our  MySQL  setup RAID-­‐0  of  EBS  volumes Tuesday, June 5, 2012
  • 43. We  improved  our  MySQL  setup RAID-­‐0  of  EBS  volumes Using  XtraDB Tuesday, June 5, 2012
  • 44. We  improved  our  MySQL  setup RAID-­‐0  of  EBS  volumes Using  XtraDB Tweaking  my.cnf Tuesday, June 5, 2012
  • 45. Sharding  gem  circumvented  AR’s  internal  cache AcMveRecord  caches  SQL  queries... Tuesday, June 5, 2012
  • 46. Sharding  gem  circumvented  AR’s  internal  cache AcMveRecord  caches  SQL  queries... ...  only  in  our  development  environment! Tuesday, June 5, 2012
  • 47. Sharding  gem  circumvented  AR’s  internal  cache AcMveRecord  caches  SQL  queries... ...  only  in  our  development  environment! =>  Fixed  by  2  lines  of  code Tuesday, June 5, 2012
  • 48. I/O  sMll  was  not  fast  enough If  2  +  2  is  not  enough,  ... Tuesday, June 5, 2012
  • 49. I/O  sMll  was  not  fast  enough If  2  +  2  is  not  enough,  ... …  perhaps  4  +  4  masters  will  do? Tuesday, June 5, 2012
  • 50. It’s  no  fun  to  handle  8+8  MySQL  DBs lb app app app app app app app app app app app app app app app app app app Bles Bles db db db db Tuesday, June 5, 2012
  • 51. It’s  no  fun  to  handle  8+8  MySQL  DBs lb app app app app app app app app app app app app app app app app app app Bles Bles Bles Bles db db db db db db db db Tuesday, June 5, 2012
  • 52. At  500K  DAU  we  were  at  a  dead  end &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 53. At  500K  DAU  we  were  at  a  dead  end &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 54. I/O  remained  bojleneck  for  MySQL  UPDATEs Each  DB  master  could  do about  1000  DB  write/s. Tuesday, June 5, 2012
  • 55. I/O  remained  bojleneck  for  MySQL  UPDATEs Each  DB  master  could  do about  1000  DB  write/s. That’s  not  enough! Tuesday, June 5, 2012
  • 56. Pick  the  right  tool  for  the  job! Tuesday, June 5, 2012
  • 57. Pick  the  right  tool  for  the  job! Tuesday, June 5, 2012
  • 58. Redis  is  fast  but  goes  beyond  simple  key/value Redis  is  a  key-­‐value  store Hashes,  Sets,  Sorted  Sets,  Lists Atomic  operaBons  like  set,  get,  increment Tuesday, June 5, 2012
  • 59. Redis  is  fast  but  goes  beyond  simple  key/value Redis  is  a  key-­‐value  store Hashes,  Sets,  Sorted  Sets,  Lists Atomic  operaBons  like  set,  get,  increment 50,000  transacMons/s  on  EC2 Writes  are  as  fast  as  reads Tuesday, June 5, 2012
  • 60. We  could  learn  from  another  team  using  Redis Tuesday, June 5, 2012
  • 61. We  could  learn  from  another  team  using  Redis Tuesday, June 5, 2012
  • 62. Shelf  Mles  :  An  ideal  candidate  for  Redis Shelf  2les: {  plant1  =>  184, plant2  =>  141, plant3  =>  130, plant4  =>  112, …  } Tuesday, June 5, 2012
  • 63. Shelf  Mles  :  An  ideal  candidate  for  using  Redis   Redis  Hash HGETALL HGETSET HINCRBY … Tuesday, June 5, 2012
  • 64. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 65. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 66. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 67. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 68. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 69. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 70. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 71. On-­‐demand  migraMons  from  MySQL  to  Redis Tuesday, June 5, 2012
  • 72. Typical  migraMon  throughput  over  3  days Tuesday, June 5, 2012
  • 73. Migrate  on  the  fly  -­‐  and  clean  up  later 1. Let  migraMon  run  unMl  everything  cools  down Tuesday, June 5, 2012
  • 74. Migrate  on  the  fly  -­‐  and  clean  up  later 1. Let  migraMon  run  unMl  everything  cools  down 2. Migrate  the  rest  manually Tuesday, June 5, 2012
  • 75. Migrate  on  the  fly  -­‐  and  clean  up  later 1. Let  migraMon  run  unMl  everything  cools  down 2. Migrate  the  rest  manually 3. Remove  migraMon  code Tuesday, June 5, 2012
  • 76. Migrate  on  the  fly  -­‐  and  clean  up  later 1. Let  migraMon  run  unMl  everything  cools  down 2. Migrate  the  rest  manually 3. Remove  migraMon  code 4. Wait  unMl  no  fallback  necessary Tuesday, June 5, 2012
  • 77. Migrate  on  the  fly  -­‐  and  clean  up  later 1. Let  migraMon  run  unMl  everything  cools  down 2. Migrate  the  rest  manually 3. Remove  migraMon  code 4. Wait  unMl  no  fallback  necessary 5. Remove  SQL  table Tuesday, June 5, 2012
  • 78. A  journey  to  1,000,000  daily  users Start  of  the  journey 6  weeks  of  pain Paredise  (or  not?) Conclusion Tuesday, June 5, 2012
  • 79. Again:  Tiles  are  part  of  the  core  game  loop Core  game  loop 1)  plant 2)  wait 3)  harvest Tuesday, June 5, 2012
  • 80. Size  majers  for  migraMons Tuesday, June 5, 2012
  • 81. Size  majers  for  migraMons MigraMon  check  overload Tuesday, June 5, 2012
  • 82. Size  majers  for  migraMons MigraMon  check  overload MigraBon  only  on  startup Tuesday, June 5, 2012
  • 83. Size  majers  for  migraMons MigraMon  check  overload MigraBon  only  on  startup Overlooked  an  edge  case Tuesday, June 5, 2012
  • 84. Size  majers  for  migraMons MigraMon  check  overload MigraBon  only  on  startup Overlooked  an  edge  case Only  migrate  1%  of  users Tuesday, June 5, 2012
  • 85. Size  majers  for  migraMons MigraMon  check  overload MigraBon  only  on  startup Overlooked  an  edge  case Only  migrate  1%  of  users ConBnue  if  everything  is  ok Tuesday, June 5, 2012
  • 86. In-­‐memory  DBs  don’t  like  dumping  to  disk Dumping  to  disk Tuesday, June 5, 2012
  • 87. In-­‐memory  DBs  don’t  like  dumping  to  disk Dumping  to  disk SAVE  is  blocking Tuesday, June 5, 2012
  • 88. In-­‐memory  DBs  don’t  like  dumping  to  disk Dumping  to  disk SAVE  is  blocking BGSAVE  needs  free  RAM Tuesday, June 5, 2012
  • 89. In-­‐memory  DBs  don’t  like  dumping  to  disk Dumping  to  disk SAVE  is  blocking BGSAVE  needs  free  RAM Latency  increase  by  100% Tuesday, June 5, 2012
  • 90. In-­‐memory  DBs  don’t  like  dumping  to  disk Dumping  to  disk SAVE  is  blocking BGSAVE  needs  free  RAM Latency  increase  by  100% =>  BGSAVE  on  slaves  every  15  minutes Tuesday, June 5, 2012
  • 91. Redis  replicaMon  starts  with  a  BGSAVE StarMng  up  a  new  slave  by  replicaMon Tuesday, June 5, 2012
  • 92. Redis  replicaMon  starts  with  a  BGSAVE StarMng  up  a  new  slave  by  replicaMon BGSAVE  on  master Tuesday, June 5, 2012
  • 93. Redis  replicaMon  starts  with  a  BGSAVE StarMng  up  a  new  slave  by  replicaMon BGSAVE  on  master Slave  imports  dumped  file Tuesday, June 5, 2012
  • 94. Redis  replicaMon  starts  with  a  BGSAVE StarMng  up  a  new  slave  by  replicaMon BGSAVE  on  master Slave  imports  dumped  file =>  No  RAM  means  no  new  slaves Tuesday, June 5, 2012
  • 95. Redis  had  a  memory  fragmenMon  problem 44  GB in  8  days 24  GB Tuesday, June 5, 2012
  • 96. Redis  had  a  memory  fragmenMon  problem 38  GB in  3  days 24  GB Tuesday, June 5, 2012
  • 97. Redis  had  a  memory  fragmenMon  problem 2.2  in  v xe d F i 38  GB in  3  days 24  GB Tuesday, June 5, 2012
  • 98. If  MySQL  is  a  truck Fast  enough Disk  based Robust Fast  enough                    disk  based                    robust Tuesday, June 5, 2012
  • 99. If  MySQL  is  a  truck,  Redis  is  a  race  car Super  fast RAM  based Fragile Super  fast                    RAM  based                    fragile Tuesday, June 5, 2012
  • 100. Big  and  staMc  data  in  MySQL,  rest  goes  to  Redis 256  GB  data 60  GB  data 10%  writes 50%  writes h"p://www.flickr.com/photos/erix/245657047/ Tuesday, June 5, 2012
  • 101. Lots  of  boxes,  but  automaMon  helps  a  lot! 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 db db db db db redis redis redis redis redis Tuesday, June 5, 2012
  • 102. We  reached  1  million  daily  users! &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" 1,000,000  -­‐  Big  party! #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 103. We  started  archiving  inacMve  users &$!!!$!!!" %$#!!$!!!" 50%  DB %$!!!$!!!" reduc2on #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 104. We  even  survived  a  complete  data  center  loss &$!!!$!!!" EBS  no %$#!!$!!!" more! %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 105. We  improved  our  MySQL  schema  on-­‐the-­‐fly &$!!!$!!!" 30%  DB %$#!!$!!!" reduc2on %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 106. Meanwhile  we  have  more  than  2M  daily  users &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 107. A  journey  to  1,000,000  daily  users Start  of  the  journey 6  weeks  of  pain Paredise  (or  not?) Conclusion Tuesday, June 5, 2012
  • 108. EvoluMon  every  week EVOLUTION of  sotware &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 109. EvoluMon  every  week EVOLUTION of  sotware &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 110. EvoluMon  every  week REVOLUTION of  sotware &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 111. EvoluMon  every  week REVOLUTION of  sotware &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 112. EvoluMon  every  week REVOLUTION of  sotware &$!!!$!!!" %$#!!$!!!" %$!!!$!!!" #!!$!!!" !" '()*%!" +,-*%!" ./0*%!" +12*%%" '()*%%" +,-*%%" ./0*%%" Tuesday, June 5, 2012
  • 113. Works  for  teams  ... Tuesday, June 5, 2012
  • 114. Each  new  game  is  a  revoluMon Tuesday, June 5, 2012
  • 115. Each  new  game  is  a  revoluMon Tuesday, June 5, 2012
  • 116. Each  new  game  is  a  revoluMon Tuesday, June 5, 2012
  • 117. Each  new  game  is  a  revoluMon Tuesday, June 5, 2012
  • 118. Each  new  game  is  a  revoluMon Tuesday, June 5, 2012
  • 119. Works  for  teams  and  for  companies !""#$%&"'()"*+, Tuesday, June 5, 2012
  • 120. Ques2ons? Jesper  Richter-­‐Reichhelm @jrirei slideshare.net/wooga wooga.com/jobs Tuesday, June 5, 2012