Avoid creating a new HttpClient per HttpWebRequest in some cases #20013
Labels
area-System.Net.Http
enhancement
Product code improvement that does NOT require public API changes/additions
help wanted
[up-for-grabs] Good issue for external contributors
tenet-performance
Performance related issue
Milestone
In .NET Core, HttpWebRequest is layered on top of HttpClient and HttpClientHandler. Due to the mismatch in APIs, the implementation creates a new HttpClient per HttpWebRequest, which is very inefficient. But those costs can be avoided in some circumstances. In particular, we can have a shared HttpClient configured with the same defaults that HttpWebRequest has; then as long as none of the settings on the HttpWebRequest have been changed to veer from the defaults, the shared HttpClient instance can be used rather than creating a new one.
The text was updated successfully, but these errors were encountered: