diff --git a/README.adoc b/README.adoc index b535f756..2d3c7e30 100644 --- a/README.adoc +++ b/README.adoc @@ -100,8 +100,8 @@ renaming it accordingly to the desired context, typically to `clusterbench.war` cp ~/git/clusterbench/clusterbench-ee10-web/target/clusterbench-ee10-web-tomcat.war webapps/clusterbench.war ---- -Note that CDI, debug, EJB, granular, JSF servlets are unsupported on Tomcat and not bundled in the `war`. -That makes the session servlet the only one available for benchmarking. +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 @@ -184,10 +184,12 @@ Stores serial and data in `@jakarta.ejb.Stateful` Jakarta Enterprise Bean (SFSB) ==== GranularSessionServlet -http://localhost:8080/clusterbench-granular/granular[/clusterbench-granular/granular] +http://localhost:8080/clusterbench/granular[/clusterbench/granular] Stores serial number and data separately and are both directly put to `jakarta.servlet.http.HttpSession`. -The byte array is never changed therefore this can be used to test effectiveness of using granular session replication. +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 @@ -228,6 +230,9 @@ The `/scripts` directory contains CLI scripts for reconfiguring the application |=== | Script | Description +| infinispan-session-management-attribute.cli +| Reconfigures the default session manager to use `ATTRIBUTE` granularity. + | infinispan-session-management-offload-attribute.cli | Reconfigures the default session manager to use cache `offload` with `ATTRIBUTE` granularity. diff --git a/bom/pom.xml b/bom/pom.xml index aed6f18e..04ad51aa 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -73,13 +73,6 @@ passivating war - - ${project.groupId} - clusterbench-ee10-web - ${project.version} - granular - war - diff --git a/clusterbench-ee10-ear/pom.xml b/clusterbench-ee10-ear/pom.xml index 7a9da7bf..455727c6 100644 --- a/clusterbench-ee10-ear/pom.xml +++ b/clusterbench-ee10-ear/pom.xml @@ -42,12 +42,6 @@ passivating war - - ${project.groupId} - clusterbench-ee10-web - granular - war - @@ -83,13 +77,6 @@ /clusterbench-passivating clusterbench-ee10-web-passivating.war - - ${project.groupId} - clusterbench-ee10-web - granular - /clusterbench-granular - clusterbench-ee10-web-granular.war - @@ -170,13 +157,6 @@ /clusterbench-passivating b.war - - ${project.groupId} - clusterbench-ee10-web - granular - /clusterbench-granular - c.war - @@ -308,12 +288,6 @@ passivating /clusterbench-passivating - - ${project.groupId} - clusterbench-ee10-web - granular - /clusterbench-granular - @@ -359,12 +333,6 @@ passivating /clusterbench-passivating1 - - ${project.groupId} - clusterbench-ee10-web - granular - /clusterbench-granular1 - @@ -398,12 +366,6 @@ passivating /clusterbench-passivating2 - - ${project.groupId} - clusterbench-ee10-web - granular - /clusterbench-granular2 - @@ -471,12 +433,6 @@ passivating true - - ${project.groupId} - clusterbench-ee10-web - granular - true - diff --git a/clusterbench-ee10-web/pom.xml b/clusterbench-ee10-web/pom.xml index 8785882a..1638f376 100644 --- a/clusterbench-ee10-web/pom.xml +++ b/clusterbench-ee10-web/pom.xml @@ -132,7 +132,7 @@ %regex[.*/(cdi|debug|ejb|granular|jsf).*] - + build-default-war package @@ -152,7 +152,7 @@ ${project.build.directory}/${project.build.finalName}-default ${basedir}/src/main/webapp - %regex[.*granular.*],%regex[.*clusterbench-common.*] + %regex[.*clusterbench-common.*] org.jgroups @@ -160,7 +160,7 @@ - + build-passivating-war package @@ -180,35 +180,7 @@ ${project.build.directory}/${project.build.finalName}-passivating ${basedir}/src/main/webapp-passivating - %regex[.*granular.*],%regex[.*clusterbench-common.*] - - - org.jgroups - - - - - - - build-granular-war - package - - war - - - granular - - - true - src/main/webapp-granular - - **/web.xml - - - - ${project.build.directory}/${project.build.finalName}-granular - ${basedir}/src/main/webapp-granular - %regex[.*/(cdi|ejb|jsf|load|session).*],%regex[.*clusterbench-common.*] + %regex[.*clusterbench-common.*] org.jgroups diff --git a/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/jboss-web.xml b/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/jboss-web.xml deleted file mode 100644 index 954d4168..00000000 --- a/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - ATTRIBUTE - - - diff --git a/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/web.xml b/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/web.xml deleted file mode 100644 index 4ebfa624..00000000 --- a/clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/web.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - 5 - - - - - - index.html - - - ${enable.security.start} - - - All - /* - - - Admin - User - - - - - FORM - ApplicationRealm - - /login.jsp - /error.jsp - - - - - Admin - - - User - - ${enable.security.end} - - diff --git a/clusterbench-ee10-web/src/main/webapp-granular/error.jsp b/clusterbench-ee10-web/src/main/webapp-granular/error.jsp deleted file mode 100644 index 4c82ad8b..00000000 --- a/clusterbench-ee10-web/src/main/webapp-granular/error.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%@ page import="java.util.*" %> - - - - Authentication Error - - - -

