BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News What's New in ASP.NET Core 8.0 : Performance, Blazor, AOT, Identity, Metrics and More

What's New in ASP.NET Core 8.0 : Performance, Blazor, AOT, Identity, Metrics and More

The latest release of .NET 8 brings significant additions and changes to ASP.NET Core. The most notable enhancements for this release of ASP.NET Core are related to the Performance and Blazor alongside the updates regarding the AOT, Identity, SignalR, Metrics and many more features.

Microsoft announced that ASP.NET Core in .NET 8 is the most performant released version so far, and as stated, when compared to .NET 7, ASP.NET Core in .NET 8 is 18% faster on the Techempower JSON benchmark and 24% faster on the Fortunes benchmark. Brennan Conroy wrote a blog post about Performance Improvements in ASP.NET Core 8 and readers are recommended to take a look into this.

The performance of ASP.NET was an active topic on Reddit, a user called Cethrivias asked an interesting question How is Asp.net so fast? The thread is rich in community discussions but the most interesting one is written by David Fowler, a distinguished engineer at .NET, stated the following:

It's not documented all in one place neatly like the fasthttp repository. The short answer is that the team is absolutely obsessed with performance. While that's not a specific change, it's that performance culture that has resulted in dramatic performance increases and breakthroughs every single release.

and at the end of a longer and detailed answer, the following is stated:

This isn't a sprint, it's a marathon and its one of our "forever priorities" as part of the .NET charter. Our investment in performance for .NET directly saves Microsoft $$$ as we enable teams to do more with less. That is to say we will continue to improve performance as a top priority for the foreseeable future.

It is highly recommended that readers take a look at the full answer written by Fowler and also from other community members.

Regarding the features and improvements, one of them is the Native AOT feature which is specifically tailored for cloud-native API applications, allowing the publication of ASP.NET Core apps with native AOT, resulting in self-contained applications compiled into native code.

There are a couple of benefits to having it, firstly, it significantly reduces the disk footprint by producing a single executable that incorporates the program and a subset of code from external dependencies. This reduction in executable size translates to smaller container images, speeding deployment times and enhancing overall startup efficiency.

Moreover, native AOT applications boast faster startup times, attributed to the elimination of Just-In-Time (JIT) compilation. This accelerated startup ensures quicker responsiveness to service requests and facilitates smoother transitions when managed by container orchestrators.

Additionally, ASP.NET Core apps published with native AOT can enjoy reduced memory demands, thanks to the default activation of the new DATAS GC mode. This reduction in memory consumption contributes to heightened deployment density and improved scalability.

The release of .NET 8 marks a significant milestone for Blazor, transforming it from a promising client web UI framework into a comprehensive full-stack web UI solution that can provide for a wide range of web UI requirements.

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. The @rendermode Razor directive facilitates the selection of the render mode at runtime, allowing automatic shifts between server and client to optimize app load time and scalability.

.NET 8 brings about substantial improvements in running .NET code on WebAssembly. The introduction of the Jiterpreter-based runtime enhances performance, resulting in components rendering 20% faster and a twofold increase in the speed of 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, a new web-friendly packaging format for Blazor WebAssembly apps, known as WebCIL, streamlines deployment by removing Windows-specific elements from .NET assemblies and repackaging them as WebAssembly files.

ASP.NET Core in .NET 8 introduces API endpoints for ASP.NET Core Identity, offering programmatic access to user registration and login functionality. This simplifies setting up authentication for browser and mobile client apps, supporting both cookie and token-based authentication.

The update also introduces rich runtime ASP.NET Core Metrics using System.Diagnostics.Metrics, a cross-platform API developed in collaboration with the OpenTelemetry community. These metrics provide a robust monitoring system, offering new kinds of measurements with counters, gauges, and histograms, along with powerful reporting capabilities featuring multi-dimensional values.

The integration into the wider cloud-native ecosystem aligns with OpenTelemetry standards, ensuring seamless compatibility and enhanced monitoring capabilities for ASP.NET Core applications.

.NET 8 release was packed with a lot of changes and updates, other changes are related to Generic attributes for MVC, enhanced form binding for Minimal APIs and anti-forgery middleware, SignalR stateful reconnect, Keyed Services Support in Dependency Injection.

Furthermore, there are also performance improvements for named pipes transport in Kestrel, the named pipes is technology for building inter-process communication (IPC) between Windows apps. Redis-based output caching support is also added.

Output caching is a feature that enables an app to cache the output of a minimal API endpoint, controller action, or Razor Page. For comprehensive and more detailed content, it is recommended for readers to refer to an official release notes page.

Finally, the comments section of the original release blog post has been active with responses regarding the framework changes and enhancements. The blog post has sparked considerable engagement, with users posing numerous questions and engaging in discussions with the development team. For an insight into the various viewpoints and more detailed responses, it is strongly advised that users look into the comment section and participate in the ongoing discussions.

About the Author

Rate this Article

Adoption
Style

BT