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

Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Delhi Call girls
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.CarlotaBedoya1
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Sheetaleventcompany
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
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
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
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
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 

Recently uploaded (20)

Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
Best VIP Call Girls Noida Sector 75 Call Me: 8448380779
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
 
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
Call Girls Service Chandigarh Lucky ❤️ 7710465962 Independent Call Girls In C...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
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
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
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
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
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$
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 

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