Authentication Error

-

HTTP Request Headers Received:

- - <% Enumeration enumeration = request.getHeaderNames(); - while (enumeration.hasMoreElements()) { - String name= (String) enumeration.nextElement(); - String value = request.getHeader(name); - %> - - - - - <% - } - %> -
- <%=name %> - - <%=value %> -
-

HTTP Request Headers Returned:

- - <% - for (String name1 : response.getHeaderNames()) { - String value1 = response.getHeader(name1); - %> - - - - - <% - } - %> -
- <%=name1 %> - - <%=value1 %> -
- - \ No newline at end of file diff --git a/clusterbench-ee10-web/src/main/webapp-granular/favicon.ico b/clusterbench-ee10-web/src/main/webapp-granular/favicon.ico deleted file mode 100644 index d558523e..00000000 Binary files a/clusterbench-ee10-web/src/main/webapp-granular/favicon.ico and /dev/null differ diff --git a/clusterbench-ee10-web/src/main/webapp-granular/index.html b/clusterbench-ee10-web/src/main/webapp-granular/index.html deleted file mode 100644 index 98ecd09f..00000000 --- a/clusterbench-ee10-web/src/main/webapp-granular/index.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - ClusterBench - - - - -

Hello World, Hello ClusterBench!

-

Flavor

-

EE10 -- Granular

- -

Usage

- - -

Sources

-

- https://github.com/clusterbench/clusterbench -

- - diff --git a/clusterbench-ee10-web/src/main/webapp-granular/login.jsp b/clusterbench-ee10-web/src/main/webapp-granular/login.jsp deleted file mode 100644 index e674778b..00000000 --- a/clusterbench-ee10-web/src/main/webapp-granular/login.jsp +++ /dev/null @@ -1,9 +0,0 @@ - - -
-
-
- -
- - \ No newline at end of file diff --git a/integration-tests/wildfly/src/test/java/org/jboss/test/clusterbench/it/wildfly/GranularServletIT.java b/integration-tests/wildfly/src/test/java/org/jboss/test/clusterbench/it/wildfly/GranularServletIT.java new file mode 100644 index 00000000..5587c029 --- /dev/null +++ b/integration-tests/wildfly/src/test/java/org/jboss/test/clusterbench/it/wildfly/GranularServletIT.java @@ -0,0 +1,59 @@ +/* + * Copyright The ClusterBench Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.jboss.test.clusterbench.it.wildfly; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; +import java.util.Optional; + +import org.apache.http.Header; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit5.ArquillianExtension; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +/** + * Test for {@link org.jboss.test.clusterbench.web.granular.GranularHttpSessionServlet}. + * + * @author Radoslav Husar + */ +@ExtendWith(ArquillianExtension.class) +@RunAsClient +public class GranularServletIT extends AbstractWildFlyIT { + + @Test + public void test() throws Exception { + try (CloseableHttpClient httpClient = HttpClients.createDefault()) { + HttpGet httpGet = new HttpGet("http://localhost:8080/clusterbench/granular"); + + try (CloseableHttpResponse response = httpClient.execute(httpGet)) { + assertEquals(200, response.getStatusLine().getStatusCode()); + + String responseBody = EntityUtils.toString(response.getEntity()); + assertEquals("0", responseBody); + + // Also ensure session is created + Optional
header = Arrays.stream(response.getAllHeaders()).filter(h -> Arrays.stream(h.getElements()).anyMatch(e -> e.getName().equals("JSESSIONID"))).findAny(); + Assertions.assertTrue(header.isPresent()); + } + + try (CloseableHttpResponse response = httpClient.execute(httpGet)) { + assertEquals(200, response.getStatusLine().getStatusCode()); + + String responseBody = EntityUtils.toString(response.getEntity()); + assertEquals("1", responseBody); + } + } + } + +} \ No newline at end of file diff --git a/scripts/infinispan-session-management-attribute.cli b/scripts/infinispan-session-management-attribute.cli new file mode 100644 index 00000000..9ec9f5be --- /dev/null +++ b/scripts/infinispan-session-management-attribute.cli @@ -0,0 +1,12 @@ +# +# Copyright The ClusterBench Authors +# SPDX-License-Identifier: Apache-2.0 +# + +# This script reconfigures the default session manager to use `ATTRIBUTE` granularity. + +batch +/subsystem=distributable-web/infinispan-session-management=granular:add(cache-container=web, granularity=ATTRIBUTE) +/subsystem=distributable-web/infinispan-session-management=granular/affinity=primary-owner:add() +/subsystem=distributable-web:write-attribute(name=default-session-management, value=granular) +run-batch