Skip to content

Jakarta EE 5/6/7/8/10 WildFly/JBoss EAP Clustering Benchmark Application

License

Notifications You must be signed in to change notification settings

rhusar/clusterbench

 
 

Repository files navigation

ClusterBench CI Version

ClusterBench is a simple application that can be deployed in a cluster of JBoss AS 7 (EAP 6), WildFly 8 and newer. Once deployed it is easy to stress (using JMeter, curl, etc.) and monitor the performance of the cluster while at the same time it can be easily checked the correctness of replicated sessions.

Support Matrix

Branch WildFly Version Tomcat Version EE Version(s) Base JDK

main

35

10.1

Jakarta EE 10

17

11.x

34

10.1

Jakarta EE 10

11

10.x

33

10.1

Jakarta EE 10

11

9.x

32

10.1

Jakarta EE 10

11

8.x

31

10.1

Jakarta EE 10

11

7.x

30

10.1

Jakarta EE 10

11

6.x

29

10.1

Jakarta EE 10

11

5.x

28

10.1

Jakarta EE 10

11

4.x

27

10.1

Jakarta EE 10

11

3.x

26 (and previous)

Java EE 5, EE 6, EE 7, EE 8

8

Building

Clone the Git repository first and switch to its directory:

git clone https://github.com/clusterbench/clusterbench.git

Build the default main branch to build the latest Jakarta EE 10 version:

./mvnw clean package

Output files:

./clusterbench-ee10-ear/target/clusterbench-ee10.ear

Running

You can also use wildfly-maven-plugin to run a container with the project already deployed. It will also provision the server without having to download anything manually.

./mvnw clean wildfly:run

and navigate your browser to http://localhost:8080/clusterbench/.

Deploying

WildFly

You can use the deploy goal of the WildFly Maven Plugin to deploy to your running instance by running:

./mvnw wildfly:deploy

which will deploy the resulting EAR to the running server.

To do this manually, copy clusterbench-ee10.ear to server’s deployments directory and start the standalone server in the HA mode:

cd ~/wildfly-34.0.0.Final
cp ~/clusterbench/clusterbench-ee10-ear/target/clusterbench-ee10.ear standalone/deployments/
./bin/standalone.sh -c standalone-ha.xml

You can also use the CLI to do so by starting the server, connecting with CLI and using deploy command:

cd ~/wildfly-34.0.0.Final
./bin/standalone.sh -c standalone-ha.xml

Then connect with the CLI:

./bin/jboss-cli.sh -c
[standalone@localhost:9990 /] deploy ~/clusterbench/clusterbench-ee10-ear/target/clusterbench-ee10.ear

If you prefer GUI, you can start the server and navigate to http://localhost:9990/ and follow the instructions.

Tomcat 10.1

To deploy the Tomcat variant of ClusterBench, copy the following war file into Tomcat installation webapps/ directory renaming it accordingly to the desired context, typically to clusterbench.war to correspond with the context path on WildFly.

cp ~/git/clusterbench/clusterbench-ee10-web/target/clusterbench-ee10-web-tomcat.war webapps/clusterbench.war

Note that CDI, EJB, JSF, granular, and debug servlets are unsupported on Tomcat and not bundled in the war. That makes the session servlet the only one available for performance benchmarking.

Deploying to OpenShift

Using Helm Charts

First, make sure you have oc and helm installed. Now, log into OpenShift using the following replacing with your token and server address:

oc login --token=sha256~<your_token> --server=https://api.sandbox-m3.1530.p1.openshiftapps.com:6443

First add the WildFly helm repo:

helm repo add wildfly https://docs.wildfly.org/wildfly-charts/

Now install the helm chart:

helm install clusterbench-from-chart -f charts/helm.yaml wildfly/wildfly

You can watch the build using oc:

oc get build -w

Once built, watch the deployment using:

oc get deployment clusterbench-from-chart -w

Once deployed, you can access the application for example the debug servlet using curl:

[rhusar@ribera clusterbench]$ curl https://$(oc get route clusterbench-from-chart --template='{{ .spec.host }}')/clusterbench/debug
...
Serial: 0
Session ID: nPw9NzEmPaZHlj0eYoCapZfBBOnNk_5HXNpq2Qi_
Current time: Wed Mar 22 14:36:52 GMT 2023

Once finished, remove everything using:

helm uninstall clusterbench-from-chart

Servlets

Scenario Servlets

Each servlet stresses a different replication logic, but they all produce the same reply: number of times (integer) the servlet has been previously invoked within the existing session in a text/plain response. In other words, the first request returns 0 and each following invocation returns number incremented by 1.

Furthermore, each HTTP session carries 4 KB of dummy session data in a byte array.

HttpSessionServlet

The 'default' servlet. Stores serial number and data in SerialBean object (POJO) which is directly stored in jakarta.servlet.http.HttpSession.

CdiServlet

Stores a serial number in @jakarta.enterprise.context.SessionScoped bean.

LocalEjbServlet

Stores serial and data in @jakarta.ejb.Stateful Jakarta Enterprise Bean (SFSB). The JEB is then invoked on every request.

GranularSessionServlet

