ODBC has SetRowsetSize, what is the equivalent in ADO.net?

前提是你 提交于 2019-12-25 04:31:22

问题


I am looking for ways to deal with a high latency connection. ODBC has a SetRowsetSize that solves this problem, as described here and here.

Is there an equivalent of this setting in ADO.net? This article seems to suggest there is an analog in the original ADO, but it is very old and points to articles that no longer exist.

Generally speaking, how does one improve performance in ADO.net for high-latency connections?


回答1:


If you are concerned about latency while using ADO.NET with SQL Server, you should to look into connection pooling. Though be mindful of pool fragmentation.

Connecting to a data source can be time consuming. To minimize the cost of opening connections, ADO.NET uses an optimization technique called connection pooling, which minimizes the cost of repeatedly opening and closing connections. Connection pooling is handled differently for the .NET Framework data providers.

Additionally, if you need to retrieve many records rapidly, look into using the SqlDataReader. It requires significantly less memory than a using other types of ADO.NET objects like DataSets and its optimized for efficiently fetching large amounts of data.

There are certain performance counters you can look at to see the number of active connection pools (NumberOfActiveConnectionPools) along with other useful information.

Step by step guide on how to test.



来源:https://stackoverflow.com/questions/42677860/odbc-has-setrowsetsize-what-is-the-equivalent-in-ado-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!