SlideShare uma empresa Scribd logo
1 de 37
F#

in the Cloud and at Scale
Yan Cui (@theburningmonk)

Image by Mike Rohde
Who is Gamesys?

• Founded in 2001
• #1 in the UK

• Handle $5 Billion in turnover annually
• First company to launch real money gaming on Facebook

• Employ 1,000 globally
Running in the Cloud, at Scale
• 1 Million DAU
• 250 Million requests/day
• 7 Billion rows of analytics events/month

• 2 TB of analytics data/month
Running in the Cloud, at Scale
• 100% cloud hosted
• AWS for Game services
• Google App Engine for back-office services

• NoSQL databases
– DynamoDB, CouchBase, Redis, Neo4j, ...

• Google BigQuery for analytics
What is the Cloud?
Cloud computing is an expression used to describe a
variety of computing concepts that involve a large
number of computers connected through a real-time
communication network such as the Internet....
Such virtual servers do not physically exist and can
therefore be moved around and scaled up (or down)
on the fly without affecting the end user arguably, rather like a cloud.
- Wikipedia
What is the Cloud?

IaaS

PaaS

SaaS

VMs, load
balancers,
storage, ...

Runtime, databa
se, web
servers, ...

Virtual
desktop, games,
emails, ...
Why the Cloud?
• Trade capital cost with operating cost
• Lower operating cost
• Elastic scaling

• Speed and agility
• Focus on what differentiates your product

• Global infrastructure for your global audience
Why the Cloud - Scalability
• Scale up
• Scale out
• Scale everything!
– Your architecture is as scalable as its least scalable part

• Scalability != simple choice of language/framework
Travel, Collect, Craft!
Trap Monsters
Stateful Server

EC2
Elastic Load Balancer

CloudFront
Server A

Server B
...

Auto scaling Group

S3
Stateful Server
• Need to ensure Server affinity
– All calls need to be routed to the affined server

• Need to balance load
– Session lengths vary greatly
– Some players are more active than others
– Need to avoid hot spots

• Need to avoid players hogging a server
– Need to be able to scale down!
Stateful Server
• Persist player state after short inactivity
• Move player to another server after persistence
Why Stateful Server?
• 500% efficiency increase
• 60% reduction in avg latency
• Fewer game servers

• No CouchBase cluster
• Huge saving on cost
The Actor Model
An actor is the fundamental unit of computation which
embodies the 3 things
• Processing
• Storage
• Communication
that are essential to computation.
-Carl Hewitt*
* http://bit.ly/HoNHbG
The Actor Model
• Everything is an actor
• An actor has a mailbox
• When an actor receives a message it can:
– Create new actors
– Send messages to actors it has addresses for
– Designate how to handle the next message it receives
Stateful Server
• Gatekeeper
– Manages the local list of active workers
– Spawns new workers

• Worker
– Manages the states for a player
– Optimistic locking
– Persist state after period of inactivity
Stateful Server
Asynchronous

Player B

Request Handlers

Player A
Gatekeeper

S3

Worker C
Worker B

Game Server
Stateful Server
Asynchronous

Worker A

Player A
Request Handlers

Player B

ok

Gatekeeper

S3

Worker C
Worker B

Game Server
Stateful Server
Asynchronous

Worker A

Player B

Request Handlers

Player A
Gatekeeper

S3

Worker C
Worker B

Game Server
Stateful Server
Asynchronous

Worker A

Player B

Request Handlers

Player A
Gatekeeper

Worker C

Game Server

S3
Stateful Server
Asynchronous

Worker A

Player B

Request Handlers

Player A
Gatekeeper

Worker C

Game Server

S3
MailboxProcessor<Message>
Async<Message option>
switch state
Why F#?
• Time to Market
• Efficiency
• Correctness

• Complexity
Why F#?
• Agents
– No locks
– Asynchronous message passing
– Each actor is self-contained and easier to reason with

