SlideShare a Scribd company logo
1 of 20
Networking in .NET
7.0
Karel Zikmund
.NET Conf 2022
Agenda
• HTTP/3 and QUIC protocols
• Evolution from HTTP/1.1 and HTTP/2
• When and why to use to HTTP/3
• How to use it in .NET 7.0
• Plans for .NET 8.0+
• HTTP/2 WebSockets
• How it differs from HTTP/1.1 WebSockets
• How to use it
• YARP – Yet Another Reverse Proxy
• What is a Reverse Proxy
• Why to use Reverse Proxies
• YARP in production
HTTP/1.1
• Textual protocol
• HTTP / HTTPS
• Multiple connections
• TCP slow start – window ramp up
• 3-way handshake (3 RTT)
• 2-way handshake with TLS 1.3
• HTTP Pipelining
• Not used much
• Binary protocol (frames, HPACK)
• HTTPS (also HTTP allowed)
• 1 TCP connection (multiplexing)
• Default: 100 concurrent streams
• 3-way handshake
• 2-way handshake with TLS 1.3
• Head of the line blocking
• TCP packet loss blocks all streams
HTTP/2
HTTP/3
• Binary protocol (frames, QPACK)
• HTTPS-only
• 1 QUIC connection
• Default: 100 concurrent streams
• QUIC = UDP + TLS 1.3
• 1-way handshake (1 RTT)
• 0-way handshake (0 RTT)
• Dangerous – replay attacks
• Not yet in .NET 7.0
• No Head of the line blocking
• Blocks only streams from lost packet
• … and more …
• Binary protocol (frames, HPACK)
• HTTPS (also HTTP allowed)
• 1 TCP connection (multiplexing)
• Default: 100 concurrent streams
• 3-way handshake
• 2-way handshake with TLS 1.3
• Head of the line blocking
• TCP packet loss blocks all streams
HTTP/2
HTTP/3 – When and Why
• Unreliable networks
• Last mile network
• No Head of the line blocking
• Improved loss recovery
• Transfer between networks
• Mobile scenarios
• Connection ID
• Requires server support
• Enabled on .NET server & client by default
• Support
• 25.1% of all websites
• Major CDNs (Cloudfare, Akamai, …)
• Drawbacks
• Some network appliances don’t support UDP Major browsers – https://caniuse.com/http3
QUIC Protocol
• Transport protocol – UDP + TLS 1.3
• Unreliable delivery
• Streaming scenarios
• Not in .NET yet
• Multi-path … also for HTTP/3
• Using multiple network routes to deliver/recieve data
• RFC in progress
• Increase bandwidth (multiple routes)
• Decrease latency (duplicated traffic) – e.g. streaming
• Extensible and versioned protocol
HTTP/3 + QUIC in .NET 7.0
• msquic-based – http://github.com/microsoft/msquic
• open-source, cross-platform
• HTTP/3
• .NET 7.0 – GA quality (client and server) on Windows and Linux
• Performance – roughly on par with HTTP/2
• More work expected in .NET 8.0
• QUIC APIs
• .NET 7.0 – GA quality (functionality, stress, etc.) and fully supported
• API shape is Preview (i.e. we reserve right to change API shape in .NET 8.0)
• Looking for consumers to help us validate QUIC API shape and tweak Performance
HTTP/3 Usage
• HttpClient
• Defaults to HTTP/1.1
HttpRequestMessage.Version =
HttpVersion.Version30;
• Kestrel server
• Defaults to HTTP/1.1 + HTTP/2
ListenOptions.Protocols
webHost.UseKestrel()
.ConfigureKestrel((context, options) => {
options.ListenAnyIP(5000, listenOptions => {
listenOptions.UseHttps();
listenOptions.Protocols =
HttpProtocols.Http1AndHttp2; //Default setting
});
options.ListenAnyIP(5001, listenOptions => {
listenOptions.UseHttps();
listenOptions.Protocols =
HttpProtocols.Http1AndHttp2AndHttp3;
});
options.ListenAnyIP(5001, listenOptions => {
listenOptions.UseHttps();
listenOptions.Protocols = HttpProtocols.Http3;
});
QUIC Usage
• API shape is Preview
• We reserve the right to change API shape in .NET 8.0
• GA quality and fully supported otherwise (functionality, stress, etc.)
• Opt-in in project file:
<PropertyGroup>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
</PropertyGroup>
HTTP3 + QUIC in .NET 8.0+
• HTTP/3 enabled by default in Kestrel (already in 8.0)
• More Performance work
• Finalize QUIC API shape
• 0-RTT (as opt-in)
• Support macOS, Mobile platforms (iOS, Android)
• Additional protocols and extensions
• gRPC over HTTP/3
• Multi-path
• WebTransport over HTTP/3
• QUIC Datagram
HTTP/2 WebSockets
• Same WebSocket protocol, just over HTTP/2
• Advantage: Reuse HTTP/2 connection – better perf
• Chrome and Edge – enabled by default
• SignalR server + SignalR clients in .NET and JavaScript
• Client usage:
var handler = new SocketsHttpHandler();
ClientWebSocket ws = new();
ws.Options.HttpVersion = HttpVersion.Version20;
ws.Options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionOrLower; //Default
// = HttpVersionPolicy.RequestVersionOrHigher;
ws.ConnectAsync(uri, new HttpMessageInvoker(handler), cancellationToken);
HTTP/2 WebSockets
Uses CONNECT word instead of GET – routes may need update:
public class WebSocketController : ControllerBase
{
[HttpConnect("/ws")] // Will be in .NET 8.0 – copy it from #43501
[HttpGet("/ws")]
public async Task Get()
{
if (HttpContext.WebSockets.IsWebSocketRequest)
{
using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync();
//...
//Copy from #43501
public class HttpConnectAttribute : HttpMethodAttribute {
public HttpConnectAttribute();
public HttpConnectAttribute([StringSyntax("Route")] string template);
}
WebSockets in .NET 8.0+
• HTTP/3 WebSockets
• RFC 9220 – published in June 2022
• WebTransport over HTTP/3 – WebSockets done right
• Draft RFC
• Session with multiple (QUIC) streams
• Multiple sessions on single HTTP/3 connection
• Experimental Kestrel support – see blog post
• HttpClient prototype
YARP
• Yet Another Reverse Proxy
• https://microsoft.github.io/reverse-proxy
• Open-source: https://github.com/microsoft/reverse-proxy
• Layer-7 proxy – terminates & re-issues requests
• Other popular reverse proxies: Nginx, HAProxy, Envoy, Ocelot, …
• Extensibility in C#, layered
• Library, not EXE
• Cross-platform – Windows, Linux + arm64, x64, x86
• Great perf
• Latest protocols
• gRPC, HTTP/3, HTTP/2 WebSockets
What is a Reverse Proxy?
• Public endpoint
• Load balancing between backend servers
• Can offload work from backend servers: Encryption, Auth, Compression, Caching
Reverse
Proxy
contoso.com/orders
contoso.com/store
woodgrovebank.com
Public Internet Private Internet
Reverse Proxies – Why to use them?
• Load balancing
• A/B testing, or Version rollout
• Health checks, health status
• Indirection between URL-space and backend implementation
• API Management – consistent API surface for customers
• Offloading from backend
• Auth, compression, encryption, static files (like CDN)
• Authentication migration
• Cloud to On-prem reverse tunnel (*)
• Route local traffic to remote servers (single point of control and config)
• k8s and Service Fabric ingress control
• .NET Framework migration to .NET Core
YARP in Production
App Service
• Blog post
• 160B+ requests / day … 1.9M RPS
• 14M+ host names
• .NET 6.0 + YARP
• Benefits:
• Migration from IIS + ARR / Nginx
• Updates not tied to OS version
• Unified code base (Windows & Linux)
• Perf improvements
• 80% in throughput in perf tests
• Lower CPU usage
• More extensibility points
• New customer scenarios:
• gRPC, HTTP/3, per-host cipher suite config, custom
error pages, …
Dynamics 365
• 100B+ requests / month … 38.5K RPS
• 7.5PB+ petabytes transferred / month
YARP – Get Started
5-lines reverse proxy app:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddReverseProxy()
.LoadFromConfig(builder
.Configuration.GetSection("ReverseProxy"));
var app = builder.Build();
app.MapReverseProxy();
app.Run();
https://microsoft.github.io/reverse-proxy
Summary
• HTTP/3 and QUIC support in .NET 7.0
• GA quality
• QUIC API shape may change in .NET 8.0
• Pro: Unreliable networks, Mobile scenarios
• HTTP/2 WebSockets
• Client needs new API call to reuse connection
• Server needs Connect attribute
• YARP
• Library, extensible via C#

More Related Content

What's hot

Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
Jonathan Katz
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservices
Kunal Hire
 

What's hot (20)

An Introduction to OAuth2
An Introduction to OAuth2An Introduction to OAuth2
An Introduction to OAuth2
 
Inter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPCInter-Process Communication in Microservices using gRPC
Inter-Process Communication in Microservices using gRPC
 
Apache Arrow Flight Overview
Apache Arrow Flight OverviewApache Arrow Flight Overview
Apache Arrow Flight Overview
 
해시암호와 비밀번호 - 9th KUSISWALL
해시암호와 비밀번호 - 9th KUSISWALL해시암호와 비밀번호 - 9th KUSISWALL
해시암호와 비밀번호 - 9th KUSISWALL
 
Big Data Security in Apache Projects by Gidon Gershinsky
Big Data Security in Apache Projects by Gidon GershinskyBig Data Security in Apache Projects by Gidon Gershinsky
Big Data Security in Apache Projects by Gidon Gershinsky
 
Apache Kafka Security
Apache Kafka Security Apache Kafka Security
Apache Kafka Security
 
Prometheus Multi Tenancy
Prometheus Multi TenancyPrometheus Multi Tenancy
Prometheus Multi Tenancy
 
HTTP/3, QUIC and streaming
HTTP/3, QUIC and streamingHTTP/3, QUIC and streaming
HTTP/3, QUIC and streaming
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
 
Kubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep DiveKubernetes Networking with Cilium - Deep Dive
Kubernetes Networking with Cilium - Deep Dive
 
Demystifying OAuth 2.0
Demystifying OAuth 2.0Demystifying OAuth 2.0
Demystifying OAuth 2.0
 
Grafana introduction
Grafana introductionGrafana introduction
Grafana introduction
 
Native Support of Prometheus Monitoring in Apache Spark 3.0
Native Support of Prometheus Monitoring in Apache Spark 3.0Native Support of Prometheus Monitoring in Apache Spark 3.0
Native Support of Prometheus Monitoring in Apache Spark 3.0
 
Managing secrets at scale
Managing secrets at scaleManaging secrets at scale
Managing secrets at scale
 
Full Isolation in Multi-Tenant SaaS with Kubernetes and Istio
Full Isolation in Multi-Tenant SaaS with Kubernetes and IstioFull Isolation in Multi-Tenant SaaS with Kubernetes and Istio
Full Isolation in Multi-Tenant SaaS with Kubernetes and Istio
 
End-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John FallowsEnd-to-end Streaming Between gRPC Services Via Kafka with John Fallows
End-to-end Streaming Between gRPC Services Via Kafka with John Fallows
 
OSMC 2022 | VictoriaMetrics: scaling to 100 million metrics per second by Ali...
OSMC 2022 | VictoriaMetrics: scaling to 100 million metrics per second by Ali...OSMC 2022 | VictoriaMetrics: scaling to 100 million metrics per second by Ali...
OSMC 2022 | VictoriaMetrics: scaling to 100 million metrics per second by Ali...
 
OAuth 2.0
OAuth 2.0OAuth 2.0
OAuth 2.0
 
Api gateway in microservices
Api gateway in microservicesApi gateway in microservices
Api gateway in microservices
 

Similar to .NET Conf 2022 - Networking in .NET 7

SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
Eugene Zharkov
 
Data power v7 update - Ravi Katikala
Data power v7 update - Ravi KatikalaData power v7 update - Ravi Katikala
Data power v7 update - Ravi Katikala
floridawusergroup
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
RX-M Enterprises LLC
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax Push
Doris Chen
 

Similar to .NET Conf 2022 - Networking in .NET 7 (20)

Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the WebCleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
Cleaning Up the Dirt of the Nineties - How New Protocols are Modernizing the Web
 
SignalR: Add real-time to your applications
SignalR: Add real-time to your applicationsSignalR: Add real-time to your applications
SignalR: Add real-time to your applications
 
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUICA new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
A new Internet? Intro to HTTP/2, QUIC, DoH and DNS over QUIC
 
A New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOHA New Internet? Introduction to HTTP/2, QUIC and DOH
A New Internet? Introduction to HTTP/2, QUIC and DOH
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
 
What's new in NGINX Plus R19
What's new in NGINX Plus R19What's new in NGINX Plus R19
What's new in NGINX Plus R19
 
Data power v7 update - Ravi Katikala
Data power v7 update - Ravi KatikalaData power v7 update - Ravi Katikala
Data power v7 update - Ravi Katikala
 
Building high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache ThriftBuilding high performance microservices in finance with Apache Thrift
Building high performance microservices in finance with Apache Thrift
 
Developing Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax PushDeveloping Revolutionary Web Applications using Comet and Ajax Push
Developing Revolutionary Web Applications using Comet and Ajax Push
 
Managing Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on KubernetesManaging Microservices With The Istio Service Mesh on Kubernetes
Managing Microservices With The Istio Service Mesh on Kubernetes
 
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 eraHTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
HTTP/2 and QUICK protocols. Optimizing the Web stack for HTTP/2 era
 
Consuming ASP.net API With Websockets — Maayan Glikser
Consuming ASP.net API With Websockets — Maayan GlikserConsuming ASP.net API With Websockets — Maayan Glikser
Consuming ASP.net API With Websockets — Maayan Glikser
 
Consuming ASP.NET Web API with WebSockets
Consuming ASP.NET Web API with WebSocketsConsuming ASP.NET Web API with WebSockets
Consuming ASP.NET Web API with WebSockets
 
Accelerating and Securing your Applications in AWS. In-depth look at Solving ...
Accelerating and Securing your Applications in AWS. In-depth look at Solving ...Accelerating and Securing your Applications in AWS. In-depth look at Solving ...
Accelerating and Securing your Applications in AWS. In-depth look at Solving ...
 
Http2 in practice
Http2 in practiceHttp2 in practice
Http2 in practice
 
Module 5 Application and presentation Layer .pptx
Module 5 Application and presentation Layer .pptxModule 5 Application and presentation Layer .pptx
Module 5 Application and presentation Layer .pptx
 
Websocket
WebsocketWebsocket
Websocket
 
Citrix Day 2015 Net Scaler Release 10.5 Update v10
Citrix Day 2015 Net Scaler Release 10.5 Update v10Citrix Day 2015 Net Scaler Release 10.5 Update v10
Citrix Day 2015 Net Scaler Release 10.5 Update v10
 
Building Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using WebsocketsBuilding Next Generation Real-Time Web Applications using Websockets
Building Next Generation Real-Time Web Applications using Websockets
 

More from Karel Zikmund

More from Karel Zikmund (20)

NDC London 2020 - Challenges of Managing CoreFx Repo -- Karel Zikmund
NDC London 2020 - Challenges of Managing CoreFx Repo -- Karel ZikmundNDC London 2020 - Challenges of Managing CoreFx Repo -- Karel Zikmund
NDC London 2020 - Challenges of Managing CoreFx Repo -- Karel Zikmund
 
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel ZikmundNDC Sydney 2019 - Async Demystified -- Karel Zikmund
NDC Sydney 2019 - Async Demystified -- Karel Zikmund
 
.NET Core Summer event 2019 in Vienna, AT - .NET 5 - Future of .NET on Mobile...
.NET Core Summer event 2019 in Vienna, AT - .NET 5 - Future of .NET on Mobile....NET Core Summer event 2019 in Vienna, AT - .NET 5 - Future of .NET on Mobile...
.NET Core Summer event 2019 in Vienna, AT - .NET 5 - Future of .NET on Mobile...
 
.NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel...
.NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel....NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel...
.NET Core Summer event 2019 in Linz, AT - War stories from .NET team -- Karel...
 
.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund
.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund
.NET Core Summer event 2019 in Brno, CZ - Async demystified -- Karel Zikmund
 
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf....NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
.NET Core Summer event 2019 in Brno, CZ - .NET Core Networking stack and perf...
 
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel....NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
.NET Core Summer event 2019 in Brno, CZ - War stories from .NET team -- Karel...
 
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar....NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Prague, CZ - War stories from .NET team -- Kar...
 
.NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar....NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar...
.NET Core Summer event 2019 in Vienna, AT - War stories from .NET team -- Kar...
 
.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund
.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund
.NET Core Summer event 2019 in NL - War stories from .NET team -- Karel Zikmund
 
NDC Oslo 2019 - War stories from .NET team -- Karel Zikmund
NDC Oslo 2019 - War stories from .NET team -- Karel ZikmundNDC Oslo 2019 - War stories from .NET team -- Karel Zikmund
NDC Oslo 2019 - War stories from .NET team -- Karel Zikmund
 
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel ZikmundDotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
DotNext 2017 in Moscow - Challenges of Managing CoreFX repo -- Karel Zikmund
 
DotNext 2017 in Moscow - .NET Core Networking stack and Performance -- Karel ...
DotNext 2017 in Moscow - .NET Core Networking stack and Performance -- Karel ...DotNext 2017 in Moscow - .NET Core Networking stack and Performance -- Karel ...
DotNext 2017 in Moscow - .NET Core Networking stack and Performance -- Karel ...
 
.NET MeetUp Brno 2017 - Microsoft Engineering teams in Europe -- Karel Zikmund
.NET MeetUp Brno 2017 - Microsoft Engineering teams in Europe -- Karel Zikmund.NET MeetUp Brno 2017 - Microsoft Engineering teams in Europe -- Karel Zikmund
.NET MeetUp Brno 2017 - Microsoft Engineering teams in Europe -- Karel Zikmund
 
.NET MeetUp Brno 2017 - Xamarin .NET internals -- Marek Safar
.NET MeetUp Brno 2017 - Xamarin .NET internals -- Marek Safar.NET MeetUp Brno 2017 - Xamarin .NET internals -- Marek Safar
.NET MeetUp Brno 2017 - Xamarin .NET internals -- Marek Safar
 
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Brno - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET Fringe 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Prague 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
.NET MeetUp Prague 2017 - .NET Standard -- Karel Zikmund
 
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
.NET MeetUp Amsterdam 2017 - Challenges of Managing CoreFX repo -- Karel Zikmund
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+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
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+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 Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Recently uploaded (20)

WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+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...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%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
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
+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...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%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
 

.NET Conf 2022 - Networking in .NET 7

  • 1.
  • 2. Networking in .NET 7.0 Karel Zikmund .NET Conf 2022
  • 3. Agenda • HTTP/3 and QUIC protocols • Evolution from HTTP/1.1 and HTTP/2 • When and why to use to HTTP/3 • How to use it in .NET 7.0 • Plans for .NET 8.0+ • HTTP/2 WebSockets • How it differs from HTTP/1.1 WebSockets • How to use it • YARP – Yet Another Reverse Proxy • What is a Reverse Proxy • Why to use Reverse Proxies • YARP in production
  • 4. HTTP/1.1 • Textual protocol • HTTP / HTTPS • Multiple connections • TCP slow start – window ramp up • 3-way handshake (3 RTT) • 2-way handshake with TLS 1.3 • HTTP Pipelining • Not used much • Binary protocol (frames, HPACK) • HTTPS (also HTTP allowed) • 1 TCP connection (multiplexing) • Default: 100 concurrent streams • 3-way handshake • 2-way handshake with TLS 1.3 • Head of the line blocking • TCP packet loss blocks all streams HTTP/2
  • 5. HTTP/3 • Binary protocol (frames, QPACK) • HTTPS-only • 1 QUIC connection • Default: 100 concurrent streams • QUIC = UDP + TLS 1.3 • 1-way handshake (1 RTT) • 0-way handshake (0 RTT) • Dangerous – replay attacks • Not yet in .NET 7.0 • No Head of the line blocking • Blocks only streams from lost packet • … and more … • Binary protocol (frames, HPACK) • HTTPS (also HTTP allowed) • 1 TCP connection (multiplexing) • Default: 100 concurrent streams • 3-way handshake • 2-way handshake with TLS 1.3 • Head of the line blocking • TCP packet loss blocks all streams HTTP/2
  • 6. HTTP/3 – When and Why • Unreliable networks • Last mile network • No Head of the line blocking • Improved loss recovery • Transfer between networks • Mobile scenarios • Connection ID • Requires server support • Enabled on .NET server & client by default • Support • 25.1% of all websites • Major CDNs (Cloudfare, Akamai, …) • Drawbacks • Some network appliances don’t support UDP Major browsers – https://caniuse.com/http3
  • 7. QUIC Protocol • Transport protocol – UDP + TLS 1.3 • Unreliable delivery • Streaming scenarios • Not in .NET yet • Multi-path … also for HTTP/3 • Using multiple network routes to deliver/recieve data • RFC in progress • Increase bandwidth (multiple routes) • Decrease latency (duplicated traffic) – e.g. streaming • Extensible and versioned protocol
  • 8. HTTP/3 + QUIC in .NET 7.0 • msquic-based – http://github.com/microsoft/msquic • open-source, cross-platform • HTTP/3 • .NET 7.0 – GA quality (client and server) on Windows and Linux • Performance – roughly on par with HTTP/2 • More work expected in .NET 8.0 • QUIC APIs • .NET 7.0 – GA quality (functionality, stress, etc.) and fully supported • API shape is Preview (i.e. we reserve right to change API shape in .NET 8.0) • Looking for consumers to help us validate QUIC API shape and tweak Performance
  • 9. HTTP/3 Usage • HttpClient • Defaults to HTTP/1.1 HttpRequestMessage.Version = HttpVersion.Version30; • Kestrel server • Defaults to HTTP/1.1 + HTTP/2 ListenOptions.Protocols webHost.UseKestrel() .ConfigureKestrel((context, options) => { options.ListenAnyIP(5000, listenOptions => { listenOptions.UseHttps(); listenOptions.Protocols = HttpProtocols.Http1AndHttp2; //Default setting }); options.ListenAnyIP(5001, listenOptions => { listenOptions.UseHttps(); listenOptions.Protocols = HttpProtocols.Http1AndHttp2AndHttp3; }); options.ListenAnyIP(5001, listenOptions => { listenOptions.UseHttps(); listenOptions.Protocols = HttpProtocols.Http3; });
  • 10. QUIC Usage • API shape is Preview • We reserve the right to change API shape in .NET 8.0 • GA quality and fully supported otherwise (functionality, stress, etc.) • Opt-in in project file: <PropertyGroup> <EnablePreviewFeatures>true</EnablePreviewFeatures> </PropertyGroup>
  • 11. HTTP3 + QUIC in .NET 8.0+ • HTTP/3 enabled by default in Kestrel (already in 8.0) • More Performance work • Finalize QUIC API shape • 0-RTT (as opt-in) • Support macOS, Mobile platforms (iOS, Android) • Additional protocols and extensions • gRPC over HTTP/3 • Multi-path • WebTransport over HTTP/3 • QUIC Datagram
  • 12. HTTP/2 WebSockets • Same WebSocket protocol, just over HTTP/2 • Advantage: Reuse HTTP/2 connection – better perf • Chrome and Edge – enabled by default • SignalR server + SignalR clients in .NET and JavaScript • Client usage: var handler = new SocketsHttpHandler(); ClientWebSocket ws = new(); ws.Options.HttpVersion = HttpVersion.Version20; ws.Options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionOrLower; //Default // = HttpVersionPolicy.RequestVersionOrHigher; ws.ConnectAsync(uri, new HttpMessageInvoker(handler), cancellationToken);
  • 13. HTTP/2 WebSockets Uses CONNECT word instead of GET – routes may need update: public class WebSocketController : ControllerBase { [HttpConnect("/ws")] // Will be in .NET 8.0 – copy it from #43501 [HttpGet("/ws")] public async Task Get() { if (HttpContext.WebSockets.IsWebSocketRequest) { using var webSocket = await HttpContext.WebSockets.AcceptWebSocketAsync(); //... //Copy from #43501 public class HttpConnectAttribute : HttpMethodAttribute { public HttpConnectAttribute(); public HttpConnectAttribute([StringSyntax("Route")] string template); }
  • 14. WebSockets in .NET 8.0+ • HTTP/3 WebSockets • RFC 9220 – published in June 2022 • WebTransport over HTTP/3 – WebSockets done right • Draft RFC • Session with multiple (QUIC) streams • Multiple sessions on single HTTP/3 connection • Experimental Kestrel support – see blog post • HttpClient prototype
  • 15. YARP • Yet Another Reverse Proxy • https://microsoft.github.io/reverse-proxy • Open-source: https://github.com/microsoft/reverse-proxy • Layer-7 proxy – terminates & re-issues requests • Other popular reverse proxies: Nginx, HAProxy, Envoy, Ocelot, … • Extensibility in C#, layered • Library, not EXE • Cross-platform – Windows, Linux + arm64, x64, x86 • Great perf • Latest protocols • gRPC, HTTP/3, HTTP/2 WebSockets
  • 16. What is a Reverse Proxy? • Public endpoint • Load balancing between backend servers • Can offload work from backend servers: Encryption, Auth, Compression, Caching Reverse Proxy contoso.com/orders contoso.com/store woodgrovebank.com Public Internet Private Internet
  • 17. Reverse Proxies – Why to use them? • Load balancing • A/B testing, or Version rollout • Health checks, health status • Indirection between URL-space and backend implementation • API Management – consistent API surface for customers • Offloading from backend • Auth, compression, encryption, static files (like CDN) • Authentication migration • Cloud to On-prem reverse tunnel (*) • Route local traffic to remote servers (single point of control and config) • k8s and Service Fabric ingress control • .NET Framework migration to .NET Core
  • 18. YARP in Production App Service • Blog post • 160B+ requests / day … 1.9M RPS • 14M+ host names • .NET 6.0 + YARP • Benefits: • Migration from IIS + ARR / Nginx • Updates not tied to OS version • Unified code base (Windows & Linux) • Perf improvements • 80% in throughput in perf tests • Lower CPU usage • More extensibility points • New customer scenarios: • gRPC, HTTP/3, per-host cipher suite config, custom error pages, … Dynamics 365 • 100B+ requests / month … 38.5K RPS • 7.5PB+ petabytes transferred / month
  • 19. YARP – Get Started 5-lines reverse proxy app: var builder = WebApplication.CreateBuilder(args); builder.Services.AddReverseProxy() .LoadFromConfig(builder .Configuration.GetSection("ReverseProxy")); var app = builder.Build(); app.MapReverseProxy(); app.Run(); https://microsoft.github.io/reverse-proxy
  • 20. Summary • HTTP/3 and QUIC support in .NET 7.0 • GA quality • QUIC API shape may change in .NET 8.0 • Pro: Unreliable networks, Mobile scenarios • HTTP/2 WebSockets • Client needs new API call to reuse connection • Server needs Connect attribute • YARP • Library, extensible via C#

Editor's Notes

  1. HPACK – compression of headers, not using textual names, but indexes into table RTT – Round-Trip-Time … matters between Datacenters, or from remote clients (Sydney <-> LA/London) – 160ms+ (theoretical)
  2. 0-RTT – keys from previous sessions Idempotent requests (e.g. harmless GET)
  3. Might be valuable between data-centers Server 2 Server in same data-center might not bring value
  4. Preview in .NET 6.0 – experimental, under a switch
  5. HTTP/3 enabled by default in Kestrel 8.0 - https://github.com/dotnet/aspnetcore/pull/44217 (early October) gRPC – James Newton King has implementation, used to write the RFC https://github.com/grpc/proposal/blob/master/G2-http3-protocol.md WebTransport – WebSockets done right, will talk later
  6. You have to supply handler / HttpClient yourself to share HTTP/2 connection Automatic pooling is bad (ServicePoint / HttpWebRequest) We throw for ConnectAsync without handler
  7. 9/30 – Blog post - https://devblogs.microsoft.com/dotnet/experimental-webtransport-over-http-3-support-in-kestrel/
  8. Not Lua / C++ … Nginx & HAProxy On Windows runs better than most other proxies Can run in IIS and HTTP.sys Public benchmarks Community: Node.js migration – throughput was ~6-7x greater on ASP .NET Core; P99 latency was ~2-4x better on ASP .NET Core. Drives innovation and perf improvements into .NET
  9. For example: Ingress for k8s and Service Fabric
  10. API Management solution - consistent API surface for customers backed by multitude of micro-services (replace Azure API Management) Routing local traffic to remote servers (single point of control and config) Like forward proxy, but client does not have to be aware of it (*) – 100 lines of code
  11. App Service: Announced 8/24 (2022) Dynamics: .NET Conf 2021