JBoss JPA Test

The Java Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects / classes and a relational database. JPA itself is just a specification, not a product; it cannot perform persistence or anything else by itself. JPA is just a set of interfaces, and requires an implementation. JPA also requires a database to persist to. The JPA allows POJO (Plain Old Java Objects) to be easily persisted without requiring the classes to implement any interfaces or methods. JPA allows an object's object-relational mappings to be defined through standard annotations or XML defining how the Java class maps to a relational database table. JPA also defines a runtime EntityManager API for processing queries and transaction on the objects against the database. JPA defines an object-level query language, JPQL, to allow querying of the objects from the database.

An entity is a lightweight persistence domain object. Typically, an entity represents a table in a relational database, and each entity instance corresponds to a row in that table. The primary programming artifact of an entity is the entity class, although entities can use helper classes.

The persistent state of an entity is represented through either persistent fields or persistent properties. These fields or properties use object/relational mapping annotations to map the entities and entity relationships to the relational data in the underlying data store.

The JPA persistence context contains the entities managed by the persistence provider. The persistence context acts like a first level (transactional) cache for interacting with the datasource. Loaded entities are placed into the persistence context before being returned to the application. Entities changes are also placed into the persistence context (to be saved in the database when the transaction commits).

Collection-valued persistent fields and properties must use the supported Java collection interfaces regardless of whether the entity uses persistent fields or properties. The following collection interfaces may be used:

  • java.util.Collection
  • java.util.Set
  • java.util.List
  • java.util.Map

If the entity class uses persistent fields, the type in the preceding method signatures must be one of these collection types. Generic variants of these collection types may also be used. While an administrator is monitoring an application in real-time, he/she may not be aware of a sudden slowdown/malfunctioning of the application due to technical glitches at the backend. This may be due to a sudden change in the entities and collections of the Java Persistence API which when left unnoticed will render the application inaccessible to users. To avoid such a situation, you can use the JBoss JPA test. For each entity of an application that is to be monitored, this test reports the number of times each entity was loaded, inserted, fetched, updated, etc. In due course, this test also reports the number of times the collection of each entity was loaded, inserted, deleted, fetched,etc. This way administrators can proactively be alerted to technical failures of the applications and rectify the same before end users start complaining!

Target of the test : A WildFly JBoss server

Agent deploying the test : An internal agent

Outputs of the test : One set of results for each Application:entity of the target WildFly JBoss that is to be monitored

Configurable parameters for the test
  1. TEST PERIOD - How often should the test be executed
  2. Host – The host for which the test is to be configured
  3. port– The port at which the specified HOSTlistens. By default, this is 9990.
  4. SSLIf the WildFly JBoss server being monitored is an SSL-enabled server, then set the sslflag to Yes. If not, then set the sslflag to No.
  5. IS JBOSS RUNNING IN DOMAIN MODE?– Specify whether the server to be monitored is currently running in DOMAIN MODE or not. By default, this flag is set to No which implies that the server is currently running in STANDALONE MODE. If you have started the target JBoss server using the default web profile configuration in domain mode i.e, if you have executed the ./domain.sh command from the <JBoss_INSTALL_DIR>/bin directory, then specify Yes against this flag.
  6. JBOSS HOST NAME – Specify whether the target server to be monitored is a master or a slave in a JBoss cluster. By default, none will be specified here which implies that the target JBoss server is a standalone server. Refer to Identifying the host name and server instance name of the WildFly JBoss server running in Domain mode to know how to identify whether the target server is a master or slave in your environment.
  7. JBOSS SERVER INSTANCE NAME– Specify the name of the server instance that is to be monitored. By default, none will be specified here. Refer to Identifying the host name and server instance name of the WildFly JBoss server running in Domain mode to identify the name of the server instance that is to be monitored. 
  8. MANAGEMENT USER and MANAGEMENT PASSWORD– Specify the credentials of the user who is authorized to access the management console of the target JBoss server. To create a new user, refer to Creating a new management user in the WildFly JBoss server of this document.
  9. confirm password– Confirm the MANAGEMENT PASSWORD by retyping it here.
Measures made by the test:
Measurement Description Measurement Unit Interpretation

Entity Load count:

Indicates the number of times this entity was loaded.

Number

Comparing the value of this measure across the entities will help you identify the entity that is the busiest -  in terms of loading on the application.

Entity Insert count:

Indicates the number of times this entity was inserted.

Number

 

Entity Fetch count:

Indicates the number of times this entity was fetched.

Number

 

Entity Update count:

Indicates the number of times this entity was updated.

Number

 

Entity Delete count:

Indicates the number of times this entity was deleted.

Number

 

Entity Failure count:

Indicates the number of times this entity failed.

Number

A low value is desired for this measure. A sudden/gradual increase in the value of this measure is a cause of concern as this may lead to poor user experience.

Collection Load count:

Indicates the number of times the collection was loaded on this entity.

Number

 

Collection Recreate count:

Indicates the number of times the collection was recreated for this entity.

Number

 

Collection Fetch count:

Indicates the number of times the collection was fetched for this entity.

Number

 

Collection Update count:

Indicates the number of times the collection was updated for this entity.

Number

 

Collection Remove count:

Indicates the number of times the collection was removed from this entity.

Number