• Pattern matching
– Clear and concise way to handle all branch conditions
Why F#?
• Async Workflows
– Non-blocking IO
– Convert synchronous code into asynchronous code with
minimal code changes
– Similar to C# 5’s async-await feature, but available in F#
since 2007!
Thank You!
JackpotJoy Slots
http://apps.facebook.com/jackpotjoyslots

Bingo Lane
http://apps.facebook.com/bingolane

Here Be Monsters
http://apps.facebook.com/herebemonsters

Building a MMORPG
http://bit.ly/1hjqoL8
http://slidesha.re/18MD4XY

Google I/O 2013 – Here Be BigQuery
http://bit.ly/1fHjbce

Mais conteúdo relacionado

Mais procurados

MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by Andrew
Agate Studio
 
Using AWS, Terraform, and Ansible to Automate Splunk at Scale
Using AWS, Terraform, and Ansible to Automate Splunk at ScaleUsing AWS, Terraform, and Ansible to Automate Splunk at Scale
Using AWS, Terraform, and Ansible to Automate Splunk at Scale
Data Works MD
 

Mais procurados (17)

Build a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with AzureBuild a serverless distributed Pong game with Azure
Build a serverless distributed Pong game with Azure
 
Flask, ArcPy, and You (Mike Davlantes)
Flask, ArcPy, and You (Mike Davlantes)Flask, ArcPy, and You (Mike Davlantes)
Flask, ArcPy, and You (Mike Davlantes)
 
Mac & Oracle
Mac & OracleMac & Oracle
Mac & Oracle
 
RavenDB 4.0
RavenDB 4.0RavenDB 4.0
RavenDB 4.0
 
MMO Design Architecture by Andrew
MMO Design Architecture by AndrewMMO Design Architecture by Andrew
MMO Design Architecture by Andrew
 
Amazon API Gateway を活用したゲームサーバー構築
Amazon API Gateway を活用したゲームサーバー構築Amazon API Gateway を活用したゲームサーバー構築
Amazon API Gateway を活用したゲームサーバー構築
 
[Start] Playing
[Start] Playing[Start] Playing
[Start] Playing
 
Using AWS, Terraform, and Ansible to Automate Splunk at Scale
Using AWS, Terraform, and Ansible to Automate Splunk at ScaleUsing AWS, Terraform, and Ansible to Automate Splunk at Scale
Using AWS, Terraform, and Ansible to Automate Splunk at Scale
 
DB2 SQL-Part-1
DB2 SQL-Part-1DB2 SQL-Part-1
DB2 SQL-Part-1
 
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDBZapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
Zapping ever faster: how Zap sped up by two orders of magnitude using RavenDB
 
RDBMS & noSQL: Mixed for best performance
RDBMS & noSQL: Mixed for best performanceRDBMS & noSQL: Mixed for best performance
RDBMS & noSQL: Mixed for best performance
 
Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2Cassandra @ Sony: The good, the bad, and the ugly part 2
Cassandra @ Sony: The good, the bad, and the ugly part 2
 
