While we have achieved great performance gains in other areas, .NET still lags behind other platforms in data access benchmarks.
As an example, the TechEmpower Fortunes benchmark shows similar numbers across raw ADO.NET, Dapper and EF Core variations: throughput flatlines or even decreases as concurrent requests increase, which seems to indicate that bottlenecks are preventing efficient hardware utilization.
The performance of accessing databases using .NET should be much more competitive, and we (several people from Microsoft and the .NET developer community) are going to do something about it.
Please do not mix up .Net Core 2.1 and .NET Core SDK 2.1.2: The latter SDK includes the previously released .NET Core 2.0.3 Runtime and is not related to .Net Core 2.1. Confusing isn’t it?
After the scrambling genesis of .Net Core 2.0 (remember of project.json turn-around responsible for poor tooling support), the master word of 2.1 is strengthening and efficiency.
.Net Core 2.1
- Spans/Memory, recently introduced in C# 7.2, will be generalized (see technical presentation of Adam Sitnik in .NET Core: Performance Storm or this serie from Immo Landwerth: video 1, video 2 and video 3). The main goal is to reduce heap allocations :
- limit useless memory allocation (why allocate a new string with a seperate copy of data in order to read http request header when complete header is already in memory?).
- limit useless string format conversion (web is mainly utf8 whereas .Net is Unicode) but Utf8String are not supposed to be maide available in 2.1.
- favor allocation free algorithm.
- Large use of Span/Memory. From Add initial Span/Buffer-based APIs across corefx, we can see it affect large part of BCL:
- Primitive Parse methods
- System.IO.BufferStream and System.IO.ReadOnlyBufferStream
- System.IO.TextReader and System.IO.TextWriter
- System.IO.BinaryReader and System.IO.BinaryWriter
- Integration of Microsoft.Windows.Compatibility (see Ship .NET Framework compatibility pack). For a detailled description of Microsoft.Windows.Compatibility, you can see Announcing the Windows Compatibility Pack for .NET Core.
- Stacktrace improvements in .NET Core 2.1 as demonstrated by teams of Age of Ascent.
- Garbage collection customization (if the GC is less involved, it becomes possible to use more lazy algorithms). After a first clue last summer recent news suggests that Garbage collection customization will be standard in 2.1 paving the way to specific implementations (and maybe open source versions). For now, a zero GC have been demonstrated.
Asp.Net Core 2.1
- ManagedHandler : a new managed implementation to replace WinHTTP on Windows and libcurl on Unix/OSX.
- HttpClientFactory (revelead by Steve Gordon in its excelllent posts part 1 and part 2).
- A completly new SignalR version (the 2.1 milestone is not nearly as advanced as the other parts) with :
- Client based on TypeScript without jQuery dependency usable either in Node.sj or browser
- Support for multiple protocols: json, messagePack and custom (a good document details encoding and transport requirements with a sample of ProtoBuf encoding)
- Streaming from server to clients
- Ability for a client to connect through bare Websockets
EF Core 2.1
EF Core continues to recover the missing features (roadmap is here):
- GroupBy support
- Better Transaction support
- SqlGeometry, SqlGeography
- CosmoDB provider
- Improved AppInsight monitoring
I wasn’t aware of it but ASP.NET Core Module source code is on aspnet/AspNetCoreModule: ASP.NET Core Module for IIS and IIS Express.
How to handle raw data in request body either manually or by registering a custom InputFormatter: Accepting Raw Request Body Content in ASP.NET Core API Controllers – Rick Strahl’s Web Log.
One big issue with automatic conversion between content body and an action parameter is how to handle too big content (in case of DOS for example). Reading any content body into a byte array could be very dangerous for server health in case of a large body. This also prevents an always preferable handling using the streamed way.
How to create self-signed certificates, installed them as locally trusted and use them with ASP.NET Core on Windows, MacOx and Ubuntu.
This sample code uses YamlDotNet to parse yaml and inherits from FileConfigurationSource and FileConfigurationProvider: Creating a custom ConfigurationProvider in ASP.NET Core to parse YAML.
A very usefull minimal http static file server in Asp.Net core (Starting a http file server from the file explorer using .NET Core – Meziantou’s blog). Can also be regsitered in Explorer contextual menu.
How to use CookieTempDataProvider to prevent requerying data during subsequent get request: Post-Redirect-Get and TempData with ASP.NET Core – Meziantou’s blog
AspNetCoreRateLimit is an ASP.NET Core rate limiting solution designed to control the rate of requests that clients can make to a Web API or MVC app based on IP address or client ID.