Not all Oracle ADF projects are built with ADF Business Components (ADF BC). Some organizations prefer to use EJB/JPA (EclipseLink) instead of ADF BC. The EclipseLink JPA provides developers with a standards based Object-Relational persistence solution. The application still reflects the Model-View-Controller architecture. In this case the model is provided by EJB Components, while the view and controller are provided by the ADF framework. In addition to the standard ADF stack (ADF BC, ADF Model, ADF Controller, ADF Faces) the ADF Performance Monitor supports more technologies in the ADF landscape; like EJB/JPA (implemented with EclipseLink), POJO Java based DataControls, JAX-WS webservices, custom instrumentation, e.g.. This blog describes how the performance and health of EJB/JPA based ADF applications can be monitored and analyzed. The new features include EJB specific executions that are visible in ADF request callstacks of the monitor (a kind of ADF stack trace that shows where the request execution time is spent):
- EJB/JPA DataControl operations/methods
- Runtime invoked methods on EJB SessionBeans
- SQL queries and DML actions executed to the database
EJB/JPA specific executions in ADF Callstacks
In the following examples ADF callstacks are shown of the ADF Performance Monitor of an HR application based on EJB/JPA. I reproduced some ‘slow’ queries with this application. In the call stacks, when we click on an execution, detail runtime information is shown in a popup. Like method name, SessionBean- or EntityBean name, parameters, e.g. Also the SQL query executed against the database (SQL link) as well as the EclipseLink specific query is visible.
1 -In this case, apparently there were two SQL queries executed from EJB/JPA that took more than 1.5 seconds to execute (shown in yellow in the request percentage gauges). Also we can inspect the performance and other (runtime) information of methods executed from the DataControl; employeesFindAll(), initDataCollection(). We can see that the method queryByRange() was executed from the oracle.model.HRFacadeBean (an EJB SessionBean).
- The runtime execution of select count(o) from Employees o,0,0 (EclipseLink specific query) took 1524 milliseconds. The ‘translated’ query against the Oracle database was SELECT COUNT(EMPLOYEE_ID) FROM EMPLOYEES and this took 1523 milliseconds.
- Also the query SELECT EMPLOYEE_ID, COMMISSION_PCT, EMAIL, FIRST_NAME, HIRE_DATE, JOB_ID, LAST_NAME, PHONE_NUMBER, SALARY, DEPARTMENT_ID, MANAGER_ID FROM EMPLOYEES was 1529 milliseconds – too long for a simple HR app 🙂
Now we can investigate the root cause of these slow EJB/JPA database executions and troubleshoot it. In the same way production problems can be investigated and resolved.
2 – A call stack example of an insert (persist) action in EJB/JPA (and a UNIQUE key violation exception). We can inspect execution details by clicking for example on the dataControl method persistDepartments(), and inspect the INSERT statement by clicking on the SQL link:
3- Example of a delete action in EJB/JPA:
In the Configuration settings of the ADF Performance Monitor, a parameter can be set whether the monitor should log the SQL and DML statements of ADF Business Components or EJB/JPA or not. If yes, a threshold can be set when it should be collected. For example all SQL queries and DML statement over five seconds (5000 milliseconds):
Also, at the main dashboard the database time executed from EJB/JPA is visible in the graph at the right bottom. It shows for each time range (month/week/day/hour/5 minute) the layer where the execution time is spent. It shows the time spent in the database, webservice, application server, and network/browser load time. At the top right graph (hour overview in this case) we can see some red indicating some very slow requests. In the graph at the right bottom we can now explain what happened; the time was spent in the database – in this case slow queries executed from the ADF application by EJB/JPA.
Growing supports for more technologies
In addition to the standard ADF stack (ADF BC, ADF Model, ADF Controller, ADF Faces) The ADF Performance Monitor supports more technologies around the ADF landscape:
- JPA/EJB (EclipseLink)
- POJO JavaBean DataControl
- JAX-WS Webservices
- Possibility to instrument (calls to) custom Java methods and 3rd party libraries
- Application servers: WebLogic, Glassfish and Tomcat
You can get more information on the ADF Performance Monitor website at adfpm.com. A one month trial version is available on demand here.