Building Event Streaming Applications with Pac-Man (Ricardo Ferreira, Conflue...
Building Event Streaming Applications with Pac-Man (Ricardo Ferreira, Conflue...Building Event Streaming Applications with Pac-Man (Ricardo Ferreira, Conflue...
Building Event Streaming Applications with Pac-Man (Ricardo Ferreira, Conflue...
 
Torquebox rubyhoedown-2012
Torquebox rubyhoedown-2012Torquebox rubyhoedown-2012
Torquebox rubyhoedown-2012
 
Elk meetup
Elk meetupElk meetup
Elk meetup
 
AWS guerrilla orchestration
AWS guerrilla orchestrationAWS guerrilla orchestration
AWS guerrilla orchestration
 
Know thy cost (or where performance problems lurk)
Know thy cost (or where performance problems lurk)Know thy cost (or where performance problems lurk)
Know thy cost (or where performance problems lurk)
 

Destaque

F# in real world (LambdaCon15)
F# in real world (LambdaCon15)F# in real world (LambdaCon15)
F# in real world (LambdaCon15)
Yan Cui
 
My adventure with elm (LambdaCon15)
My adventure with elm (LambdaCon15)My adventure with elm (LambdaCon15)
My adventure with elm (LambdaCon15)
Yan Cui
 

Destaque (20)

Tour of language landscape (katsconf)
Tour of language landscape (katsconf)Tour of language landscape (katsconf)
Tour of language landscape (katsconf)
 
F# in social gaming (CodeMash 15)
F# in social gaming (CodeMash 15)F# in social gaming (CodeMash 15)
F# in social gaming (CodeMash 15)
 
F# in real world (LambdaCon15)
F# in real world (LambdaCon15)F# in real world (LambdaCon15)
F# in real world (LambdaCon15)
 
BigQuery in Social Gaming
BigQuery in Social GamingBigQuery in Social Gaming
BigQuery in Social Gaming
 
My adventure with elm (LambdaCon15)
My adventure with elm (LambdaCon15)My adventure with elm (LambdaCon15)
My adventure with elm (LambdaCon15)
 
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)
 
Tour of language landscape (code.talks)
Tour of language landscape (code.talks)Tour of language landscape (code.talks)
Tour of language landscape (code.talks)
 
F# in the real world (CodeMotion Dubai)
F# in the real world (CodeMotion Dubai)F# in the real world (CodeMotion Dubai)
F# in the real world (CodeMotion Dubai)
 
F# in the Real World (DDD EA)
F# in the Real World (DDD EA)F# in the Real World (DDD EA)
F# in the Real World (DDD EA)
 
My adventure with Elm
My adventure with ElmMy adventure with Elm
My adventure with Elm
 
Tour of language landscape
Tour of language landscapeTour of language landscape
Tour of language landscape
 
The future of paas is serverless
The future of paas is serverlessThe future of paas is serverless
The future of paas is serverless
 
Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)
 
Tame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLsTame cloud complexity with F#-powered DSLs
Tame cloud complexity with F#-powered DSLs
 
Modelling game economy with neo4j Oredev
Modelling game economy with neo4j OredevModelling game economy with neo4j Oredev
Modelling game economy with neo4j Oredev
 
Tour of language landscape
Tour of language landscapeTour of language landscape
Tour of language landscape
 
AWS Lambda from the Trenches
AWS Lambda from the TrenchesAWS Lambda from the Trenches
AWS Lambda from the Trenches
 
Modelling game economy with Neo4j
Modelling game economy with Neo4jModelling game economy with Neo4j
Modelling game economy with Neo4j
 
Build reactive systems on lambda
Build reactive systems on lambdaBuild reactive systems on lambda
Build reactive systems on lambda
 
F# in the real world (NDC)
F# in the real world (NDC)F# in the real world (NDC)
F# in the real world (NDC)
 

Semelhante a F# in the cloud

Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Ontico
 
BGF 2012 (Browsergames Forum)
BGF 2012 (Browsergames Forum)BGF 2012 (Browsergames Forum)
BGF 2012 (Browsergames Forum)
Christof Wegmann
 
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDB
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDBBusiness Track: How Criteo Scaled and Supported Massive Growth with MongoDB
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDB
MongoDB
 

Semelhante a F# in the cloud (20)

Massively Social != Massively Multiplayer
Massively Social != Massively MultiplayerMassively Social != Massively Multiplayer
Massively Social != Massively Multiplayer
 
PlayStation and Searchable Cassandra Without Solr (Dustin Pham & Alexander Fi...
PlayStation and Searchable Cassandra Without Solr (Dustin Pham & Alexander Fi...PlayStation and Searchable Cassandra Without Solr (Dustin Pham & Alexander Fi...
PlayStation and Searchable Cassandra Without Solr (Dustin Pham & Alexander Fi...
 
(GAM404) Hunting Monsters in a Low-Latency Multiplayer Game on EC2
(GAM404) Hunting Monsters in a Low-Latency Multiplayer Game on EC2(GAM404) Hunting Monsters in a Low-Latency Multiplayer Game on EC2
(GAM404) Hunting Monsters in a Low-Latency Multiplayer Game on EC2
 
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
Как сделать высоконагруженный сервис, не зная количество нагрузки / Олег Обле...
 
BGF 2012 (Browsergames Forum)
BGF 2012 (Browsergames Forum)BGF 2012 (Browsergames Forum)
BGF 2012 (Browsergames Forum)
 
PlayStation and Lucene - Indexing 1M documents per second: Presented by Alexa...
PlayStation and Lucene - Indexing 1M documents per second: Presented by Alexa...PlayStation and Lucene - Indexing 1M documents per second: Presented by Alexa...
PlayStation and Lucene - Indexing 1M documents per second: Presented by Alexa...
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander ZaitsevClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
ClickHouse in Real Life. Case Studies and Best Practices, by Alexander Zaitsev
 
AWS Summit Seoul 2015 - 일본 AWS 게임 고객사례 - Gungho, Grani, Nintendo를 중심으로
AWS Summit Seoul 2015 -  일본 AWS 게임 고객사례 - Gungho, Grani, Nintendo를 중심으로AWS Summit Seoul 2015 -  일본 AWS 게임 고객사례 - Gungho, Grani, Nintendo를 중심으로
AWS Summit Seoul 2015 - 일본 AWS 게임 고객사례 - Gungho, Grani, Nintendo를 중심으로
 
NoSQL at Gumtree
NoSQL at GumtreeNoSQL at Gumtree
NoSQL at Gumtree
 
LCA13: Jason Taylor Keynote - ARM & Disaggregated Rack - LCA13-Hong - 6 March...
LCA13: Jason Taylor Keynote - ARM & Disaggregated Rack - LCA13-Hong - 6 March...LCA13: Jason Taylor Keynote - ARM & Disaggregated Rack - LCA13-Hong - 6 March...
LCA13: Jason Taylor Keynote - ARM & Disaggregated Rack - LCA13-Hong - 6 March...
 
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
 
How Criteo Scaled and Supported Massive Growth with MongoDB (2013)
How Criteo Scaled and Supported  Massive Growth with MongoDB (2013)How Criteo Scaled and Supported  Massive Growth with MongoDB (2013)
How Criteo Scaled and Supported Massive Growth with MongoDB (2013)
 
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDB
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDBBusiness Track: How Criteo Scaled and Supported Massive Growth with MongoDB
Business Track: How Criteo Scaled and Supported Massive Growth with MongoDB
 
Suning OpenStack Cloud and Heat
Suning OpenStack Cloud and HeatSuning OpenStack Cloud and Heat
Suning OpenStack Cloud and Heat
 
Reactive Development: Commands, Actors and Events. Oh My!!
Reactive Development: Commands, Actors and Events.  Oh My!!Reactive Development: Commands, Actors and Events.  Oh My!!
Reactive Development: Commands, Actors and Events. Oh My!!
 
Inside the IT Territory game server / Mark Lokshin (IT Territory)
Inside the IT Territory game server / Mark Lokshin (IT Territory)Inside the IT Territory game server / Mark Lokshin (IT Territory)
Inside the IT Territory game server / Mark Lokshin (IT Territory)
 
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
SenchaCon 2016: How to Auto Generate a Back-end in Minutes - Per Minborg, Emi...
 
Cloud Security Monitoring and Spark Analytics
Cloud Security Monitoring and Spark AnalyticsCloud Security Monitoring and Spark Analytics
Cloud Security Monitoring and Spark Analytics
 
Getting Started with Real-time Analytics
Getting Started with Real-time AnalyticsGetting Started with Real-time Analytics
Getting Started with Real-time Analytics
 

Mais de Yan Cui

How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
Yan Cui
 

Mais de Yan Cui (20)

How to win the game of trade-offs
How to win the game of trade-offsHow to win the game of trade-offs
How to win the game of trade-offs
 
How to choose the right messaging service
How to choose the right messaging serviceHow to choose the right messaging service
How to choose the right messaging service
 
How to choose the right messaging service for your workload
How to choose the right messaging service for your workloadHow to choose the right messaging service for your workload
How to choose the right messaging service for your workload
 
Patterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdfPatterns and practices for building resilient serverless applications.pdf
Patterns and practices for building resilient serverless applications.pdf
 
Lambda and DynamoDB best practices
Lambda and DynamoDB best practicesLambda and DynamoDB best practices
Lambda and DynamoDB best practices
 
Lessons from running AppSync in prod
Lessons from running AppSync in prodLessons from running AppSync in prod
Lessons from running AppSync in prod
 
Serverless observability - a hero's perspective
Serverless observability - a hero's perspectiveServerless observability - a hero's perspective
Serverless observability - a hero's perspective
 
How to ship customer value faster with step functions
How to ship customer value faster with step functionsHow to ship customer value faster with step functions
How to ship customer value faster with step functions
 
How serverless changes the cost paradigm
How serverless changes the cost paradigmHow serverless changes the cost paradigm
How serverless changes the cost paradigm
 
Why your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSyncWhy your next serverless project should use AWS AppSync
Why your next serverless project should use AWS AppSync
 
Build social network in 4 weeks
Build social network in 4 weeksBuild social network in 4 weeks
Build social network in 4 weeks
 
Patterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applicationsPatterns and practices for building resilient serverless applications
Patterns and practices for building resilient serverless applications
 
How to bring chaos engineering to serverless
How to bring chaos engineering to serverlessHow to bring chaos engineering to serverless
How to bring chaos engineering to serverless
 
Migrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 stepsMigrating existing monolith to serverless in 8 steps
Migrating existing monolith to serverless in 8 steps
 
Building a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQLBuilding a social network in under 4 weeks with Serverless and GraphQL
Building a social network in under 4 weeks with Serverless and GraphQL
 
FinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economyFinDev as a business advantage in the post covid19 economy
FinDev as a business advantage in the post covid19 economy
 
How to improve lambda cold starts
How to improve lambda cold startsHow to improve lambda cold starts
How to improve lambda cold starts
 
What can you do with lambda in 2020
What can you do with lambda in 2020What can you do with lambda in 2020
What can you do with lambda in 2020
 
A chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage awayA chaos experiment a day, keeping the outage away
A chaos experiment a day, keeping the outage away
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Último (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

F# in the cloud

  • 1. F# in the Cloud and at Scale Yan Cui (@theburningmonk) Image by Mike Rohde
  • 2. Who is Gamesys? • Founded in 2001 • #1 in the UK • Handle $5 Billion in turnover annually • First company to launch real money gaming on Facebook • Employ 1,000 globally
  • 3.
  • 4.
  • 5.
  • 6. Running in the Cloud, at Scale • 1 Million DAU • 250 Million requests/day • 7 Billion rows of analytics events/month • 2 TB of analytics data/month
  • 7. Running in the Cloud, at Scale • 100% cloud hosted • AWS for Game services • Google App Engine for back-office services • NoSQL databases – DynamoDB, CouchBase, Redis, Neo4j, ... • Google BigQuery for analytics
  • 8. What is the Cloud? Cloud computing is an expression used to describe a variety of computing concepts that involve a large number of computers connected through a real-time communication network such as the Internet.... Such virtual servers do not physically exist and can therefore be moved around and scaled up (or down) on the fly without affecting the end user arguably, rather like a cloud. - Wikipedia
  • 9. What is the Cloud? IaaS PaaS SaaS VMs, load balancers, storage, ... Runtime, databa se, web servers, ... Virtual desktop, games, emails, ...
  • 10. Why the Cloud? • Trade capital cost with operating cost • Lower operating cost • Elastic scaling • Speed and agility • Focus on what differentiates your product • Global infrastructure for your global audience
  • 11. Why the Cloud - Scalability • Scale up • Scale out • Scale everything! – Your architecture is as scalable as its least scalable part • Scalability != simple choice of language/framework
  • 14.
  • 15. Stateful Server EC2 Elastic Load Balancer CloudFront Server A Server B ... Auto scaling Group S3
  • 16. Stateful Server • Need to ensure Server affinity – All calls need to be routed to the affined server • Need to balance load – Session lengths vary greatly – Some players are more active than others – Need to avoid hot spots • Need to avoid players hogging a server – Need to be able to scale down!
  • 17. Stateful Server • Persist player state after short inactivity • Move player to another server after persistence
  • 18. Why Stateful Server? • 500% efficiency increase • 60% reduction in avg latency • Fewer game servers • No CouchBase cluster • Huge saving on cost
  • 19. The Actor Model An actor is the fundamental unit of computation which embodies the 3 things • Processing • Storage • Communication that are essential to computation. -Carl Hewitt* * http://bit.ly/HoNHbG
  • 20. The Actor Model • Everything is an actor • An actor has a mailbox • When an actor receives a message it can: – Create new actors – Send messages to actors it has addresses for – Designate how to handle the next message it receives
  • 21. Stateful Server • Gatekeeper – Manages the local list of active workers – Spawns new workers • Worker – Manages the states for a player – Optimistic locking – Persist state after period of inactivity
  • 22. Stateful Server Asynchronous Player B Request Handlers Player A Gatekeeper S3 Worker C Worker B Game Server
  • 23. Stateful Server Asynchronous Worker A Player A Request Handlers Player B ok Gatekeeper S3 Worker C Worker B Game Server
  • 24. Stateful Server Asynchronous Worker A Player B Request Handlers Player A Gatekeeper S3 Worker C Worker B Game Server
  • 25. Stateful Server Asynchronous Worker A Player B Request Handlers Player A Gatekeeper Worker C Game Server S3
  • 26. Stateful Server Asynchronous Worker A Player B Request Handlers Player A Gatekeeper Worker C Game Server S3
  • 27.
  • 31.
  • 32.
  • 33. Why F#? • Time to Market • Efficiency • Correctness • Complexity
  • 34. Why F#? • Agents – No locks – Asynchronous message passing – Each actor is self-contained and easier to reason with • Pattern matching – Clear and concise way to handle all branch conditions
  • 35. Why F#? • Async Workflows – Non-blocking IO – Convert synchronous code into asynchronous code with minimal code changes – Similar to C# 5’s async-await feature, but available in F# since 2007!
  • 37. JackpotJoy Slots http://apps.facebook.com/jackpotjoyslots Bingo Lane http://apps.facebook.com/bingolane Here Be Monsters http://apps.facebook.com/herebemonsters Building a MMORPG http://bit.ly/1hjqoL8 http://slidesha.re/18MD4XY Google I/O 2013 – Here Be BigQuery http://bit.ly/1fHjbce

Notas do Editor

  1. Lowers the cost of failure
  2. The biggest advantage of programming with the Actor model, for me, is the fact that each actor is self-contained and implements an explicit protocol, hence making them very easy to reason with and often it’s possible to look at the code and know that there’s obviously no defect rather than no obvious defect, and that distinction is important.The only operation with the inbox which requires synchronization (as far as I know) is with selective receive using inbox.Scan, otherwise, it’s inherently single-threaded inside the body of an agent (a property of the Actor model).