Microsoft has migrated several internal services running on the Azure cloud from .NET Framework to .NET 6, which the company claims has reduced the cost of cloud infrastructure by 29%, while simultaneously increasing performance and latency reduction by up to 50%.
Microsoft released .NET 6 in November 2021, announcing massive performance improvements ‘all over the board’. The performance improvements of .NET 6 are mainly due to optimisations in JIT (just-in-time) compiler, garbage collector, moving threading code from unmanaged to managed code, optimising async operations in several scenarios, and improving the performance of data structures such as arrays or file system access classes.
Since the release, Microsoft and other companies have shared experiences and results from migrating older versions of .NET to .NET 6.
Azure Active Directory gateway service moved to .NET 6 in September 2021, when the release candidate versions were available. They claimed a 30% decrease in CPU usage while hosting the same workload of requests per second. During the migration, they found some minor issues, and they coordinated with the .NET team to fix them. One of the biggest changes was removing the previous dependency on IIS to serve HTTP requests using HTTP.sys directly from Windows operating system.
Microsoft Commerce, a collection of around 700 revenue-related microservices, experienced a long migration towards .NET Core starting in 2019. Over time, the team migrated from Azure Windows VMs to Linux Kubernetes clusters, also migrating the .NET Framework to .NET Core 3.1, then .NET 5, and finally .NET 6. They observed improvements of 78% latency reduction in some cases, while the final Azure cost savings were around 30% in CPU usage. During the migration, the Microsoft Commerce team also removed some implicit Windows dependencies and moved away from IIS towards a cross-platform Kestrel web server.
Microsoft’s Teams infrastructure platform, called IC3 (Intelligent Conversations and Communications Cloud), also migrated to .NET 6 in May 2022. They claimed a 29% reduction in Azure compute costs due to getting the same throughput with fewer virtual machines, and a 30-50% latency reduction while increasing the stability and reliability of the services. While the migration is not yet complete, more than a third of the 200 services already run on the latest long-term supported version of .NET. The team invested heavily in analysing the dependencies of their .NET code and mitigated the risk of migration using shims and running code side-by-side.
Azure CosmosDB API gateway migrated to .NET 6 in January 2022. They claimed significant CPU usage reduction, memory footprint reduction and latency reduced to a fifth of the previous one. The team highlighted improvements in HTTP request handling in the Kestrel server, ValueTask optimisations for asynchronous operations, and memory-intensive operations’ support with Span structures in .NET 6.
Azure Web Applications, one of the most used services in Azure for web application developers, migrated their implementation during the first half of 2022 from IIS to Kestrel and YARP (an open-source reverse proxy) with .NET 6. They claimed almost 80% of the increase in throughput and a significant CPU usage reduction. Removing Windows dependencies with Kestrel and .NET 6 enabled them to use the same codebase for their Windows and Linux web application services, reducing the cost of maintenance.
Open-source .NET projects are also benefiting from the .NET 6 performance improvements. A service that reads and processes AIS messages, broadcasted by maritime traffic, claims 20% performance improvement with no code changes at all, just migrating from .NET Core 3.1 to .NET 6.