连接池中的连接消失了
Connection Disappeared in Connection Pool
我正在从 MSDN 读取连接池。
我面对这句话:
If a connection exists to a server that has disappeared, this
connection can be drawn from the pool even if the connection pooler
has not detected the severed connection and marked it as invalid. This
is the case because the overhead of checking that the connection is
still valid would eliminate the benefits of having a pooler by causing
another round trip to the server to occur. When this occurs, the first
attempt to use the connection will detect that the connection has been
severed, and an exception is thrown.
大家能解释一下消失的连接吗?为什么一个连接会消失?
不是连接消失了。池连接是已建立的网络连接。现在,在通过连接发送数据之前,可能无法检测到与服务器的连接问题(例如网络问题)。
因此,可能会发生以下情况:
- 连接到 SQL 服务器,并添加到池中
- 网络 link 中断(无法立即检测到的方式,例如路由器问题;可能会立即检测到客户端上拔下的电缆)
- 应用程序从池中提取池连接后不久
- 返回的连接就好像服务器可以访问一样,因为没有进行任何检查来验证这一点(这是引用信息的内容)
- 第一次使用会抛出异常
我正在从 MSDN 读取连接池。 我面对这句话:
If a connection exists to a server that has disappeared, this connection can be drawn from the pool even if the connection pooler has not detected the severed connection and marked it as invalid. This is the case because the overhead of checking that the connection is still valid would eliminate the benefits of having a pooler by causing another round trip to the server to occur. When this occurs, the first attempt to use the connection will detect that the connection has been severed, and an exception is thrown.
大家能解释一下消失的连接吗?为什么一个连接会消失?
不是连接消失了。池连接是已建立的网络连接。现在,在通过连接发送数据之前,可能无法检测到与服务器的连接问题(例如网络问题)。
因此,可能会发生以下情况:
- 连接到 SQL 服务器,并添加到池中
- 网络 link 中断(无法立即检测到的方式,例如路由器问题;可能会立即检测到客户端上拔下的电缆)
- 应用程序从池中提取池连接后不久
- 返回的连接就好像服务器可以访问一样,因为没有进行任何检查来验证这一点(这是引用信息的内容)
- 第一次使用会抛出异常