Stores serial number and data separately and are both directly put to jakarta.servlet.http.HttpSession. The byte array is never changed and thus can be used to test the efficiency of using granular session replication.

Caution
The server configuration in use must be configured with ATTRIBUTE session granularity!

Load Servlets

There are also two oad generating Servlets for memory and CPU usage. These Servlets simulate load on the target system. These can be used to test the load-balancing mechanism of the reverse proxy.

AverageSystemLoadServlet

Servlet simulating CPU load of the cluster node. Parameters are milliseconds (duration) and threads.

Debug Servlets

DebugServlet

Servlet that prints out useful information such as: the request headers, URI, query string, path info, serial (does create a session), session ID, time, server and local ports, node name, parameters, and cluster address/coordinator/members/physical addresses.

HttpResponseServlet

Servlet which allows to customize the HTTP status response code. Requires mandatory integer code parameter.

JBossNodeNameServlet

Servlet which prints out the node name as a value of the jboss.node.name system property.

LoggerServlet

Servlet which logs the provided message in the msg parameter to the server log. If no message is provided, a simple ping message is logged. The log message level can be optionally provided in the level parameter. Logs at INFO level by default.

Server Configurations

The scripts directory at the root of the repository contains CLI scripts for reconfiguring the application server for specific test scenarios. These scripts can be combined to achieve a desired resulting configuration.

Script Description

infinispan-session-management-attribute.cli

Reconfigures the default session manager to use ATTRIBUTE granularity.

infinispan-session-management-offload.cli

Reconfigures the default session manager to use cache offload.

singleton-deployment-overlay-add.cli

Adds a deployment overlay for the ClusterBench deployment which configures it for singleton deployment.

singleton-deployment-overlay-remove.cli

Removes the previously added deployment overlay so that it will no longer operate as a singleton deployment.

Example: singleton deployment

Following is a singleton deployment walk-through. Start with two local servers already started and with clusterbench-ee10.ear deployed. First run the provided scripts against both servers:

[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --file=singleton-deployment-overlay-add.cli
[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --controller=localhost:10090 --file=singleton-deployment-overlay-add.cli

The provided script adds a deployment overlay, which configures existing deployment for singleton deployment. This is achieved by overlaying a META-INF/singleton-deployment.xml file. Note that the script automatically redeploys the deployments affected by this overlay.

Now that these have configured both deployments for singleton deployment, observe the server log:

10:39:16,287 INFO  [org.wildfly.clustering.singleton.server] (main - 1) WFLYCLSN0003: node2 elected as the singleton provider of the jboss.deployment.unit."clusterbench-ee10.ear".installer service
10:39:16,287 INFO  [org.wildfly.clustering.singleton.server] (main - 1) WFLYCLSN0001: This node will now operate as the singleton provider of the jboss.deployment.unit."clusterbench-ee10.ear".installer service

We can now verify that only one of the contexts is available:

[rhusar@puglia wildfly]$ curl --head http://localhost:8080/clusterbench/
HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Length: 74
Content-Type: text/html
Date: Mon, 23 Sep 2024 08:50:28 GMT

[rhusar@puglia wildfly]$ curl --head http://localhost:8180/clusterbench/
HTTP/1.1 200 OK
Connection: keep-alive
Last-Modified: Fri, 03 May 2024 14:27:54 GMT
Content-Type: text/html
Content-Length: 1335
Accept-Ranges: bytes
Date: Mon, 23 Sep 2024 08:50:29 GMT

Notice that only one of the servers has returned a valid answer.

To undo the changes, run the 'remove' variant of the scripts:

[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --file=singleton-deployment-overlay-remove.cli
[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --controller=localhost:10090 --file=singleton-deployment-overlay-remove.cli

Custom Build Profiles

There are several profiles to test specific scenarios where the standard build needs to be modified. When no custom profile is specified, the default profile is used.

shared-sessions

This profile produces a build to test a shared sessions scenario where two WARs in the same EAR share HTTP sessions:

./mvnw install -P shared-sessions -DskipTests

short-names

Used to shorten the names of bundled JARs and WARs within the resulting EAR file. Used in database tests to produce database tables with short names.

./mvnw clean install -P short-names -DskipTests

sso-form

This profile enables form authentication:

./mvnw clean install -P sso-form -DskipTests

2clusters

This profile adds the necessary JEBs to perform call forwarding to a second JEB cluster:

./mvnw clean install -P 2clusters -DskipTests

Configuration

The default payload size can be overridden by a system property specifying integer number of bytes to use in a payload:

./bin/standalone.sh -c standalone-ha.xml -Dorg.jboss.test.clusterbench.cargokb=5
Note
Ensure identical value is specified for all containers in the cluster!

Issues

File new issues using GitHub Issues:

Contributing

Contributions are welcome! Submit pull requests against the upstream repository on GitHub. Please follow the coding standards to keep the application simple and clean.

License

Project is licensed under Apache License Version 2.0.

Happy benchmarking!

About

Jakarta EE 5/6/7/8/10 WildFly/JBoss EAP Clustering Benchmark Application

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 93.9%
  • HTML 6.1%