ODP.NET连接池的问题 - 故障Tollerance数据库下山后 [英] ODP.NET Connection Pooling Issues - Fault Tollerance After Database Goes Down

查看:1052
本文介绍了ODP.NET连接池的问题 - 故障Tollerance数据库下山后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ODP.NET做出多种Oracle数据库的连接有一个的WebAPI服务。通常情况下,网络服务将被打几次第二,永远不会有闲置很长时间。在我们的测试网站然而,我们没有使用它2-3天。今天上午,我们打的服务,得到了连接请求超时从ODP.NET异常,提示连接池是出于可用连接。我们使用后关闭连接。该服务前一段工作正常,但今天的第一查询得到了超时异常。我们在IIS应用程序池配置为永不复位。

I have an WebAPI service using ODP.NET to make connections to several oracle databases. Normally the web service would be hit several times a second and will never have long periods on inactivity. In our test site however, we did not use it for 2-3 days. This morning, we hit the service and got "connection request timeout" exceptions from ODP.NET, suggesting that the connection pool was out of available connections. We are closing the connections after use. The service was working fine before the period, but today the very first query got the timeout exception. Our app pool in IIS is configured to never reset.

我的问题,然后是,什么会导致连接池,以填补一个闲置一段时间后接触不良,而这些连接不会在平时3分钟周期清理?它只是发生在2我们的数据库的3和验证连接=真正的设置为所有的人。

My question then is, what can cause the connection pool to fill with bad connections after a period of inactivity, where these connections are not cleaned up in the usual 3 minute cycle? It only happened to 2 out of the 3 of our databases, and Validate Connection=true is set for all of them.

修改
所以说话的DBA后,之间有一个连接/会话被手动或超时和数据库服务器撞断了TCP连接,杀死一些不同。在这种情况下,TCP连接被切断作为常规备份的一部分(为什么不是此重要)。我想,当整个数据库服务器立刻下线时发生这种情况。这个问题的基础仍然适用,我认为,虽然:为什么ODP.NET无法清理切断连接超时?还有就是指瘀连接的性能计数器,可这些连接在该州被卡住?我认为,它应该是能够看到的连接不再有效(验证连接= TRUE),杀了它,而不是将其返回到池中。

EDIT So after talking to the DBA, there is some different between a connection/session being killed manually or by timeout and the database server severing the TCP connections. In this case, the TCP connection was severed as part of a regular backup (why is not important for this). I guess this happens when the whole database server goes offline at once. The basis of the question still applies I think though: why is ODP.NET unable to cleanup severed connections overtime? There is a performance counter that refers to "Stasis" connections, could those connections be stuck in that state? I would think that it should be able to see that a connection is no longer active (Validate Connection=True), kill it and not return it to the pool.

当然,这个问题可以通过重置只是应用程序池的一切数据库停机来解决。我还是想配置ODP.NET连接池更具有容错性。

Granted, this problem can be solved by just resetting the app pool everything the database goes down. I would still like to configure ODP.NET connection pooling to be more fault tolerant.

推荐答案

我也遇到同样的问题,我已经找到了唯一的解决办法是使用连接终身连接字符串参数与验证连接一起。

I have run into this same issue, and the only solution I have found is to use the Connection Lifetime connection string parameter in conjunction with Validate Connection.

在我的特定情况下,连接超时设置在服务器和池中的连接将超时,但不能狙击出池,造成错误。

In my particular case, the connection timeout was set at the server and the connections in the pool would timeout, but not be sniped out of the pool, resulting in errors.

设置两个连接生存期和验证连接参数已经解​​决了问题。

Setting both the Connection Lifetime and the Validate Connection parameters has resolved the issue.

请确保您选择小于服务器连接不活动超时连接寿命值。

Make sure the Connection Lifetime value that you choose is less than the server connection inactivity timeout.

这篇关于ODP.NET连接池的问题 - 故障Tollerance数据库下山后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