SQL Server:连接池在哪里:.net端或服务器端 [英] SQL Server: where is connection pool: on .net side or server side
问题描述
在与SQL Server的连接字符串中,有最大池大小
选项.我的问题是,该连接池在哪里进行管理和维护-在.net端还是在服务器端?
In connection string to SQL Server there is max pool size
option. My question is where is this connection pool managed and maintained - on .net side or on server side?
推荐答案
池在客户端维护.因此,每个客户端都将创建物理和逻辑连接.物理连接创建起来很昂贵,逻辑连接不是.用户代码直接使用 *** Connection
(例如 SqlConnection
)类与逻辑连接一起使用.因此,在处置连接时,实际上会将物理连接返回到池中.
Pool is maintained on the client side. So every client will create physical and logical connections. Physical connection is expensive to create, logical is not. User code directly works with logical connections using ***Connection
(for example SqlConnection
) classes. So when you dispose a connection you actually return a physical connection to a pool.
另一方面,也可以在服务器端配置允许的最大连接数,因此服务器可以通过拒绝某些连接来进行粗略的负载平衡.
On the other side it is also possible to configure max allowed connections on the server side, thus server can make a crude load-balancing by denying some connections.
这篇关于SQL Server:连接池在哪里:.net端或服务器端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!