ASP.NET Core 5.0 released with performance bump ... and a bunch of breaking changes

Upgrade now on Azure App Service, if you can tolerate a 'cold start'

Microsoft has released ASP.NET Core 5.0 as part of the general availability of .NET 5 this week, with new features and substantial performance improvements but also some breaking changes.

ASP.NET Core 5 is Microsoft’s official web application framework (or collection of frameworks), and strategically important as this is a huge market, particularly since it runs on Linux as Windows server.

The framework is free, though the company no doubt figures that users of ASP.NET are more likely to host applications on its Azure cloud, and to use SQL Server in some guise for the database. Entity Framework Core, the official .NET object-relational mapping library, defaults to SQL Server in Microsoft’s examples and templates, though drivers exist for other databases.

gRPC is much faster in this release of ASP.NET Core

gRPC is much faster in this release of ASP.NET Core

Microsoft Principal Program Manager Daniel Roth said the transition to .NET 5.0 has improved performance. He quoted figures from Microsoft’s favourite benchmark suite, TechEmpower, which show improvements of 12-44 per cent in throughput and 4-66 per cent in latency, compared to ASP.NET 3.1. The composite score improved by 17 per cent. The operating system used for the quoted tests is Linux.

As with many test suites, real-world results may not be so impressive. It is also notable in the TechEmpower statistics that Entity Framework Core tends to be much slower than raw database access or alternative lightweight ORMs such as Dapper.

ASP.NET Core 5 has been updated with many improvements, including support for C# 9.0 record types, much better performance in Blazor, the newest part of ASP.NET which can use WebAssembly to run .NET code in the browser, a 60 per cent performance improvement with gRPC (an open source remote procedure call framework), built in support for the OpenAPI/Swagger UI standard for a REST API, and improvements in the SignalR real-time communication framework to support concurrent invocation of methods on the server.

Developers will also benefit from a feature called dotnet watch, which auto-refreshes the browser when code changes are made, so the results are viewed nearly instantly.

Before devs rush off to migrate existing projects, it will pay to take a look at the breaking changes which may require code to be revised. The binding of DateTime values in Razor Pages, for example, has changed from the timezone on the server to always using UTC timezones. This is a good thing in general but might mean wrong dates and times showing in an application.

The latest Visual Studio offers a range of choices for ASP.NET Core 5.0 applications

The latest Visual Studio offers a range of choices for ASP.NET Core 5.0 applications

Azure users will be able to upgrade applications running on App Service immediately, with one snag. App Service is a managed platform allowing developers to upload just their application, leaving server management to Microsoft, and with options for manual and automatic scaling.

App Service supports .NET 5 through an early access runtime, but the runtime or container required will be pulled when the application starts, causing a cold start. “Based on our testing the P95 impact is ~30 seconds with the average impact being <10 seconds,” the docs said, meaning that 95 per cent of applications have start-up delayed by 30 seconds or less. Build performance is also impacted. These limitations will disappear after the next App Service release. ®

Biting the hand that feeds IT © 1998–2021