Mantis - Resin
Viewing Issue Advanced Details
2422 minor always 02-11-08 13:51 06-17-08 14:33
ferg  
ferg  
normal  
closed  
fixed  
none    
none 3.2.0  
0002422: PortMXBean statistics
(rep by Knut Forkalsrud)

I'm trying to get some statistics out of my Resin instance through the JMX beans.
Some of the interesting metrics on PortMXBean seem to be missing, notably the
following properties:

requestCountTotal
requestCountKeepalive
requestCountClientDisconnect
requestTimeTotal
requestBytesRead
requestBytesWritten

I've tried to trace the source code for where they're updated, but I can't find any
code that does that. The attached jsp page illustrates the issue. As I load the
page over and over the metrics do not change, they're always zero. I've run this
on 3.1.4 and 3.0.23, and they're both the same in this respect. Is there a trick
I need to invoke to get this going, or is it simply not implemented?

Thanks

Knut Forkalsrud

<%@ page contentType="text/plain; charset=UTF-8" %>
<%@ page info="stats.jsp" %>
<%@ page import="java.util.*, com.caucho.jmx.Jmx, com.caucho.management.server.*" %>
<%!

 void println(JspWriter out, String name, Object value) throws java.io.IOException {
     out.println(name + ": " + String.valueOf(value));
 }

%>
<%
ResinMXBean _resin = (ResinMXBean) Jmx.findGlobal("resin:type=Resin");
ServerMXBean _server = (ServerMXBean) Jmx.findGlobal("resin:type=Server");
ProxyCacheMXBean _proxyCache = (ProxyCacheMXBean) Jmx.findGlobal("resin:type=ProxyCache");
ThreadPoolMXBean _threadPool = (ThreadPoolMXBean) Jmx.findGlobal("resin:type=ThreadPool");


println(out, "version", com.caucho.Version.VERSION);
println(out, "server id", _server.getId());
println(out, "configFile", _resin.getConfigFile());
println(out, "startTime", _server.getStartTime());
println(out, "invocationCache.hit", _server.getInvocationCacheHitCountTotal());
println(out, "invocationCache.miss", _server.getInvocationCacheMissCountTotal());
if (_proxyCache != null) {
   println(out, "proxyCache.hit", _proxyCache.getHitCountTotal());
   println(out, "proxyCache.miss", _proxyCache.getMissCountTotal());
}
println(out, "threads.active", _threadPool.getThreadActiveCount());
println(out, "threads.idle", _threadPool.getThreadIdleCount());
println(out, "threads.total", _threadPool.getThreadCount());
println(out, "threads.max", _threadPool.getThreadMax());

PortMXBean[] portList = _server.getPorts();
for (PortMXBean bean : portList) {
   String p = String.valueOf(bean.getPort());
   println(out, "port." + p + ".state", bean.getState());
   println(out, "port." + p + ".host", bean.getAddress() != null ? bean.getAddress() : "*");
   println(out, "port." + p + ".protocol", bean.getProtocolName());
   println(out, "port." + p + ".requestCountTotal", bean.getRequestCountTotal());
   println(out, "port." + p + ".requestCountKeepalive", bean.getKeepaliveCountTotal());
   println(out, "port." + p + ".requestCountClientDisconnect", bean.getClientDisconnectCountTotal());
   println(out, "port." + p + ".requestTimeTotal", bean.getRequestTimeTotal());
   println(out, "port." + p + ".requestBytesRead", bean.getReadBytesTotal());
   println(out, "port." + p + ".requestBytesWritten", bean.getWriteBytesTotal());
}
%>

Notes
(0002960)
ferg   
04-10-08 14:33   
These are currently stub values.
(0003204)
ferg   
06-17-08 14:33   
server/2794