SlideShare a Scribd company logo
1 of 31
Everything I Learned About
Scaling Online Games I
Learned at Google and
eBay
Randy Shoup
@randyshoup
linkedin.com/in/randyshoup
Background
CTO at KIXEYE
• Real-time strategy games for web and mobile
Director of Engineering for Google App
Engine
• World’s largest Platform-as-a-Service
Chief Engineer at eBay
• Multiple generations of eBay’s real-time
search infrastructure
Real-Time Strategy Games are
… • Real-time
• Spiky
• Computationally-
intensive
• Constantly evolving
• Constantly pushing
boundaries
 Technically and
operationally demanding
How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
Embrace Open Source
Try someone else’s code first
• Faster to get started, lower development cost
• Open source projects are often higher quality,
more extensible, better tested
• Take advantage of talent outside your company
Avoid “Not-Invented-Here” Attitude
• (-) Google and eBay “exceptionalism”
• Default has been to write it in-house instead of
reuse and contribute
Embrace Standard Data
Formats
Use standard formats
• Well-tested and widely-used
• Internationalization from the beginning
Time in UTC
• (-) eBay and Google use local US-Pacific time

Embrace Standard Data
Formats
Character set in UTF-8
• (-) 5+ years to convert eBay site from ISO-
8859-1 (Western European only) to Unicode

Structured data format
• Explicit structure with associated schema
• (+) Google uses protocol buffers for schema,
serialization, storage
Development Discipline
Quality, Reliability, Scalability are “Priority-0
features”
• Equally important to users as product features
and engaging user experience
Developers responsible for
• Features
• Quality
• Performance
• Reliability
• Manageability
Development Discipline
Developers write tests and code together
• Continuous testing of features, performance, load
• Confidence to make risky changes
• Catch bugs earlier, fail faster
“Don’t have time to do it right” ?
• WRONG  – Don’t have time to do it twice (!)
• The more constrained you are on time and
resources, the more important it is to do it solidly
the first time
How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
Layering
Multiple layers
• Client
• Game server
• Services
• Persistence
Game
client
Game
server
Services
Persistence
Micro-Services
Simple
Well-defined interface
Single-purpose
Modular and independent
Small teams
Autonomy and responsibility
A
C D E
B
Google Cloud Datastore
Cloud Datastore: NoSQL service
• Highly scalable and resilient
• Strong transactional consistency
• SQL-like rich query capabilities
Megastore: geo-scale structured database
• Multi-row transactions
• Synchronous cross-datacenter replication
Bigtable: cluster-level structured storage
• (row, column, timestamp) -> cell contents
Colossus: next-generation clustered file
system
• Block distribution and replication
Cluster management infrastructure
• Task scheduling, machine assignment
Cloud
Datastore
Megastore
Bigtable
Colossus
Cluster
manager
Reactive Servers
Minimize request latency
• Respond as rapidly as possible to client
Functional Reactive + Actor model
• Highly asynchronous, never block (!)
• Queue events / messages for complex work
• Heavy use of Scala / Akka and RxJava at
KIXEYE
• (-) eBay uses highly synchronous model
• (-) Google uses complicated callback-based
asynchronous model
Client Liveness
Default to background processing
• Refresh assets
• Save client state
Client continues seamlessly if disconnected
• Parallel simulation on client and server
• Gameplay more important than constant
synchronization
How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
Scalability and Performance
Measure, Measure, Measure
• Instrument everything: client, services, network,
DB
• Measurement beats intuition every time
• My own intuition is usually wrong 
Attack the first bottleneck
• Theory of Constraints: attacking *any* other
problem does not improve throughput of the
system
Repeat until performance is good enough
• “When you solve problem one, problem two gets
a promotion”
Small Details Matter
In the very large, the very small matters a
*lot*
• Subatomic physics and cosmology are inter-
related
• Particles and forces at the subatomic level
controlled formation and evolution of the
entire universe
Discipline is deciding *which* details matter
(!)
eBay Search Index
Compression
Search Engine constrained by index size
• Smaller index size reduces memory, CPU, I/O
• Smaller index means fewer nodes, fewer shards
Inverted Index
• “Posting List”: all occurrences of [term] in documents
• Monotonically-increasing series of integers, traversed
in order
 Delta compression + Variable-byte encoding
