What information is the Db2 for z/OS administrator seeing that leads to his conclusion that there are millions of connections and millions of threads on the z/OS side of this application? That would be odd behavior, to say the least. A Java application accessing Db2 for z/OS via TCP/IP communication links typically establishes a reasonable number of connections to the Db2 for z/OS server (70 connections - from the client-side perspective - does not seem at all unreasonable), and these connections tend to persist until the Java application explicitly terminates them (and that typically does not happen often - connections to the Db2 server are established and remain for quite some time and are reused for many transactions). A connection could be terminated by Db2 in case of an "idle thread timeout" situation, but that is generally an unusual occurrence. [If the idle thread timeout value for the Db2 for z/OS is 120 seconds, that would mean that Db2 would terminate the thread - and the associated connection - used by a client-server transaction if that transaction had gotten started and then appeared to Db2 to have gone into a "hung state." In practical terms, this means that the transaction started and did some work and then never committed - lack of the commit means lack of "end of transaction" from Db2's perspective, and that can lead to an idle thread timeout situation.] If millions of "idle thread timeout" situations were occurring on the Db2 server side, I think the Db2 administrator would notice that.
As for threads, "millions" is similarly unlikely. Db2 for z/OS maintains a pool of threads (called DBATs in Db2 for z/OS lingo - short for database access threads) that are used for network-connected, client-server applications. A given DBAT will normally be used for 200 transactions (500, if the Db2 for z/OS system is at the Version 13 level) before being terminated by Db2 (to free up associated resources - helps to keep the server-side system from getting "gummed up"), so "millions of threads" (meaning millions of DBAT create actions by Db2) would normally require a humungous number of transactions over an extended period of time.
As for transaction load, 25,000 transactions per minute (a little over 400 per second) is not a big deal for a Db2 for z/OS server. Plenty of Db2 for z/OS systems are processing thousands of client-server transactions per second (potentially N times thousands-per-second if the Db2 system is a so-called data sharing group with N members).
------------------------------
Robert Catterall
------------------------------
Original Message:
Sent: Thu September 12, 2024 06:11 AM
From: Haug Bürger
Subject: Java vs DB2
I got a call from the DB2 admin that my application creates a new connection for each transaction.
I checked the app running on Kubernetes using the latest JDBC driver jcc 11.5.9 that the connection pool is properly configured. Logging says yes, and also the metrics say yes. From the Java point of view everything looks ok. 70 JDBC connections and millions of usages.
The zOS admin says he sees millions of connections and even worse millions of threads. The problem with the threads is that they eat up a lot CPU.
Now I'm lost. Yes, the app creates 25000 transaction per minute. Is this to much for DB2? I assumed that DB2 also reuses resources/threads. I actually have no idea what happens between the JDBC layer and the database on zOS. Has somebody a link that explains what happens in between? Or an idea what's going on there?
------------------------------
Haug Bürger
------------------------------