If you've upgraded to Payara Server 5 or are considering using Payara Server in production, here are 4 production features you might not know about - but should.
1)Payara Server Can Detect and Log Slow SQL Queries Executed Via a Connection Pool.
The Slow SQL logger monitors all queries executed on the connection pool and if they exceed a configurable execution time in seconds, a warning message is logged into the server log. The warning message (see below) logs the SQL query and the stack trace to the code executing the query. This enables rapid diagnosis, pinpointing the exact lines of code to investigate.
To configure slow SQL logging via the administration console, navigate to the connection pool's Advanced Properties tab and specify the Slow Query Log Threshold time in seconds. A value of -1 disables logging of slow queries.
2)Payara Server Can Display Real-Time Statistics from the System Shell Using asadmin.
From within a system shell, we may run the asadmin monitor command to display real-time statistics. The --type parameter specifies which monitoring component should be monitored:
This command will log real-time data in intervals (every 30 seconds by default). We may redirect the output of the command to a file to archive monitoring information. There are 4 type of statistics we can monitor (arguments to --type parameter):
The command asadmin help monitor will provide detailed information about the monitor command.
Using asadmin, we can also access all the monitoring data by executing the following command:
This command will return all available server and application monitoring data. This might easily be several hundred lines of text. Of course, we can use a more precise filter to limit the amount of data:
Or we may request data only about a specific module, for example:
These commands provide exactly the same amount of information that is available through the REST interface. The last command corresponds to the following URL:
3) Payara Server Comes with a General Notification Service Which Includes the Request Tracing Service.
The Request Tracing Service provides tracing facilities for multiple protocols and process communications done by the components of deployed applications.
The service helps users to detect application slowness and performance degradation by logging requests that exceed a given threshold. The trace data from long-running requests gives insight to solving bottlenecks and other performance issues.
Because Request Tracing (and other monitoring) services depend on the Notification service to output their data, both the Notification service itself, and at least one notifier, must be enabled for any data to be recorded. If this does not happen, then the data will be discarded.
Below is a sample output from enabling the request tracing service in the admin console:
4) Payara Server Provides Support for Custom SQL Trace Listeners.
A SQL Trace Listener is registered against a data source and is called after each method call made on the JDBC connection pool.
SQL Trace Listeners allows developers to track all calls to the database and can be used to develop custom auditing, error handling or monitoring components. SQL Trace Listeners can be enabled globally on a data source if the class that implements it is on the server’s classpath, or can be enabled on application specific data sources by including them in the application’s WAR or EAR.
Configuring SQL Trace Listeners Using the Payara Server Administration Console
SQL Trace Listeners can be enabled on a JDBC connection pool through the administration web console. Navigate to the Advanced Tab of your connection pool by selecting the JDBC → JDBC Connection Pools → <Your Connection pool>.
Proceed to add the fully qualified class name of your SQL Trace Listener implementation class in the SQL Trace Listeners field:
Payara Micro also supports SQL Trace Listeners which brings powerful operational diagnostics to your microservices platform. Take a look at the instructions in the technical documentation to write a custom trace listener in the Payara Platform.
Want to learn more about using Payara Server in production? Take a look at our In Production Resources.
If you need help migrating to Payara Server or supporting your production Payara Server environment, consider our commercial support services.
If you're not yet using Payara Server, download the open source software and try it out!