Inside Microsoft’s cloud-first .NET 7 release

This year’s .NET Conf saw the release of .NET 7, the latest release of Microsoft’s biggest and most important open source platform. Along with the underlying tooling, there are new language releases for C# and F#, as well as the cross-platform MAUI user interface framework and a new release of ASP.NET Core and Blazor for server- and client-side web application development. There’s also a major update to the Orleans distributed application development framework, with a new naming scheme that puts it in sync with .NET at last.

Microsoft and the .NET Foundation have successfully moved the platform to an annual update cadence, using open development to prioritize features and bring in community-contributed code. The transition from the Windows-only .NET Framework to .NET Core, and now to a single .NET release has given us a single cross-platform development platform, building on the work of the Mono team to add Linux and macOS support. Most importantly, a common set of base classes ensures you only need to learn them once and can use them anywhere .NET runs.

Building for the cloud and containers

Where previous major releases of .NET have focused on desktop and mobile applications, there’s a lot in this release for the cloud and for modern enterprise applications. That’s not surprising, as cross-platform support makes it easy to run the same code on your Windows Server systems as on Linux servers. There’s had to be significant low-level work in the run-time and compiler to support the latest Arm instruction sets, improvements that have given Arm .NET code a boost of up to 45% over previous releases on recent Arm silicon.

It’s clear that .NET’s future is cross-platform and cloud native. Yes, Windows is going to be at the heart of the platform, but it’s only going to be one of many targets thanks to an increased focus on Blazor for WebAssembly and on containers for use with Kubernetes. That approach is helped by having a Linux release, as .NET can now go straight from your IDE to a container without needing a copy of Docker. Instead of having to publish your code and then package it in a container, you can go straight from a project to a container, using a container package to create a container from a directory and then publishing it as a Linux container image.

There’s an added bonus with .NET’s approach, as it’s container-host agnostic. Your container can run on any standards-compliant platform. .NET will provide its own base images, with separate versions for ASP.NET Core, self-contained apps, and all other apps. The underlying images are based on Debian, so you will need to make sure you target alternatives directly. It’s not quite the vision of distroless containers, but if you’re delivering ASP.NET Core or stand-alone code, it comes pretty close as .NET provides the bare minimum of what’s needed to run your code. You have to specify the host Linux in advance for now, unless you’re running on something like Ubuntu.

Taking a chisel to Ubuntu

Microsoft has been working with Canonical to add .NET support for its Chiseled Ubuntu Containers. This is a relatively new container base image from Ubuntu that cuts down existing Debian packages to the bare minimum, keeping the attack surface small. As they’re intended for single-purpose idempotent containers, building new images each time you make a release, there’s no internal package management and no shell, much like Microsoft’s own Nano release of Windows Server.

Adding this functionality to .NET makes it a first-class citizen in the cloud-native ecosystem. You’ll be able to build code in containers, push it straight to a repository, and then use Kubernetes tools such as Helm to handle application updates and deployments. Using Azure DevOps or GitHub will simplify working with Microsoft’s own Azure Kubernetes tools, including Azure Container Apps, and hybrid cloud instances running through Azure Arc on Azure Stack HCI.

WebAssembly is rapidly gaining popularity as a portable way to deliver rich user experiences to browsers. Microsoft’s experiments with it using Blazor continue in .NET 7, adding new debugging features. It’s proving popular with partners: The Uno Platform adds improved WebAssembly tools in its latest release, which is ready for .NET 7. This includes a better set of threading tools, improving WebAssembly performance considerably. Thread support is still experimental, as low-level API issues in JavaScript still need work.

.NET as infrastructure

One of the big drivers for this release is Azure, with .NET tools becoming increasingly important to the platform. The mix of ASP.NET Core’s Kestrel web server and the YARP reverse proxy has allowed Microsoft’s own cloud services to reduce costs significantly. One example is Microsoft Graph, which is an ASP.NET Core service handling more than 70 billion requests a day. Recent .NET releases have allowed the service to continue scaling, while costs have dropped by 91%. Azure App Service has used Kestrel for a while now, with a significant improvement in performance. It’s enough of a change that there are plans to actually reduce the number of front-end servers by up to 50%.

Azure will have day-zero support for .NET 7 across its suite of platform-as-a-service tools, including Azure App Service and Azure Container Apps. This will allow any proof-of-concept code or apps built on the latest previews to launch as quickly as possible.

At the same time, .NET 7 is improving its built-in networking tools. HTTP/3 support lets you quickly take advantage of the latest web performance features, while also allowing your code to transition away from complex REST APIs to simpler gRPC calls. This approach may mean rearchitecting APIs and refactoring code, but it could speed up distributed applications and microservices significantly.

Having upgrades to components like this as part of .NET makes a software upgrade effectively an infrastructure upgrade. By reducing the load on cloud infrastructure, operators can use .NET to cut down on both capital and operational expenditures, something increasingly important in precarious economic times.

Like all even-number-year .NET releases, this will be a standard-term support (STS) release. Microsoft’s policy for .NET is similar to that used by other open source projects, giving it six months of support beyond the release of the next major version. As .NET has an annual cadence, this should give you a total of 18 months of support, providing you have the current patch release installed. The next LTS release will be .NET 8.

Microsoft continues to evolve .NET at a rapid pace, working with the .NET Foundation to deliver tools and features that users want. With more than 28,000 contributions from the community, Microsoft’s first big open source experiment is clearly a success.

Copyright © 2022 IDG Communications, Inc.

Source

Originally posted on November 10, 2022 @ 1:00 am