• Store deltas, not absolute numbers
• Encode deltas so smaller numbers use fewer bits
TOME Combat Server
Scalability limits in TOME combat server
• Unable to push single server beyond several
hundred simultaneous players
• All system and OS-level measurements OK
• CPU, memory usage, I/O, threads, locking
• Needed to use CPU-level analyzer (Intel VTune)
Bottleneck: memory cache contention
• Multiple cores contending on L2 cache memory
• 40% scalability increase from six characters …
• static Foo;  const static Foo;
Measurement and Distributions
• Applies only to
quantities constrained
on both sides, clustered
around a mean
• E.g., adult height and
weight
• Applies only to near-
homogeneous
populations
• E.g., adult male height in
North America, vs.
female, vs. China, etc.
Gaussian (“Normal”) distribution is *not*
normal
Measurement and Distributions
Power Law (“Long Tail”) distribution *much*
more common
• Latency and performance measurements
• Popularity, income, human connections, etc.
• Minimum is 0; maximum is infinite
• The more you have, the more you get
Measurement and Distributions
Mean and Standard Deviation often misleading
• Encourages you to remove outliers, even though
outliers represent the real problems (!)
• Encourages you to concentrate on the average
case, not the worst case
• “Mean is meaningless” 
 Use percentiles instead (!)
• Can reasonably characterize any distribution
• Measure 90%ile, 99%ile, 99.9%ile
• Highlight and focus on the *real* problems
How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
Automate Everything
Humans are always at a premium
• Humans are too valuable for repetitive tasks
• Machines will happily do things over and over
Automated operations
• Provisioning
• Deployment
• Alerting
• Self-healing
Autoscaling
Games are very spiky
• Very unpredictable
• Huge variability between peak and trough
• Hits are self-reinforcing
Services and clients have to “flex”
• Clients back off in response to latency
• Services grow / shrink based on load
App Engine Autoscaling
Autoscaling as part of the Platform
• Gracefully handle spiky application load
• Maximize utilization of the infrastructure
World-class application scheduler
• Consider request rate, processing time, max wait time
• Also instance startup time, application budget
• Predictive model pre-provisions and proactively
scales
• Reactive autoscaling in response to load
• Instantaneous autoscaling on request: spin up new
instance(s) *while a request is coming in*
Google and DevOps
Ops Support is a privilege, not a right
• Developers carry pager for first 6+ months
• Service “graduates” to SRE after intensive review
of monitoring, reliability, resilience, etc.
• SRE collaborates with service to move forward
Everyone’s incentives are aligned
• Everyone is responsible for production
• Everyone strongly motivated to have solid
instrumentation and monitoring
Recap: How to Scale
Scaling Code
Scaling Infrastructure
Scaling Performance
Scaling DevOps
Thank you!
rshoup@kixeye.com
@randyshoup
linkedin.com/in/randyshoup

More Related Content

More from Randy Shoup

Breaking Codes, Designing Jets, and Building Teams
Breaking Codes, Designing Jets, and Building TeamsBreaking Codes, Designing Jets, and Building Teams
Breaking Codes, Designing Jets, and Building TeamsRandy Shoup
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsRandy Shoup
 
Learning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three IncidentsLearning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three IncidentsRandy Shoup
 
Minimum Viable Architecture - Good Enough is Good Enough
Minimum Viable Architecture - Good Enough is Good EnoughMinimum Viable Architecture - Good Enough is Good Enough
Minimum Viable Architecture - Good Enough is Good EnoughRandy Shoup
 
Managing Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and EventsManaging Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and EventsRandy Shoup
 
Service Architectures at Scale
Service Architectures at ScaleService Architectures at Scale
Service Architectures at ScaleRandy Shoup
 
Monoliths, Migrations, and Microservices
Monoliths, Migrations, and MicroservicesMonoliths, Migrations, and Microservices
Monoliths, Migrations, and MicroservicesRandy Shoup
 
Evolving Architecture and Organization - Lessons from Google and eBay
Evolving Architecture and Organization - Lessons from Google and eBayEvolving Architecture and Organization - Lessons from Google and eBay
Evolving Architecture and Organization - Lessons from Google and eBayRandy Shoup
 
