在.Net 中 是否有第三方实现 Sqlserver 客户端连接池的 SDK

2023-04-13 17:24:05 +08:00
 tututututututu

需求:在.Net 中我想有一个连接池并且使连接一直处于被打开状态,比如我有 100 个已经被打开的连接,这样流量过来的时候就不需要新创建 SqlConnection 然后再 Open(这个操作 Latency 太高了),有类似实现的 SDK 嘛

665 次点击
所在节点   SQL Server
2 条回复
jtwor
2023-04-13 17:29:49 +08:00
forgottencoast
2023-04-15 21:33:11 +08:00
连接池是内置的,你只需要根据你的需求进行配置就可以了。
详见: https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-connection-pooling
Connection pooling reduces the number of times that new connections must be opened. The pooler maintains ownership of the physical connection. It manages connections by keeping alive a set of active connections for each given connection configuration. Whenever a user calls Open on a connection, the pooler looks for an available connection in the pool. If a pooled connection is available, it returns it to the caller instead of opening a new connection. When the application calls Close on the connection, the pooler returns it to the pooled set of active connections instead of closing it. Once the connection is returned to the pool, it is ready to be reused on the next Open call.

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/932297

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX