Payara Server provides many metrics within JMX beans. The most interesting metrics are the statistics around pools for HTTP threads and JDBC Connection pooling.
On the other hand, Payara Server also implements the MicroProfile Metrics specification. The retrieval of useful metrics from the running instance in the areas of CPU, memory, Class loading, and other MicroProfile specifications (like Fault Tolerance), are possible through the implementation of the MicroProfile Metrics in Payara Server.
MicroProfile allows for vendor-specific extensions and Payara Server has an extension to expose any JMX bean value through the MicroProfile Metrics endpoint.
This blog shows how you can get the HTTP threads and JDBC Connection pooling statistics exposed.
Activating JMX Bean Monitoring in Payara Server
The JMX beans are not active by default. You can activate them through the web console or the admin command line.
When using the web console, select the Monitoring menu on left and then click on the Configure Monitoring link.
Select the AMX beans and define for which subsystems you want to have the detailed monitoring information, like JDBC connection pooling and HTTP Service.
Click the save button and restart the domain so that the changes take effect.
This activation can also be performed from the asadmin CLI interface. The following commands can be issued to have the same effect:
Define Metrics for JMX Bean Values
Payara Server has the option to define a mapping between a JMX value and a MicroProfile Metric item. The only thing you need to do is define the JMX values which needs to be exposed.
This can be done by creating a file named metrics.xml in the directory <payara-home>/glassfish/domains/<domain>/config.
The content to expose some valuable information from the HTTP and JDBC Connection Thread pool is
You can also see the usage of wildcards in action in the above configuration. Have a look at the definition around the number of open connections for each pool.
If you define the pool name like xxPool, yyPool, etc .. then statistics for all these connection pools are exposed with an appropriate name due to the usage of the %s in the definition.
Other useful JMX bean values can be found in the Payara Platform documentation.
Expose JMX Bean Values to MicroProfile Metrics Endpoint in Payara Server
With Payara Server it is very easy to expose JMX bean values to the MicroProfile Metrics endpoint by just defining a mapping file. Statistics around the Thread pool usage (open, total connection, queue usages, etc) for example indicate the load on your server instance and can be used to optimize your instances.
Learn About Monitoring Options in Payara Server
Download our User Guide: