SlideShare une entreprise Scribd logo
1  sur  16
Télécharger pour lire hors ligne
Extensions Developer Services Team
@MovingViolation
Karl Patrick

Senior Backend
Software Engineer
Extension Design Patterns for Twitch Scale
TwitchCon 2018 San Jose, California
@XPCagey
15 years of experience prior to Twitch
Single person hobby projects to AAA titles
Build/Tools/Engine/Server/Gameplay
Karl Patrick

Game Developer
TwitchCon 2018 San Jose, California
Extensions
Usually Fail to Scale
-Popular technologies don’t work for
high-volume channels
-False starts with high-profile
Extensions inspired this talk
-High concurrent users is only part of
the story
TWITCH SCALE
TwitchCon 2018 San Jose, California
- When a streamer activates
Extensions during a stream
- When a channel is “raided” by
another audience
- When viewers refresh due to a
technical issue
Traffic Spikes

10,000x traffic in
One Second
WHAT’S THE BIG DEAL?
~20 viewers / 10 seconds
40,000 viewers / 10 seconds
TwitchCon 2018 San Jose, California
How can Extensions
Scale for Traffic
Bursts?
TwitchCon 2018 San Jose, California
Server
TwitchCon 2018 San Jose, CaliforniaTwitchCon 2018 San Jose, California
Server Twitch
PubSub
Call Twitch PubSub from
your service to push events
instead of polling for
updates.
If you need to whisper
secrets, shout the list of
people who need to ask for
them instead of having
every user ask.
Use a
Megaphone
SCALING READS
TwitchCon 2018 San Jose, California
Be Lazy:
Wait Before You
Ask for Data
- Use a splash screen when you first
load your Extension
- Schedule your requests after a pause
- Cancel the request if it is answered
while you’re waiting
SCALING READS
Document
loads
Schedule
request
PubSub sent
before timer
expires?
Cancel
request
Send
request
Yes
No
TwitchCon 2018 San Jose, California
Roll the Dice:

Randomize Your
Wait Time
SCALING READS
- Make each client pick a number
instead of using one delay
- “Jitter” will spread out traffic if
clients load at the same time
Spread out work with a
random delay
All requests at one time
TwitchCon 2018 San Jose, California
- Tell clients how long they can wait to
respond
- Roll the dice on each client and cancel
if the response comes while waiting
- On each client request, add more wait
time to the next response
- Larger audiences automatically get
longer waits and lower traffic per
viewer
Listen to Yourself:
Send Wait Times
From the Server
SCALING READS
Server
Send time
remaining
Use time to decide
when to send
Add time on
every request
PubSub
TwitchCon 2018 San Jose, California
Green
Purple
Orange
Blue
What’s your favorite color?
What About
Interactive
Extensions?
TwitchCon 2018 San Jose, California
- Authorize requests and use cool
downs to prevent spam
- Popular Extensions have seen
attempts to spam within 20 minutes
of release
- Chrome developer tools make it
simple to repeat service requests
Stop Cheaters
SCALING WRITES
!
TwitchCon 2018 San Jose, California
- Be lazy and roll the dice to spread
write traffic; listen to yourself to
make sure you answer in time
- Predict and apply fake responses
while you’re waiting
- Once you have a real response,
replace the fake one
Start Cheating:
Fake Early Responses
SCALING WRITES
User
Clicks
Schedule & Send
Request
Service Calculates
Result
PubSub Message
Arrives
Show
Result
TwitchCon 2018 San Jose, California
Take Command:
Batch Frequent
Requests
SCALING WRITES
How can Extensions Scale for Traffic Bursts?
- Use a Megaphone
- Listen to Yourself
- Be Lazy
- Roll the Dice
- Stop Cheaters
- Start Cheating
- Take Command
Questions?

Contenu connexe

Similaire à Extension Design Patterns for Twitch Scale

Similaire à Extension Design Patterns for Twitch Scale (20)

Monetize Your Extension a Bit at a Time
Monetize Your Extension a Bit at a TimeMonetize Your Extension a Bit at a Time
Monetize Your Extension a Bit at a Time
 
QConSF 2014 - How we learned to stop worrying and start deploying the Netflix...
QConSF 2014 - How we learned to stop worrying and start deploying the Netflix...QConSF 2014 - How we learned to stop worrying and start deploying the Netflix...
QConSF 2014 - How we learned to stop worrying and start deploying the Netflix...
 
Rapid Prototyping Twitch Extensions: Five Lessons Learned
Rapid Prototyping Twitch Extensions: Five Lessons LearnedRapid Prototyping Twitch Extensions: Five Lessons Learned
Rapid Prototyping Twitch Extensions: Five Lessons Learned
 
Intensive Workshop:Building Apps -Idea to Release- for Non-Techie Entrepreneurs
Intensive Workshop:Building Apps -Idea to Release- for Non-Techie EntrepreneursIntensive Workshop:Building Apps -Idea to Release- for Non-Techie Entrepreneurs
Intensive Workshop:Building Apps -Idea to Release- for Non-Techie Entrepreneurs
 
