Resin Documentationapp server |
jmx
JMX Consoles provide access to both the MBean's that Resin publishes for information about and control of the Resin server and Application specific MBeans. JDK 5.0 includes a JMX implementation that is used to provide local and remote administration of a Resin server. win> ./resin.exe -Dcom.sun.management.jmxremote unix> bin/resin.sh -Dcom.sun.management.jmxremote win> jconsole.exe unix> jconsole Choose Resin's JVM from the "Local" list. win> ./resin.exe -Dcom.sun.management.jmxremote.port=9999 unix> bin/resin.sh -Dcom.sun.management.jmxremote.port=9999 Without some configuration effort, the previous command will not work. Password configuration and SSL configuration is required by the JDK implementation of remote JMX. Detailed instructions are included in the JDK documentation. The following is useful for testing, but should be done with caution as the port is not protected by password or by SSL, and if not protected by a firewall is accessible by anyone who can guess the port number. win> ./resin.exe -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false unix> bin/resin.sh -Dcom.sun.management.jmxremote.port=9999 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false win> jconsole.exe unix> jconsole Enter the host name and port number (9999) on the "Remote" tab $ cd $JAVA_HOME/jre/lib/management $ cp jmxremote.password.template jmxremote.password $ chmod u=rw jmxremote.password $ vi jmxremote.password Set a password for "monitorRole" and "controlRole": monitorRole 12monitor controlRole 55control win> ./resin.exe -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false unix> bin/resin.sh -Dcom.sun.management.jmxremote.port=9999 \ -Dcom.sun.management.jmxremote.ssl=false win> jconsole.exe unix> jconsole
Instrumenting resources so JMX can manage them consists of the following steps:
Instrumenting a servletResin will automatically register any servlet which implement an MBean interface. By default, the JMX name will be:
web-app:j2eeType=Servlet,name=
The domain is JMX clients will use the name to manage the servlet. For example, a client might use the pattern to retrieve all managed servlets.package test; public interface MyServletMBean { public int getCount(); } package test; import java.io.*; import javax.servlet.*; public class MyServlet extends GenericServlet implements MyServletMBean { private int count; public int getCount() { return count; } public void service(ServletRequest request, ServletResponse response) throws IOException { PrintWriter out = response.getWriter(); count++; out.println("Hello, world"); } } Managing resources uses the JMX API, primarily using
the import javax.management.*; ... MBeanServer server = MBeanServerFactory.createMBeanServer(); ObjectName name = new ObjectName("web-app:j2eeType=javax.servlet.Servlet," + "name=hello"); Object value = server.getAttribute(name, "Count"); out.println("Count: " + value); The proxy cache is Resin's internal proxy cache (in Resin Pro). The hit ratio marks what percentage of requests are served out of the cache, i.e. quickly, and which percentage are taking the full time. The proxy cache hit ratio is useful for seeing if you can improve your application's performance with better caching. For example, if you had a news site like www.cnn.com, you should have a high hit rate to make sure you're not overtaxing the database. If you have a low value, you might want to look at your heavily used pages to see if you can cache more.
|