Moving Fast At Scale
Moving Fast At ScaleMoving Fast At Scale
Moving Fast At ScaleRandy Shoup
 
DevOps - It's About How We Work
DevOps - It's About How We WorkDevOps - It's About How We Work
DevOps - It's About How We WorkRandy Shoup
 
Ten Lessons of the DevOps Transition
Ten Lessons of the DevOps TransitionTen Lessons of the DevOps Transition
Ten Lessons of the DevOps TransitionRandy Shoup
 
Managing Data in Microservices
Managing Data in MicroservicesManaging Data in Microservices
Managing Data in MicroservicesRandy Shoup
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldRandy Shoup
 
Pragmatic Microservices
Pragmatic MicroservicesPragmatic Microservices
Pragmatic MicroservicesRandy Shoup
 
A CTO's Guide to Scaling Organizations
A CTO's Guide to Scaling OrganizationsA CTO's Guide to Scaling Organizations
A CTO's Guide to Scaling OrganizationsRandy Shoup
 
From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015Randy Shoup
 
Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015Randy Shoup
 
Concurrency at Scale: Evolution to Micro-Services
Concurrency at Scale:  Evolution to Micro-ServicesConcurrency at Scale:  Evolution to Micro-Services
Concurrency at Scale: Evolution to Micro-ServicesRandy Shoup
 
Minimum Viable Architecture -- Good Enough is Good Enough in a Startup
Minimum Viable Architecture -- Good Enough is Good Enough in a StartupMinimum Viable Architecture -- Good Enough is Good Enough in a Startup
Minimum Viable Architecture -- Good Enough is Good Enough in a StartupRandy Shoup
 
Why Enterprises Are Embracing the Cloud
Why Enterprises Are Embracing the CloudWhy Enterprises Are Embracing the Cloud
Why Enterprises Are Embracing the CloudRandy Shoup
 

More from Randy Shoup (20)

Breaking Codes, Designing Jets, and Building Teams
Breaking Codes, Designing Jets, and Building TeamsBreaking Codes, Designing Jets, and Building Teams
Breaking Codes, Designing Jets, and Building Teams
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and Events
 
Learning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three IncidentsLearning from Learnings: Anatomy of Three Incidents
Learning from Learnings: Anatomy of Three Incidents
 
Minimum Viable Architecture - Good Enough is Good Enough
Minimum Viable Architecture - Good Enough is Good EnoughMinimum Viable Architecture - Good Enough is Good Enough
Minimum Viable Architecture - Good Enough is Good Enough
 
Managing Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and EventsManaging Data at Scale - Microservices and Events
Managing Data at Scale - Microservices and Events
 
Service Architectures at Scale
Service Architectures at ScaleService Architectures at Scale
Service Architectures at Scale
 
Monoliths, Migrations, and Microservices
Monoliths, Migrations, and MicroservicesMonoliths, Migrations, and Microservices
Monoliths, Migrations, and Microservices
 
Evolving Architecture and Organization - Lessons from Google and eBay
Evolving Architecture and Organization - Lessons from Google and eBayEvolving Architecture and Organization - Lessons from Google and eBay
Evolving Architecture and Organization - Lessons from Google and eBay
 
Moving Fast At Scale
Moving Fast At ScaleMoving Fast At Scale
Moving Fast At Scale
 
DevOps - It's About How We Work
DevOps - It's About How We WorkDevOps - It's About How We Work
DevOps - It's About How We Work
 
Ten Lessons of the DevOps Transition
Ten Lessons of the DevOps TransitionTen Lessons of the DevOps Transition
Ten Lessons of the DevOps Transition
 
Managing Data in Microservices
Managing Data in MicroservicesManaging Data in Microservices
Managing Data in Microservices
 
Effective Microservices In a Data-centric World
Effective Microservices In a Data-centric WorldEffective Microservices In a Data-centric World
Effective Microservices In a Data-centric World
 
Pragmatic Microservices
Pragmatic MicroservicesPragmatic Microservices
Pragmatic Microservices
 
