You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every time you create a new instance of SqlConnection, if the connection string's RetryCount is equal to 1 (which is the default value) SqlClient will attempt to subtly replace it with 5 if it determines that the host is azure synapse on demand endpoint.
The problem is that to determine that SqlClient concats prefix -ondemand with a collection of specific endpoints and then checks whether the host contains any endpoint. With 5 endpoints, that's 5 string allocations per each instance of SqlConnection, which in a simple benchmark results in about 40% of total allocations.
@ErikEJ more like making a copy of s_azureSqlServerEndpoints with each endpoint having ONDEMAND_PREFIX prepended and passing a specific array to IsEndpoint instead of allocating a string per each.
Every time you create a new instance of
SqlConnection
, if the connection string'sRetryCount
is equal to 1 (which is the default value) SqlClient will attempt to subtly replace it with 5 if it determines that the host is azure synapse on demand endpoint.SqlClient/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlConnection.cs
Lines 423 to 429 in 6d2473d
The problem is that to determine that SqlClient concats prefix
-ondemand
with a collection of specific endpoints and then checks whether the host contains any endpoint. With 5 endpoints, that's 5 string allocations per each instance ofSqlConnection
, which in a simple benchmark results in about 40% of total allocations.SqlClient/src/Microsoft.Data.SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs
Lines 821 to 832 in 6d2473d
Maybe it's better to instantiate them once just like it's done for azure sql server endpoints?
The text was updated successfully, but these errors were encountered: