SlideShare a Scribd company logo
1 of 19
Code Driven – Building A UDP Protocol For Cloud
Gaming
@ParsecTeam
Parsec.tv
PC GAMING IS EXPENSIVE, COMPLICATED, & RESTRICTIVE
PC gaming requires upfront investments, hardware knowledge to get started, and ties the gamer to
a desktop PC. This restricts the market for PC gaming and forces difficult decisions about investing
in hardware when we all just want to play our favorite games.
@ParsecTeam
PARSEC GIVES YOUACCESS TO GAMING MACHINES
Bring your gaming machine wherever you go with Parsec or access a gaming PC in the cloud.
@ParsecTeam
DELIVERING THE LOWEST LATENCY POSSIBLE
Capturing
Encoding
NetworkingDecoding
Rendering
Capturing
• Low latency desktop capture with zero-copy GPU pipeline to encoder
Encoding
• All hardware-specific encoding libraries implemented directly on
Windows (AMD, Intel, and NVIDIA) with library specific optimizations
Networking
• Low latency proprietary UDP protocol
• Ultra-responsive dynamic bitrate adjustment
• DTLS 1.2 with AES128 or AES256 cipher
• Secure per-connection tokens signed and authenticated with Parsec
• NAT traversal using UDP hole punching for peer-to-peer use cases
Decoding
• All hardware-specific decoding libraries implemented directly on Windows
(AMD, Intel, and NVIDIA) with library specific optimizations
• Hardware decoding on macOS
• Hardware decoding on Raspberry Pi via OpenMaxIL
• Hardware decoding on Android (available on request only right now)
Rendering
• Zero-copy OpenGL rendering pipeline from decoder
• Low level frame timing and synchronization optimizations
@ParsecTeam
MAKING THE KESSLE RUN IN LESS THAN 12 PARSECS
@ParsecTeam
TCP CAN’T HANDLE THE HEAT IN THE KITCHEN
TCP works very well when you have an amazing connection, but most people don’t have Gbps
connections with no loss (Spectrum – we’re looking at you).
@ParsecTeam
• TCP: Stream oriented
(abstracts IP packets), acks,
congestion, windows, state
all over the place
• UDP: Stateless, thin
abstraction over IP packets
Some Background
• Reliability & reordering
• Stream semantics
• Connection state &
handshaking
• Congestion control (dump
data to the network at will)
• Works everywhere
Some Benefits of TCP
• Linux kernel network source
(/source/net/ipv4)
- TCP code: 32 files, 724
KB
-UDP code: 6 files, 95 KB
Some Stats
UDP VS. TCP…ALWAYS TOGETHER, BUT NEVER CLOSE
@ParsecTeam
WHY WE’RE ROLLING WITH OUR OWN PROTOCOL
Benefits of TCP we need or want
-Reliability & reordering <-- yes
-Stream semantics <-- yes
-Connection state & handshaking <-- yes, via DTLS
-Congestion control <-- NO, we can control our bitrate
-Works everywhere < -- NO, assume minimum specs and buffers
Certain types of data can benefit by simpler or no congestion control
-Lossy compression can set bitrate on the fly
Hole punching! The bug becomes the feature
Control
-Optimize for a narrower use-case: latency / bandwidth
-Detailed loss and RTT metrics, can be hard to get with TCP
-Everything controlled in user space, no kernel options necessary
-Fine-grained drop vs. retransmit logic -- some data doesn't need to get there
@ParsecTeam
HOW WE BUILT BUD
-C -- everything you need, nothing you don't
-Wireshark -- the best program ever written
-Clumsy (windows), network conditioner (macos via xcode), tc (linux)
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
HOW WE BUILT BUD
-Sequence number
-Type
-Payload
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
HOW WE BUILT BUD
-Base pointer, head pointer (sequence numbers)
-Read data from base, add data to head
-Write data to head, send from base
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
0 1 2 3 4 5 6
0 1 2 3 4 5 6
SENT UNACKED
EMPTY / ACKED
7 8
7 8
BASE
FULL
HEAD
BASE HEAD
READ/WRITE DETAILS
@ParsecTeam
HOW WE BUILT BUD
-Let the sender know we got the data
-Receiver sends read packet sn, head pointer
-Sender can calculate RTT
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
HOW WE BUILT BUD
-Need to send something if both sender and receiver are sleeping
-Receiver can send their head pointer
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
HOW WE BUILT BUD
-Fast retransmit based on out of order acks
-Most packets, if out of order, are only flipped
-Slow retransmit for failsafe (sent after certain multiple of the RTT)
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
0 1 2 3 4 5 6
0 1 2 3 4 5 6
OK
SENT UNACKED
EMPTY / ACKED
Send fast RT
7 8
7 8
RETRANSMIT DETAILS
@ParsecTeam
HOW WE BUILT BUD
-Goal of the threading model is NOT to squeeze everything out of the CPU
-Always start with dumb "global" mutexes and get core logic solid... then get fancy
Tools
Packet headers (at minimum)
Read/write windows
ACK
Keepalive
Retransmit
Simplifying the interface: you’re going to need threads
@ParsecTeam
THE END RESULT
BUD is resilient even when you’re being chased by TIE fighters through the Asteroid Belt.
@ParsecTeam
Thank you!
Sign Up Here
Follow us @ParsecTeam

