Discussion:
jdbc metrics
(too old to reply)
kennywu
2006-03-22 12:14:49 UTC
Permalink
Hi,

I turn on the jdbc metrics as follows in the file jrun.xml:
<attribute name="metricsFormat">Total JDBC timeouts: {jdbc.timeouts} pool
size: {jdbc.poolSize} active connections: {jdbc.activeConnections} query
duration: {jdbc.queryDuration} query count: {jdbc.queryCount}</attribute>

and the log shows:

03/22 12:41:33 metrics Total JDBC timeouts: 0 pool size: 2 active connections:
0 query duration: 0 query count: 0
03/22 12:41:43 metrics Total JDBC timeouts: 0 pool size: 2 active connections:
0 query duration: 0 query count: 0
03/22 12:41:53 metrics Total JDBC timeouts: 0 pool size: 2 active connections:
0 query duration: 0 query count: 0
03/22 12:42:03 metrics Total JDBC timeouts: 1 pool size: 1 active connections:
-1 query duration: 12 query count: 5
03/22 12:42:13 metrics Total JDBC timeouts: 0 pool size: 1 active connections:
-1 query duration: 0 query count: 0

There is a timeouts at 12:42:03 and then the active connections becomes -1.
What is the meaning of this -1?
This situation continues until I restart the jrun at about 17:02:29.

03/22 17:01:59 metrics Total JDBC timeouts: 0 pool size: 1 active connections:
-1 query duration: 0 query count: 0
03/22 17:02:09 metrics Total JDBC timeouts: 0 pool size: 1 active connections:
-1 query duration: 0 query count: 0
03/22 17:02:29 metrics Total JDBC timeouts: 0 pool size: 1 active connections:
0 query duration: 0 query count: 0
03/22 17:02:39 metrics Total JDBC timeouts: 0 pool size: 1 active connections:
0 query duration: 0 query count: 0

At about 16:59, we receive error like this when there is some database
activities:
java.sql.SQLException: SQLException while attempting to connect:
java.sql.SQLException: Io exception: Connection reset
java.sql.SQLException: SQLException while attempting to connect:
java.sql.SQLException: Io exception: The Network Adapter could not establish
the connection

This trigger the restart jrun action.

Please help. Thanks.

Regards,
Kenny
kennywu
2006-05-11 07:53:57 UTC
Permalink
When we get oracle database error such as

ORA-00001: unique constraint (XXX) violated,

the metrics for active connection becomes negative number, like this:

metrics Total JDBC timeouts: 0 pool size: 1 active connections: -1 query
duration: 0 query count: 0

If similar error occurred, the active connection metric becomes -2, -3, etc.

What is the meaning of the negative number of active connection? Does this
imply the database connection pool has problem and not running properly?
kennywu
2006-05-11 09:01:31 UTC
Permalink
The data-source part in jrun-resources.xml is as follows:

<data-source>
<dbname>xxx</dbname>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<url>jdbc:oracle:thin:@xxx:1521:xxx</url>
<username>xxx</username>
<password>xxx</password>
<encrypted>false</encrypted>
<encryption-class>jrun.security.JRunCrypterForTwofish</encryption-class>
<native-results>true</native-results>
<remove-on-exceptions>true</remove-on-exceptions>
<pool-statements>false</pool-statements>
<initial-connections>1</initial-connections>
<connection-timeout>1200</connection-timeout>
<transaction-timeout>20</transaction-timeout>
<cache-enabled>false</cache-enabled>
<cache-size>5</cache-size>
<cache-refresh-interval>30</cache-refresh-interval>
<jndi-name>xxx</jndi-name>
<poolname>Pool</poolname>
<minimum-size>40</minimum-size>
<maximum-size>40</maximum-size>
<user-timeout>200</user-timeout>
<skimmer-frequency>420</skimmer-frequency>
<shrink-by>5</shrink-by>
<maximum-soft>false</maximum-soft>
<debugging>false</debugging>
<disable-pooling>false</disable-pooling>
<description />
</data-source>

Loading...