How to have a single JMX proxy for multiple JVMs?
Asked Answered
A

1

7

When running multiple JVMs on a single machine (single IP address as well), incorporating JMX in each JVM requires a separate port. For reasons I won't get into configured ports are at a premium in this environment, so instead I'd like to have a single JMX proxy on each machine that is capable of providing access to each of the local JVMs and their JMX data. This would be similar to a local SNMP daemon with agents running in each separate process.

Ephemeral ports are fine, however, since they're outside the contested range of ports I have access to for configuring JMX explicitly.

I know that products like Oracle Coherence do this internally, but are there any general solutions for doing this?

Adulation answered 26/7, 2011 at 14:56 Comment(0)
C
4

The OpenDMK supports MBeanServer Cascading which is logically what you want to achieve, which is exposing multiple MBeanServers under the facade of one MBeanServer. The problem is that there is not "port free" form of inter-JVM JMX remoting, even for JVMs on the same host, so each JVM will still need to bind to at least 1 port, even if it is only accessed on localhost.. (Using JMXMP is your best bet for minimizing port usage since it is a single socket solution rather than RMI which is ..... non-deterministic). If you can live with this, then the Cascading actually works quite nicely and the protocol is implemented in the standard contemporary JMX remoting spec.

The only other way I can think of to allow for many more JVM/JMX Servers than actual ports on a host would be to develop a "TCP-less" JMX Connector Service Provider or multicast.

Catchpenny answered 26/7, 2011 at 17:4 Comment(3)
Yes, that's just what I was looking for. I had actually just found this independently: weblogs.java.net/blog/emcmanus/archive/2007/08/… and it seems to work well. Because it's using ephemeral and not configured ports it actually works out for me.Adulation
Cool. You can also use the Attach API to find JVMs, activate and connect to the management agent (JMX server) in each JVM that you find. The two API's are quite complimentary for what you want to do. Caveat: The attach api will not work if the "seeker" does not have OS privileges to signal another JVM)Catchpenny
Yes, the attach API is perfect for this. Also, it only works for Sun JVMs as well.Adulation

© 2022 - 2024 — McMap. All rights reserved.