A CTO's Guide to Scaling Organizations
A CTO's Guide to Scaling OrganizationsA CTO's Guide to Scaling Organizations
A CTO's Guide to Scaling Organizations
 
From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015From the Monolith to Microservices - CraftConf 2015
From the Monolith to Microservices - CraftConf 2015
 
Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015Service Architectures At Scale - QCon London 2015
Service Architectures At Scale - QCon London 2015
 
Concurrency at Scale: Evolution to Micro-Services
Concurrency at Scale:  Evolution to Micro-ServicesConcurrency at Scale:  Evolution to Micro-Services
Concurrency at Scale: Evolution to Micro-Services
 
Minimum Viable Architecture -- Good Enough is Good Enough in a Startup
Minimum Viable Architecture -- Good Enough is Good Enough in a StartupMinimum Viable Architecture -- Good Enough is Good Enough in a Startup
Minimum Viable Architecture -- Good Enough is Good Enough in a Startup
 
Why Enterprises Are Embracing the Cloud
Why Enterprises Are Embracing the CloudWhy Enterprises Are Embracing the Cloud
Why Enterprises Are Embracing the Cloud
 

Recently uploaded

Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxellan12
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirtrahman018755
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersDamian Radcliffe
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...aditipandeya
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 

Recently uploaded (20)

Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya ShirtChallengers I Told Ya Shirt
Challengers I Told Ya ShirtChallengers I Told Ya Shirt
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
VIP 7001035870 Find & Meet Hyderabad Call Girls Dilsukhnagar high-profile Cal...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 

