简体   繁体   English

在DB2中设置最大事务持续时间

[英]set max transaction duration in DB2

Is there a way to set a max duration for transactions in DB2 10.1? 有没有一种方法可以设置DB2 10.1中事务的最大持续时间?

My application makes a query that lasts for about 10 minutes on the database. 我的应用程序对数据库进行了大约10分钟的查询。 My application though waits only for 240 seconds for an answer, so after that the transaction will time out. 我的应用程序虽然只等待240秒才能得到答案,所以在那之后事务将超时。 But on my db monitor I see that the query is still running and is using a lot of CPU. 但是在我的数据库监视器上,我看到查询仍在运行并且正在使用大量CPU。 I would like to stop that query also, because my application is not going to see the results anyway (with the current configuration). 我也想停止该查询,因为我的应用程序无论如何都不会看到结果(使用当前配置)。 Is there a way to config DB2 to stop such long running queries? 有没有一种方法可以配置DB2停止这么长时间运行的查询?

In my application I run this: 在我的应用程序中,我运行以下命令:

List<MyData> result = query.getResultList();

And in my SystemOut.log I end up with this: 而在我的SystemOut.log中,我最终得到以下结果:

0000000b TimeoutManage I   WTRN0124I: When the timeout occurred the thread with which the transaction is, or was most recently, associated was Thread[WebContainer : 305,5,main]. The stack trace of this thread when the timeout occurred was: 
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:140)

The query command though is not interrupted but waits until the db is finished and I get a transaction exception. 查询命令虽然没有被中断,但是一直等到数据库完成并且出现事务异常。 So the connection is still intact but my transaction was timed out before. 因此连接仍然完好无损,但是我的交易之前已经超时。 (The application is running on WAS 8.0) (该应用程序在WAS 8.0上运行)

I guess the reason for the query continuing to execute is that, while the connection running it is returned to the pool, it is not closed. 我猜查询继续执行的原因是,虽然运行它的连接返回到池中,但它没有关闭。

DB2 for LUW includes the Workload Manager feature that allows you to define various thresholds for specific identifiable workloads and perform some actions when the thresholds are exceeded, including stopping the running activity. DB2 for LUW包含工作负载管理器功能,该功能使您可以为特定的可识别工作负载定义各种阈值,并在超过阈值时执行一些操作,包括停止正在运行的活动。 You will find examples of how to define a threshold and the associated work action in the manual. 您将在手册中找到有关如何定义阈值和相关工作措施的示例

Note that most Workload Manager features require the Advanced Enterprise Edition license for DB2. 请注意,大多数Workload Manager功能都需要DB2的Advanced Enterprise Edition许可证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM