<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j" -->

---
title: .NET 11 Performance Gains That Matter for AI-Adjacent...
description: A deep dive into .NET 11's performance improvements framed specifically for AI-adjacent backends like inference gateways and embedding pipelines. Covers...
canonical: https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: .NET 11 Performance Gains That Matter for AI-Adjacent Backends — Daily DevOps & .NET | daily.dev
og:description: A deep dive into .NET 11's performance improvements framed specifically for AI-adjacent backends like inference gateways and embedding pipelines. Covers...
og:url: https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j
og:image: https://api.daily.dev/og/posts/25RRsF53J.png
og:image:alt: .NET 11 Performance Gains That Matter for AI-Adjacent Backends — Daily DevOps & .NET
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# .NET 11 Performance Gains That Matter for AI-Adjacent Backends — Daily DevOps & .NET

**[Daily DevOps & .NET](https://daily.dev/sources/dailydevopsnet)** · [@samtrion](https://daily.dev/samtrion) · 14 min read · 28 upvotes · 2 comments

## Summary

A deep dive into .NET 11's performance improvements framed specifically for AI-adjacent backends like inference gateways and embedding pipelines. Covers runtime async (JIT-driven state machine transformation replacing compiler-generated code), a new CA2027 analyzer that catches leaked Task.Delay timers behind Task.WhenAny timeout patterns, JIT deabstraction reducing boxing and enabling stack-allocated enumerators, bounds-check elimination for Span/array-heavy tokenization and vector math loops, faster Utf8JsonWriter/Reader for escaped and indented JSON, reduced thread-pool scheduling overhead, a lock-free socket async-pointer cache on Windows, and an opt-in Happy-Eyeballs-style parallel connection strategy for dual-stack sockets. The piece stresses these gains address the async/cancellation/GC overhead surrounding a model call rather than the model latency itself, and recommends turning on runtime async in non-prod, retargeting to net11.0 for free allocation wins, and running the CA2027 sweep regardless of current .NET version.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://daily-devops.net/posts/dotnet-11-performance-ai-services>

## Questions this post answers

### What is runtime async in .NET 11 and how do I enable it?

Runtime async is a .NET 11 feature where the JIT, rather than the C# compiler, handles the async/await state machine transformation. It is opt-in per project by setting the TargetFramework to net11.0 and adding the runtime-async=on feature switch in the project file. It requires no new C# syntax or preview language version, and it is expected to become the default in .NET 12.

_Teams weighing when to adopt runtime async can track real-world .NET upgrade experiences on daily.dev._

### Why does Task.WhenAny with Task.Delay for timeouts leak memory in .NET?

The pattern `await Task.WhenAny(someTask, Task.Delay(timeout))` leaves the Task.Delay pending and backed by a live System.Threading.Timer whenever someTask completes first, since nothing cancels the delay task. On a hot path with many requests this accumulates thousands of live timers, causing memory pressure and timer-wheel overhead. The fix, available since .NET 6, is `await someTask.WaitAsync(timeout, cancellationToken)`, and .NET 11's new CA2027 analyzer flags the leaky pattern automatically.

_Developers auditing timeout code for hidden leaks can find practical .NET reliability fixes like this on daily.dev._

### How much faster is exception handling in deep async call chains with .NET 11 runtime async?

Exception handling across a 30-layer-deep async chain drops from 65.974 microseconds to 11.254 microseconds, with roughly 90 percent less allocation, according to Microsoft's benchmarks. Traditional compiler-lowered async rethrows an exception at every await boundary it crosses, while runtime async throws only once, which matters heavily for services where client cancellations are frequent, such as streaming inference gateways.

_Engineers chasing tail-latency spikes from cancellations can follow .NET performance benchmarks like this on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@ahmetozel** · 1 upvotes

> The CA2027 example is worth testing at two levels: the lifetime of the timeout timer and the lifetime of the upstream model request. Replacing WhenAny with WaitAsync cleans up the waiting pattern, but a timeout observed by the caller is not evidence that inference stopped consuming resources.
>
> I would deliberately trigger the timeout and observe whether the cancellation token reaches the outbound request and whether the model server actually stops the work. Keep caller cancellation distinct from timeout in the trace. That would show whether the change removes only local timer pressure or also...

**@jenueldev** · 0 upvotes

> The CA2027 sweep is probably the most immediately actionable part: it turns a deceptively harmless WhenAny timeout into a concrete capacity problem under normal success-path load. I also appreciate the observability caveat around runtime async; before celebrating lower cancellation overhead, teams need to validate that their tracing still reconstructs the logical request path correctly.

## Similar posts on daily.dev

- [.NET 11 Preview 2 Brings Performance Gains, Improved Mapping, and Native OpenTelemetry Support](https://daily.dev/posts/net-11-preview-2-brings-performance-gains-improved-mapping-and-native-opentelemetry-support-1t5uposcx) · InfoQ · 6 upvotes · 0 comments
- [.NET 11 Preview 2 is now available\!](https://daily.dev/posts/net-11-preview-2-is-now-available--iazytiw2q) · .NET Blog · 21 upvotes · 0 comments
- [What’s New in .NET 11? Complete Guide for C\# Developers](https://daily.dev/posts/what-s-new-in-net-11-complete-guide-for-c-developers-fwbcpaxiy) · C\# Corner · 10 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#.net](https://daily.dev/tags/.net), [#c#](https://daily.dev/tags/c#)

[View this post on daily.dev](https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":".NET 11 Performance Gains That Matter for AI-Adjacent Backends — Daily DevOps & .NET","url":"https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j"},"datePublished":"2026-09-28T21:58:12.181Z","dateModified":"2026-09-29T18:00:13.674Z","description":"A deep dive into .NET 11's performance improvements framed specifically for AI-adjacent backends like inference gateways and embedding pipelines. Covers...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1d4edd4f2cabc96c5a1fa4ce96aeb561?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/1d4edd4f2cabc96c5a1fa4ce96aeb561?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Daily DevOps & .NET","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Martin Stühmer","url":"https://daily.dev/samtrion","image":"https://avatars.githubusercontent.com/u/3283596?v=4","description":"The code you create is a valuable legacy, so it's important to build it carefully.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":830}},"commentCount":2,"discussionUrl":"https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":28},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":2}],"keywords":"performance,.net,c#","timeRequired":"PT14M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Daily DevOps & .NET","item":"https://daily.dev/sources/dailydevopsnet"},{"@type":"ListItem","position":3,"name":".NET 11 Performance Gains That Matter for AI-Adjacent Backends — Daily DevOps & .NET"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j","comment":[{"@type":"Comment","text":"The CA2027 example is worth testing at two levels: the lifetime of the timeout timer and the lifetime of the upstream model request. Replacing WhenAny with WaitAsync cleans up the waiting pattern, but a timeout observed by the caller is not evidence that inference stopped consuming resources.\nI would deliberately trigger the timeout and observe whether the cancellation token reaches the outbound request and whether the model server actually stops the work. Keep caller cancellation distinct from timeout in the trace. That would show whether the change removes only local timer pressure or also prevents abandoned inference from continuing after the gateway has returned an error.","datePublished":"2026-10-07T14:57:13.129Z","url":"https://daily.dev/posts/25RRsF53J#c-BWGAitKjq","author":{"@type":"Person","name":"Ahmet Özel","url":"https://daily.dev/ahmetozel","image":"https://avatars.githubusercontent.com/u/70992231?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"The CA2027 sweep is probably the most immediately actionable part: it turns a deceptively harmless WhenAny timeout into a concrete capacity problem under normal success-path load. I also appreciate the observability caveat around runtime async; before celebrating lower cancellation overhead, teams need to validate that their tracing still reconstructs the logical request path correctly.","datePublished":"2026-10-01T04:30:22.815Z","url":"https://daily.dev/posts/25RRsF53J#c-oMTmWQTTj","author":{"@type":"Person","name":"Jenuel Oras Ganawed","url":"https://daily.dev/jenueldev","image":"https://media.daily.dev/image/upload/s--BadmiNyj--/f_auto/v1787625077/avatars/avatar_JJtZr4Sjm?_a=BAMAMicg0"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/net-11-performance-gains-that-matter-for-ai-adjacent-backends-daily-devops-net-25rrsf53j#faq","mainEntity":[{"@type":"Question","name":"What is runtime async in .NET 11 and how do I enable it?","acceptedAnswer":{"@type":"Answer","text":"Runtime async is a .NET 11 feature where the JIT, rather than the C# compiler, handles the async/await state machine transformation. It is opt-in per project by setting the TargetFramework to net11.0 and adding the runtime-async=on feature switch in the project file. It requires no new C# syntax or preview language version, and it is expected to become the default in .NET 12. Teams weighing when to adopt runtime async can track real-world .NET upgrade experiences on daily.dev."}},{"@type":"Question","name":"Why does Task.WhenAny with Task.Delay for timeouts leak memory in .NET?","acceptedAnswer":{"@type":"Answer","text":"The pattern `await Task.WhenAny(someTask, Task.Delay(timeout))` leaves the Task.Delay pending and backed by a live System.Threading.Timer whenever someTask completes first, since nothing cancels the delay task. On a hot path with many requests this accumulates thousands of live timers, causing memory pressure and timer-wheel overhead. The fix, available since .NET 6, is `await someTask.WaitAsync(timeout, cancellationToken)`, and .NET 11's new CA2027 analyzer flags the leaky pattern automatically. Developers auditing timeout code for hidden leaks can find practical .NET reliability fixes like this on daily.dev."}},{"@type":"Question","name":"How much faster is exception handling in deep async call chains with .NET 11 runtime async?","acceptedAnswer":{"@type":"Answer","text":"Exception handling across a 30-layer-deep async chain drops from 65.974 microseconds to 11.254 microseconds, with roughly 90 percent less allocation, according to Microsoft's benchmarks. Traditional compiler-lowered async rethrows an exception at every await boundary it crosses, while runtime async throws only once, which matters heavily for services where client cancellations are frequent, such as streaming inference gateways. Engineers chasing tail-latency spikes from cancellations can follow .NET performance benchmarks like this on daily.dev."}}]}
```