APIs
APIsAPIs
APIs
 
Inside mind of a successful platform architect / Gartner APPS 2016
Inside mind of a successful platform architect / Gartner APPS 2016 Inside mind of a successful platform architect / Gartner APPS 2016
Inside mind of a successful platform architect / Gartner APPS 2016
 
txtWeb
txtWebtxtWeb
txtWeb
 
Copy of All AbouHow To Create A Streaming App Like Netflix: An Emerging Trend...
Copy of All AbouHow To Create A Streaming App Like Netflix: An Emerging Trend...Copy of All AbouHow To Create A Streaming App Like Netflix: An Emerging Trend...
Copy of All AbouHow To Create A Streaming App Like Netflix: An Emerging Trend...
 
Metrics & Challenges for Testing Streaming Applications in 2019
Metrics & Challenges for Testing Streaming Applications in 2019Metrics & Challenges for Testing Streaming Applications in 2019
Metrics & Challenges for Testing Streaming Applications in 2019
 
Scaling the Netflix API
Scaling the Netflix APIScaling the Netflix API
Scaling the Netflix API
 
Have Your Cake and Eat It Too -- Further Dispelling the Myths of the Lambda A...
Have Your Cake and Eat It Too -- Further Dispelling the Myths of the Lambda A...Have Your Cake and Eat It Too -- Further Dispelling the Myths of the Lambda A...
Have Your Cake and Eat It Too -- Further Dispelling the Myths of the Lambda A...
 
2018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 2
2018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 22018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 2
2018-01 Seattle Apache Flink Meetup at OfferUp, Opening Remarks and Talk 2
 
Build an Application from Idea to Release
Build an Application from Idea to ReleaseBuild an Application from Idea to Release
Build an Application from Idea to Release
 
ShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for AppsShepHertz Cloud Ecosystem for Apps
ShepHertz Cloud Ecosystem for Apps
 
Market Testing, The Agile Way
Market Testing, The Agile WayMarket Testing, The Agile Way
Market Testing, The Agile Way
 
Redesigning the Netflix API - OSCON
Redesigning the Netflix API - OSCONRedesigning the Netflix API - OSCON
Redesigning the Netflix API - OSCON
 
API - Application Programming Interfaces FUEL Conference 2008
API - Application Programming Interfaces FUEL Conference 2008API - Application Programming Interfaces FUEL Conference 2008
API - Application Programming Interfaces FUEL Conference 2008
 
Operational Visibility at Global Scale
Operational Visibility at Global ScaleOperational Visibility at Global Scale
Operational Visibility at Global Scale
 
How to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - EnglishHow to be Successful with Responsive Sites (Koombea & NGINX) - English
How to be Successful with Responsive Sites (Koombea & NGINX) - English
 
Solving HTTP Problems with Code and Protocols
Solving HTTP Problems with Code and ProtocolsSolving HTTP Problems with Code and Protocols
Solving HTTP Problems with Code and Protocols
 

Plus de Twitch Developers

Plus de Twitch Developers (20)

Embracing the Hobbyist Persona
Embracing the Hobbyist PersonaEmbracing the Hobbyist Persona
Embracing the Hobbyist Persona
 
Using Insights to Build Better Products and Grow on Twitch
Using Insights to Build Better Products and Grow on TwitchUsing Insights to Build Better Products and Grow on Twitch
Using Insights to Build Better Products and Grow on Twitch
 
Twitch for Game Developers
Twitch for Game DevelopersTwitch for Game Developers
Twitch for Game Developers
 
TwitchCon Developer Day Keynote
TwitchCon Developer Day KeynoteTwitchCon Developer Day Keynote
TwitchCon Developer Day Keynote
 
Twitch Extensions 101
Twitch Extensions 101Twitch Extensions 101
Twitch Extensions 101
 
Twitch Extension Review Process: The Missing Manual
Twitch Extension Review Process: The Missing ManualTwitch Extension Review Process: The Missing Manual
Twitch Extension Review Process: The Missing Manual
 
Making Your Game a Success With Twitch
Making Your Game a Success With TwitchMaking Your Game a Success With Twitch
Making Your Game a Success With Twitch
 
Twitch Developer Tour
Twitch Developer Tour Twitch Developer Tour
Twitch Developer Tour
 
How Streaming is Changing the Way We Play
How Streaming is Changing the Way We PlayHow Streaming is Changing the Way We Play
How Streaming is Changing the Way We Play
 
Twitch Insights: Player Research and Interaction
Twitch Insights: Player Research and InteractionTwitch Insights: Player Research and Interaction
Twitch Insights: Player Research and Interaction
 
Twitch + Games
Twitch + GamesTwitch + Games
Twitch + Games
 
Using Twitch Drops to Promote Viewer Engagement
Using Twitch Drops to Promote Viewer Engagement Using Twitch Drops to Promote Viewer Engagement
Using Twitch Drops to Promote Viewer Engagement
 
