tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary Bedell <zbed...@nycourts.gov>
Subject Re: Get JDBC pool capacity
Date Fri, 28 Oct 2016 20:12:15 GMT
That doesn't exist for me at all in jconsole.

Screenshot: http://imgur.com/a/5mMgz

If I enumerate JMX using an ObjectName of "openejb.management:*" with something like the code
below, there's no "datasources" in any of the found objects.  Nothing matching the names of
my pools either.

final ObjectName name = new ObjectName("openejb.management:*");
final Set<ObjectInstance> search = mbeanServer.queryMBeans(name, null);
for(final ObjectInstance objectInstance : search) {
  System.out.println(objectInstance.getObjectName().getCanonicalName());
}

-Zac

On Oct 28, 2016, at 15:55, Romain Manni-Bucau <rmannibucau@gmail.com<mailto:rmannibucau@gmail.com>>
wrote:

openejb.management > datasources



Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-28 21:41 GMT+02:00 Zachary Bedell <zbedell@nycourts.gov<mailto:zbedell@nycourts.gov>>:

Would the stats show up in a different part of the tree?  I don't see the
datasources entry at all under openejb.management.

I can find DataSourceFactory objects under:

Catalina:class=org.apache.openejb.resource.jdbc.DataSourceFactory,name="
EARNAME/POOLNAME",resourcetype=Global,type=Resource


The DataSource's themselves show up in every WAR they're injected into:

Catalina:type=DataSource,host=localhost,context=/WARNAME,
class=javax.sql.DataSource,name="openejb/Resource/POOLNAME"


Neither the DataSource nor DataSourceFactory expose anything that looks
like active or max connections.

We're trying pretty hard to keep everything related to the app in its own
EAR rather than globally in tomee.xml.  So far the only thing we have in
tomee.xml is a <Deployments dir="X"/> entry where we're dropping the EAR's.

-Zac

On Oct 28, 2016, at 15:28, Romain Manni-Bucau <rmannibucau@gmail.com<mailto:rmannibucau@gmail.com>>
wrote:

they are, name is just prefixed with app name


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/
rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-10-28 21:14 GMT+02:00 Adam Cornett <adam.cornett@gmail.com<mailto:adam.cornett@gmail.com>>:

Perhaps, my datasources are defined at the container level
(conf/tomee.xml). Perhaps the app level data sources are not registered
in
JMX.
Romain or another dev would need to speak to that.

On Fri, Oct 28, 2016 at 2:29 PM, Zachary Bedell <zbedell@nycourts.gov<mailto:zbedell@nycourts.gov>>
wrote:

Yes to TomEE 7.0.1, but I don't see a datasources entry under
openejb.management in jconsole.  I've got Invocations, JAX-RS, JAX-WS,
Pool, TransactionManager, and containers.

Guessing maybe the way I define the datasources may be relevant?
They're
in a resources.xml file inside an EAR.  Defined like:

<Resource id="ucmsTXPool" type="DataSource">
  JdbcDriver oracle.jdbc.xa.client.OracleXADataSource
  JdbcUrl ${ucmsTXPool.JdbcUrl}
  User ${ucmsTXPool.User}
  UserName ${ucmsTXPool.User}
  VaultPassword ${ucmsTXPool.Password}
  InitialSize ${ucmsTXPool.InitialSize}
  MaxActive ${ucmsTXPool.MaxActive}
  MaxIdle 10
  MaxWait 15000
  ValidationQuery "SELECT sysdate FROM DUAL"
  TestOnBorrow true
  TestOnReturn true
  TestWhileIdle true
  TimeBetweenEvictionRunsMillis 60000
  AccessToUnderlyingConnectionAllowed true
  JtaManaged true
</Resource>

The ${...} are loaded from a config repository via a Listener in
server.xml.  The VaultPassword is handled via custom PasswordCipher
registered via META-INF/org.apache.openejb.cipher.PasswordCipher in a
jar
in server/lib.

-Zac

On Oct 28, 2016, at 14:09, Adam Cornett <adam.cornett@gmail.com<mailto:adam.cornett@gmail.com>>
wrote:

Sure:
openejb.management/datasources/[DSNAME] should have attributes such
as:
Size, Idle, WaitCount, etc.

There should be an object for each datasource defined in your
tomee.xml
file.  I'm assuming you're on TomEE 7?

On Fri, Oct 28, 2016 at 2:03 PM, Zachary Bedell <zbedell@nycourts.gov<mailto:zbedell@nycourts.gov>

wrote:

Adam, your image didn't come through the list, at least for me.  Can
you
give me a textual path to where you're looking?


The only thing listed as openejb under mbeans is
"openejb.management."
There's nothing under there that matches the names of any of my
pools.
The
only matches for "datasource" I see are the containers for the
stateless,
stateful, singleton, and managed beans.  The only pool related stuff
I
see
under there is for the EJB instances.

I see an "Active" attribute under the TransactionManager, but that's
not
per-pool, and I'm not sure that it represents all of the JDBC
connections
as opposed to an EJB container transaction.  We'd have EJB's that are
set
@TransactionAttribute(NOT_SUPPORTED) as well as single transactions
that
touch several connection pools (XA), so active transactions from the
container's point of view isn't granular enough to know if one of the
pools
is running low.

-Zac




On Oct 28, 2016, at 13:30, Adam Cornett <adam.cornett@gmail.com<mailto:adam.cornett@gmail.com><
mailto:
adam.cornett@gmail.com<mailto:adam.cornett@gmail.com>>> wrote:

Here is a screenshot out of jconsole showing the location and
attributes:


On Fri, Oct 28, 2016 at 1:21 PM, Romain Manni-Bucau <
rmannibucau@gmail.com<mailto:rmannibucau@gmail.com>
<mailto:rmannibucau@gmail.com>> wrote:
Hi Zachary,

2016-10-28 19:18 GMT+02:00 Zachary Bedell <zbedell@nycourts.gov
<mailto:
z
bedell@nycourts.gov<mailto:bedell@nycourts.gov>>>:

Good afternoon,

I'm working on a monitoring agent for TomEE to plugin to an in-house
package we use.  One of the most common failures in our current app
server
(JBoss) usually manifests as expended JDBC connection pools, so we
alert
as
pools approach full to get some kind of warning of impending doom
when
the
database can't keep up.

I need to get a handle on TomEE's datasource pools to check their
maximum
size & current active connection count programatically.  I've tried
searching through both JMX (how we do it in JBoss) and the JNDI
tree.
I
can find the javax.sql.DataSource in both trees as well as a
reference
to
org.apache.openejb.resource.jdbc.DataSourceFactory in JMX.  It
doesn't
appear any of the objects I've been able to find expose a count of
active
connections nor what the configured maximum is.


in openejb MBeans it should be there


Is there a way to get the count of active connections & the
configured
max
for a named connection pool (I can find the names via JMX or JNDI)
or
for
all connection pools?



Thanks in advance,
Zac Bedell





--
Adam Cornett
adam.cornett@gmail.com<mailto:adam.cornett@gmail.com><mailto:adam.cornett@gmail.com>
(678) 296-1150




--
Adam Cornett
adam.cornett@gmail.com<mailto:adam.cornett@gmail.com>
(678) 296-1150




--
Adam Cornett
adam.cornett@gmail.com<mailto:adam.cornett@gmail.com>
(678) 296-1150





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message