Grizzly 2.0 now has JMX support.
By user12615560 on Aug 12, 2010
The team has been hard at work getting Grizzly 2.0 into shape, and it's coming along nicely. The latest feature we've added is support for JMX monitoring.
Enabling JMX Support
Grizzly 2.0 JMX support is enabled through another related project called "gmbal" (pronounced "gumball"). This project allowed us to take the grunt work out of working with JMX via JDK5 annotations. If a project has JMX requirements, it simply needs to add a maven dependency with the group id of org.glassfish.gmbal and artifact id gmbal.
Once the dependency has been included in the project, it's very simple to enable monitoring:
Giving the JMX Monitoring a Test Drive
Using the code snippet above, with the server running, connect to the server using JConsole:
Select the process of your java application and click Connect. Once connected, select the MBeans tab and expand the com.sun.grizzly root.
So, what do these MBeans represent?
- The DefaultMemoryManager provides details on the memory managed subsystem introduced in Grizzly 2.0. There will be one DefaultMemoryManager per Transport.
- FileCache provides details on the static file caching mechanism that may be enabled on a per-Transport basis.
- GrizzlyListener is an abstraction around the Grizzly 2.0 Transport. This provides details on the listener configuration (i.e., port, network host, secure, etc.).
- GrizzWebServer is the root of the JMX hierarchy.
- HttpCodecFilter monitors statistics related to HTTP protocol parsing/encoding.
- TCPNIOTransport is the concrete Transport implementation used by a GrizzlyListener. There will be one transport per GrizzlyListener instance.
- ThreadPool provides details on the threads being used by the GrizzlyWebServer. Note that this pool is shared by all Transports, however, JConsole
may show more than one thread pool as being available.
- WebServerFilter provides details on the higher level HTTP server processing (i.e., how many requests have been serviced, how may responses
are current suspended, etc.)
I've included some examples of some of the monitoring statistics that are available after making several requests to the server:
HTTP Codec Filter
Web Server Filter
If anyone decides to give this a shot and and has ideas to offer on improving monitoring support or if you find a problem, please feel free to log a request on the project issue tracker, or join the user mailing list and start a discussion with your ideas.