Twitch Extensions: Live Apps for Live Streams
Twitch Extensions: Live Apps for Live StreamsTwitch Extensions: Live Apps for Live Streams
Twitch Extensions: Live Apps for Live Streams
 
Making Twitch Interactive with Twitch Extensions
Making Twitch Interactive with Twitch ExtensionsMaking Twitch Interactive with Twitch Extensions
Making Twitch Interactive with Twitch Extensions
 
Improving Game Performance and Streaming with Twitch Insights
Improving Game Performance and Streaming with Twitch Insights Improving Game Performance and Streaming with Twitch Insights
Improving Game Performance and Streaming with Twitch Insights
 
Engaging Your Community with Twitch
Engaging Your Community with TwitchEngaging Your Community with Twitch
Engaging Your Community with Twitch
 
Empowering Extensions with Game APIs
Empowering Extensions with Game APIsEmpowering Extensions with Game APIs
Empowering Extensions with Game APIs
 
Empowering Content Creators to Promote Your Game
Empowering Content Creators to Promote Your GameEmpowering Content Creators to Promote Your Game
Empowering Content Creators to Promote Your Game
 
Accelerating Development of Twitch Extensions for Your Game
Accelerating Development of Twitch Extensions for Your GameAccelerating Development of Twitch Extensions for Your Game
Accelerating Development of Twitch Extensions for Your Game
 
Keynote - TwitchCon Developer Day 2017
Keynote - TwitchCon Developer Day 2017Keynote - TwitchCon Developer Day 2017
Keynote - TwitchCon Developer Day 2017
 

Dernier

Dernier (20)

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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Extension Design Patterns for Twitch Scale

  • 1. Extensions Developer Services Team @MovingViolation Karl Patrick
 Senior Backend Software Engineer
  • 2. Extension Design Patterns for Twitch Scale
  • 3. TwitchCon 2018 San Jose, California @XPCagey 15 years of experience prior to Twitch Single person hobby projects to AAA titles Build/Tools/Engine/Server/Gameplay Karl Patrick
 Game Developer
  • 4. TwitchCon 2018 San Jose, California Extensions Usually Fail to Scale -Popular technologies don’t work for high-volume channels -False starts with high-profile Extensions inspired this talk -High concurrent users is only part of the story TWITCH SCALE
  • 5. TwitchCon 2018 San Jose, California - When a streamer activates Extensions during a stream - When a channel is “raided” by another audience - When viewers refresh due to a technical issue Traffic Spikes
 10,000x traffic in One Second WHAT’S THE BIG DEAL? ~20 viewers / 10 seconds 40,000 viewers / 10 seconds
  • 6. TwitchCon 2018 San Jose, California How can Extensions Scale for Traffic Bursts? TwitchCon 2018 San Jose, California Server
  • 7. TwitchCon 2018 San Jose, CaliforniaTwitchCon 2018 San Jose, California Server Twitch PubSub Call Twitch PubSub from your service to push events instead of polling for updates. If you need to whisper secrets, shout the list of people who need to ask for them instead of having every user ask. Use a Megaphone SCALING READS
  • 8. TwitchCon 2018 San Jose, California Be Lazy: Wait Before You Ask for Data - Use a splash screen when you first load your Extension - Schedule your requests after a pause - Cancel the request if it is answered while you’re waiting SCALING READS Document loads Schedule request PubSub sent before timer expires? Cancel request Send request Yes No
  • 9. TwitchCon 2018 San Jose, California Roll the Dice:
 Randomize Your Wait Time SCALING READS - Make each client pick a number instead of using one delay - “Jitter” will spread out traffic if clients load at the same time Spread out work with a random delay All requests at one time
  • 10. TwitchCon 2018 San Jose, California - Tell clients how long they can wait to respond - Roll the dice on each client and cancel if the response comes while waiting - On each client request, add more wait time to the next response - Larger audiences automatically get longer waits and lower traffic per viewer Listen to Yourself: Send Wait Times From the Server SCALING READS Server Send time remaining Use time to decide when to send Add time on every request PubSub
  • 11. TwitchCon 2018 San Jose, California Green Purple Orange Blue What’s your favorite color? What About Interactive Extensions?
  • 12. TwitchCon 2018 San Jose, California - Authorize requests and use cool downs to prevent spam - Popular Extensions have seen attempts to spam within 20 minutes of release - Chrome developer tools make it simple to repeat service requests Stop Cheaters SCALING WRITES !
  • 13. TwitchCon 2018 San Jose, California - Be lazy and roll the dice to spread write traffic; listen to yourself to make sure you answer in time - Predict and apply fake responses while you’re waiting - Once you have a real response, replace the fake one Start Cheating: Fake Early Responses SCALING WRITES User Clicks Schedule & Send Request Service Calculates Result PubSub Message Arrives Show Result
  • 14. TwitchCon 2018 San Jose, California Take Command: Batch Frequent Requests SCALING WRITES
  • 15. How can Extensions Scale for Traffic Bursts? - Use a Megaphone - Listen to Yourself - Be Lazy - Roll the Dice - Stop Cheaters - Start Cheating - Take Command