More Related Content

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Building a UDP Protocol For Cloud Gaming

  • 1. Code Driven – Building A UDP Protocol For Cloud Gaming @ParsecTeam Parsec.tv
  • 2. PC GAMING IS EXPENSIVE, COMPLICATED, & RESTRICTIVE PC gaming requires upfront investments, hardware knowledge to get started, and ties the gamer to a desktop PC. This restricts the market for PC gaming and forces difficult decisions about investing in hardware when we all just want to play our favorite games. @ParsecTeam
  • 3. PARSEC GIVES YOUACCESS TO GAMING MACHINES Bring your gaming machine wherever you go with Parsec or access a gaming PC in the cloud. @ParsecTeam
  • 4. DELIVERING THE LOWEST LATENCY POSSIBLE Capturing Encoding NetworkingDecoding Rendering Capturing • Low latency desktop capture with zero-copy GPU pipeline to encoder Encoding • All hardware-specific encoding libraries implemented directly on Windows (AMD, Intel, and NVIDIA) with library specific optimizations Networking • Low latency proprietary UDP protocol • Ultra-responsive dynamic bitrate adjustment • DTLS 1.2 with AES128 or AES256 cipher • Secure per-connection tokens signed and authenticated with Parsec • NAT traversal using UDP hole punching for peer-to-peer use cases Decoding • All hardware-specific decoding libraries implemented directly on Windows (AMD, Intel, and NVIDIA) with library specific optimizations • Hardware decoding on macOS • Hardware decoding on Raspberry Pi via OpenMaxIL • Hardware decoding on Android (available on request only right now) Rendering • Zero-copy OpenGL rendering pipeline from decoder • Low level frame timing and synchronization optimizations @ParsecTeam
  • 5. MAKING THE KESSLE RUN IN LESS THAN 12 PARSECS @ParsecTeam
  • 6. TCP CAN’T HANDLE THE HEAT IN THE KITCHEN TCP works very well when you have an amazing connection, but most people don’t have Gbps connections with no loss (Spectrum – we’re looking at you). @ParsecTeam
  • 7. • TCP: Stream oriented (abstracts IP packets), acks, congestion, windows, state all over the place • UDP: Stateless, thin abstraction over IP packets Some Background • Reliability & reordering • Stream semantics • Connection state & handshaking • Congestion control (dump data to the network at will) • Works everywhere Some Benefits of TCP • Linux kernel network source (/source/net/ipv4) - TCP code: 32 files, 724 KB -UDP code: 6 files, 95 KB Some Stats UDP VS. TCP…ALWAYS TOGETHER, BUT NEVER CLOSE @ParsecTeam
  • 8. WHY WE’RE ROLLING WITH OUR OWN PROTOCOL Benefits of TCP we need or want -Reliability & reordering <-- yes -Stream semantics <-- yes -Connection state & handshaking <-- yes, via DTLS -Congestion control <-- NO, we can control our bitrate -Works everywhere < -- NO, assume minimum specs and buffers Certain types of data can benefit by simpler or no congestion control -Lossy compression can set bitrate on the fly Hole punching! The bug becomes the feature Control -Optimize for a narrower use-case: latency / bandwidth -Detailed loss and RTT metrics, can be hard to get with TCP -Everything controlled in user space, no kernel options necessary -Fine-grained drop vs. retransmit logic -- some data doesn't need to get there @ParsecTeam
  • 9. HOW WE BUILT BUD -C -- everything you need, nothing you don't -Wireshark -- the best program ever written -Clumsy (windows), network conditioner (macos via xcode), tc (linux) Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 10. HOW WE BUILT BUD -Sequence number -Type -Payload Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 11. HOW WE BUILT BUD -Base pointer, head pointer (sequence numbers) -Read data from base, add data to head -Write data to head, send from base Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 12. 0 1 2 3 4 5 6 0 1 2 3 4 5 6 SENT UNACKED EMPTY / ACKED 7 8 7 8 BASE FULL HEAD BASE HEAD READ/WRITE DETAILS @ParsecTeam
  • 13. HOW WE BUILT BUD -Let the sender know we got the data -Receiver sends read packet sn, head pointer -Sender can calculate RTT Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 14. HOW WE BUILT BUD -Need to send something if both sender and receiver are sleeping -Receiver can send their head pointer Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 15. HOW WE BUILT BUD -Fast retransmit based on out of order acks -Most packets, if out of order, are only flipped -Slow retransmit for failsafe (sent after certain multiple of the RTT) Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 16. 0 1 2 3 4 5 6 0 1 2 3 4 5 6 OK SENT UNACKED EMPTY / ACKED Send fast RT 7 8 7 8 RETRANSMIT DETAILS @ParsecTeam
  • 17. HOW WE BUILT BUD -Goal of the threading model is NOT to squeeze everything out of the CPU -Always start with dumb "global" mutexes and get core logic solid... then get fancy Tools Packet headers (at minimum) Read/write windows ACK Keepalive Retransmit Simplifying the interface: you’re going to need threads @ParsecTeam
  • 18. THE END RESULT BUD is resilient even when you’re being chased by TIE fighters through the Asteroid Belt. @ParsecTeam
  • 19. Thank you! Sign Up Here Follow us @ParsecTeam