and*_*Dev 3 websphere database-connection connection-pooling connection-timeout jakarta-ee
我正在 IBM WAS 7.0 上运行我的多线程 Struts 应用程序,并在峰值负载期间出现以下异常。最初我将最大连接数配置为 50,连接等待时间为 180 秒,但是当我收到此错误时,我在进行大量谷歌搜索以解决此问题后将最大连接数更改为 70,将连接等待时间更改为 600 秒,但仍然收到此错误有时在高峰负载期间......
原因:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException:连接不可用,等待超时 180008
请任何人能帮助我。
小智 6
感谢您的澄清!您看到的消息通常表明连接池已达到最大,发生这种情况的原因有很多。
如果增加最大连接池大小后仍然遇到该问题,则可能存在连接泄漏问题。很多时候,如果应用程序没有正确关闭连接,那么无论您将最大连接大小增加到多高,它都会填满连接池。连接泄漏的一个很好的迹象是连接池无法自行恢复并且需要重新启动服务器。应用程序应遵循获取/使用/关闭模式以避免连接泄漏问题。
连接池达到最大的另一个常见原因是数据库端存在性能问题。如果数据库没有正确配置来处理来自 WAS 的负载,则可能会导致连接池问题。如果存在长时间运行的查询,这可能会导致连接在 WAS 端保持打开状态的时间更长。
此外,如果您的应用程序不是专门设计来使用共享连接的,并且 WAS 连接池正在使用共享连接,则可能会导致连接池达到最大。默认情况下,WAS 连接池设置为共享。如果您的应用程序不是专门设计来利用共享连接的,则可能没有必要使用共享连接。您可以尝试更改为非共享连接,看看是否有效果。为了使其有所帮助,您的应用程序必须在连接上调用 close。可以通过将 globalConnectionTypeOverride 自定义属性设置为非共享来将连接更改为非共享。这可以通过以下链接中的说明来完成(“控制连接池共享”部分):
该链接声明如下:
* Control connection pool sharing.
You can use the defaultConnectionTypeOverride or globalConnectionTypeOverride connection pool custom property for a particular connection factory or data source to control connection sharing:
o The defaultConnectionTypeOverride property changes the default sharing value for a connection pool. This property enables you to control connection sharing for direct queries. If resource references are configured for this data source or connection factory the resource reference's configurations take precedence over the defaultConnectionTypeOverride property settings. For example, if an application is doing direct queries and unshared connections are needed, set the defaultConnectionTypeOverride property to unshared.
o The value specified for the globalConnectionTypeOverride custom property takes precedence over all of the other connection sharing settings. For example if you set this property to unshared, all connection requests are unshared for both direct queries and resource reference lookups. This property provides you with a quick way to test the consequences of moving all connections for a particular data source or connection factory to unshared or shared without changing any resource reference setting.
If you specify values for both the defaultConnectionTypeOverride and the globalConnectionTypeOverride properties, only the values specified for the globalConnectionTypeOverride property are used to determine connection sharing type.
To add these new custom properties to the settings for a data source or connection factory connection pool, a new connection pool custom property must be created. To add one of these properties to a data source, use the administrative console. Click Resources > JDBC > Data sources > select your data source from the list Additional properties > Connection pool properties > Connection pool custom properties > New. For other J2C or JMS connection factories, navigate to the connection factory definition in the administrative console. Then select Additional Properties > Connection pool > Connection pool custom properties > New. Now specify defaultConnectionTypeOverride or globalConnectionTypeOverride in the Name field and shared or unshared in the Value field.
Important: The properties must be set in the Connection pool custom properties and not the general Custom propeties on the data source or connection factory.
Run Code Online (Sandbox Code Playgroud)
您还可以查看以下链接以获取有关这些属性的更多信息:
以下链接提供了有关非共享与共享连接的一些背景信息:
归档时间: |
|
查看次数: |
17194 次 |
最近记录: |