Everything I Learned About Scaling Online Games I Learned at Google and eBay [Part 2, QConBeijing 2014]

  • 1. Everything I Learned About Scaling Online Games I Learned at Google and eBay Randy Shoup @randyshoup linkedin.com/in/randyshoup
  • 2. Background CTO at KIXEYE • Real-time strategy games for web and mobile Director of Engineering for Google App Engine • World’s largest Platform-as-a-Service Chief Engineer at eBay • Multiple generations of eBay’s real-time search infrastructure
  • 3. Real-Time Strategy Games are … • Real-time • Spiky • Computationally- intensive • Constantly evolving • Constantly pushing boundaries  Technically and operationally demanding
  • 4. How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps
  • 5. How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps
  • 6. Embrace Open Source Try someone else’s code first • Faster to get started, lower development cost • Open source projects are often higher quality, more extensible, better tested • Take advantage of talent outside your company Avoid “Not-Invented-Here” Attitude • (-) Google and eBay “exceptionalism” • Default has been to write it in-house instead of reuse and contribute
  • 7. Embrace Standard Data Formats Use standard formats • Well-tested and widely-used • Internationalization from the beginning Time in UTC • (-) eBay and Google use local US-Pacific time 
  • 8. Embrace Standard Data Formats Character set in UTF-8 • (-) 5+ years to convert eBay site from ISO- 8859-1 (Western European only) to Unicode  Structured data format • Explicit structure with associated schema • (+) Google uses protocol buffers for schema, serialization, storage
  • 9. Development Discipline Quality, Reliability, Scalability are “Priority-0 features” • Equally important to users as product features and engaging user experience Developers responsible for • Features • Quality • Performance • Reliability • Manageability
  • 10. Development Discipline Developers write tests and code together • Continuous testing of features, performance, load • Confidence to make risky changes • Catch bugs earlier, fail faster “Don’t have time to do it right” ? • WRONG  – Don’t have time to do it twice (!) • The more constrained you are on time and resources, the more important it is to do it solidly the first time
  • 11. How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps
  • 12. Layering Multiple layers • Client • Game server • Services • Persistence Game client Game server Services Persistence
  • 13. Micro-Services Simple Well-defined interface Single-purpose Modular and independent Small teams Autonomy and responsibility A C D E B
  • 14. Google Cloud Datastore Cloud Datastore: NoSQL service • Highly scalable and resilient • Strong transactional consistency • SQL-like rich query capabilities Megastore: geo-scale structured database • Multi-row transactions • Synchronous cross-datacenter replication Bigtable: cluster-level structured storage • (row, column, timestamp) -> cell contents Colossus: next-generation clustered file system • Block distribution and replication Cluster management infrastructure • Task scheduling, machine assignment Cloud Datastore Megastore Bigtable Colossus Cluster manager
  • 15. Reactive Servers Minimize request latency • Respond as rapidly as possible to client Functional Reactive + Actor model • Highly asynchronous, never block (!) • Queue events / messages for complex work • Heavy use of Scala / Akka and RxJava at KIXEYE • (-) eBay uses highly synchronous model • (-) Google uses complicated callback-based asynchronous model
  • 16. Client Liveness Default to background processing • Refresh assets • Save client state Client continues seamlessly if disconnected • Parallel simulation on client and server • Gameplay more important than constant synchronization
  • 17. How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps
  • 18. Scalability and Performance Measure, Measure, Measure • Instrument everything: client, services, network, DB • Measurement beats intuition every time • My own intuition is usually wrong  Attack the first bottleneck • Theory of Constraints: attacking *any* other problem does not improve throughput of the system Repeat until performance is good enough • “When you solve problem one, problem two gets a promotion”
  • 19. Small Details Matter In the very large, the very small matters a *lot* • Subatomic physics and cosmology are inter- related • Particles and forces at the subatomic level controlled formation and evolution of the entire universe Discipline is deciding *which* details matter (!)
  • 20. eBay Search Index Compression Search Engine constrained by index size • Smaller index size reduces memory, CPU, I/O • Smaller index means fewer nodes, fewer shards Inverted Index • “Posting List”: all occurrences of [term] in documents • Monotonically-increasing series of integers, traversed in order  Delta compression + Variable-byte encoding • Store deltas, not absolute numbers • Encode deltas so smaller numbers use fewer bits
  • 21. TOME Combat Server Scalability limits in TOME combat server • Unable to push single server beyond several hundred simultaneous players • All system and OS-level measurements OK • CPU, memory usage, I/O, threads, locking • Needed to use CPU-level analyzer (Intel VTune) Bottleneck: memory cache contention • Multiple cores contending on L2 cache memory • 40% scalability increase from six characters … • static Foo;  const static Foo;
  • 22. Measurement and Distributions • Applies only to quantities constrained on both sides, clustered around a mean • E.g., adult height and weight • Applies only to near- homogeneous populations • E.g., adult male height in North America, vs. female, vs. China, etc. Gaussian (“Normal”) distribution is *not* normal
  • 23. Measurement and Distributions Power Law (“Long Tail”) distribution *much* more common • Latency and performance measurements • Popularity, income, human connections, etc. • Minimum is 0; maximum is infinite • The more you have, the more you get
  • 24. Measurement and Distributions Mean and Standard Deviation often misleading • Encourages you to remove outliers, even though outliers represent the real problems (!) • Encourages you to concentrate on the average case, not the worst case • “Mean is meaningless”   Use percentiles instead (!) • Can reasonably characterize any distribution • Measure 90%ile, 99%ile, 99.9%ile • Highlight and focus on the *real* problems
  • 25. How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps
  • 26. Automate Everything Humans are always at a premium • Humans are too valuable for repetitive tasks • Machines will happily do things over and over Automated operations • Provisioning • Deployment • Alerting • Self-healing
  • 27. Autoscaling Games are very spiky • Very unpredictable • Huge variability between peak and trough • Hits are self-reinforcing Services and clients have to “flex” • Clients back off in response to latency • Services grow / shrink based on load
  • 28. App Engine Autoscaling Autoscaling as part of the Platform • Gracefully handle spiky application load • Maximize utilization of the infrastructure World-class application scheduler • Consider request rate, processing time, max wait time • Also instance startup time, application budget • Predictive model pre-provisions and proactively scales • Reactive autoscaling in response to load • Instantaneous autoscaling on request: spin up new instance(s) *while a request is coming in*
  • 29. Google and DevOps Ops Support is a privilege, not a right • Developers carry pager for first 6+ months • Service “graduates” to SRE after intensive review of monitoring, reliability, resilience, etc. • SRE collaborates with service to move forward Everyone’s incentives are aligned • Everyone is responsible for production • Everyone strongly motivated to have solid instrumentation and monitoring
  • 30. Recap: How to Scale Scaling Code Scaling Infrastructure Scaling Performance Scaling DevOps