ASP.NET Core has seen major additions and modifications with the most recent release of.NET 8. Along with updates to AOT, Identity, SignalR, Metrics, and many other features, the Performance and Blazor improvements for this version of ASP.NET Core are the most noteworthy.
According to Microsoft, ASP.NET Core in.NET 8 is the most performant version that has been released to date. It is faster on the Techempower JSON benchmark by 18% and the Fortunes benchmark by 24% when compared to.NET Core in.NET 7. It is advised that readers read Brennan Conroy’s blog post regarding Performance Improvements in ASP.NET Core 8.
On Reddit, there was a discussion about ASP.NET performance, and Cethrivias, a user, raised an intriguing query. What makes Asp.net so quick? Although there are many interesting community discussions on the thread, David Fowler, a distinguished engineer at.NET, wrote the most intriguing one. He said the following:
It is strongly advised that readers look at Fowler’s complete response as well as the responses from other community members.
One of the new features and enhancements is Native AOT, which is designed especially for cloud-native API applications. It enables the publishing of ASP.NET Core applications with native AOT, which produces self-contained programs that are compiled into native code.
It comes with two advantages: first, it drastically minimizes the disk footprint by combining the program with a portion of the code from external dependencies into a single executable. Smaller container images result from this decrease in executable size, which accelerates deployment times and improves startup efficiency overall.
Additionally, native AOT apps have quicker startup times because they do not require Just-In-Time (JIT) compilation. When handled by container orchestrators, this expedited startup guarantees faster response times to service requests and easier transitions.
Additionally, because the new DATAS GC mode is activated by default, ASP.NET Core apps published with native AOT can benefit from lower memory requirements. This memory consumption decreases, which leads to increased scalability and deployment density.
A major turning point for Blazor has been reached with the release of.NET 8, which has allowed it to evolve from a promising client web UI framework into a complete full-stack web UI solution capable of meeting a variety of web UI needs.
New capabilities in Blazor include static server-side rendering, enhanced navigation and form handling, streaming rendering, and the ability to enable interactivity per component or page. In order to maximize app load time and scalability, the @rendermode Razor directive makes it easier to choose the render mode at runtime. This allows for automatic transitions between server and client.
.NET 8 brings about substantial improvements in running .NET code on WebAssembly. Performance is improved with the introduction of the Jiterpreter-based runtime, leading to 20% faster component rendering and twice as fast JSON deserialization.
The .NET WebAssembly runtime now supports multiple new edit types with Hot Reload, providing full parity with the Hot Reload capabilities of CoreCLR and enabling editing of generic types. Additionally, by eliminating Windows-specific components from.NET assemblies and repackaging them as WebAssembly files, a new web-friendly packaging format for Blazor WebAssembly apps called WebCIL simplifies deployment.
With the introduction of API endpoints for ASP.NET Core Identity in.NET 8, ASP.NET Core provides programmatic access to user registration and login features. With support for both cookie-based and token-based authentication, this makes setting up authentication for browsers and mobile client apps easier.
Rich runtime ASP.NET Core Metrics using System.Diagnostics are also introduced in this update.A cross-platform API called Metrics was created in association with the OpenTelemetry community. With counters, gauges, and histograms among other new measurement types, these metrics offer a strong monitoring system. They also have strong reporting capabilities with multi-dimensional values.
Compliant with OpenTelemetry standards, the integration into the larger cloud-native ecosystem guarantees ASP.NET Core applications seamless compatibility and improved monitoring capabilities.
The.NET 8 release came with a ton of updates and changes, including support for keyed services in dependency injection, improved form binding for minimal APIs and anti-forgery middleware, and generic attributes for MVC.
Moreover, Kestrel’s named pipes transport has improved performance. Named pipes is a technology that facilitates inter-process communication (IPC) between Windows apps.Support for Redis-based output caching is also included.
An application can store the result of a minimal controller action, API endpoint, or Razor Page in a cache thanks to a feature called output caching. Readers are referred to an official release notes page for content that is more comprehensive and detailed.