Technical Challenges of
Developing a Facebook
        Game
  webilea Basel, 26-01-2011
Who?
• Patrick Hüsler / @phuesler
• huesler-informatik.ch
• Freelance developer
• backend developer at ....
Players in Facebook
   Game Market
Game Developers
• Zynga (54 games)
• EA (35 games)
• Pop Cap (2 games)
• Crowd Star (20 games)
• Digital Chocolate (13 games)
• Playdom (39 games)
Anatomy of a
Facebook game
Sandbox
• iframe inside Facebook
• flash client (javascript based games
  are still a minority)
• backend
• Facebook API (FBML, graph,
  connect, payment ...)
Facebook Game
    Lingo
Monthly Active Users
       (MAU)
Current MAU Leader
City Ville
~ 100 Million MAU
Daily Active Users
       (DAU)
Current DAU Leader
City Ville
~ 20 Million DAU
check
http://appdata.com
Challenges
Goal:
~ 1’000’000 DAU
2 People for:
Backend
Development
Operations
24/7
Cent/DAU
(should be low)
Rapid Growth
Ever changing
Facebook APIs
Roughly estimated
         requirements
• ~ 20’000 concurrent users
• ~ 4’000 rps
• ~ 60’000 DB queries/s
• DB write heavy ~ 50/50
• Deliver plenty of assets (flash files,
  images etc.)
Our Architecture
Status Quo (Peak)

• ~ 200’000 DAU
• ~ 3’000 concurrent users
• ~ 660 rps peak traffic
• ~ 7000 DB queries/s
• 15 ms average response time
Dedicated hardware

• small number of machines
• fast CPU’s
• fast disks
• fast network
Automate,
 automate,
automate!!!!!!!
Monitoring
• Availability monitoring with
  pingdom (pingdom.com)
• Scout for hardware metrics and
  usage data (scoutapp.com)
• New Relic for applications
  (newrelic.com)
CDN to deliver
   assets
Rails Application
Yes, really!
Database: Redis
• very fast
• powerful data structures
• good fit to store different types of
  data
• supports virtual memory
Data format
• One Redis hash table per user
• Keys store JSON
• Custom built data mapper called
  Remodel
Durability: Flat files
• Asynchronously written to disk
• Replicated on file system
Q&A
Links
•wooga.com/jobs
•newrelic.com
•scoutapp.com
•pingdom.com
•huesler-informatik.ch
One last thing
euruko2011.org

Technical Challenges of Developing a Facebook Game