From de6e797744d672d022a6962ca3950c4132f1d4cd Mon Sep 17 00:00:00 2001 From: Radoslav Husar Date: Thu, 12 Sep 2024 16:29:21 +0200 Subject: [PATCH] Remove the /clusterbench-granular deployment and replace with a provided CLI script (resolves #387) --- README.adoc | 13 ++-- bom/pom.xml | 7 --- clusterbench-ee10-ear/pom.xml | 44 ------------- clusterbench-ee10-web/pom.xml | 36 ++--------- .../webapp-granular/WEB-INF/jboss-web.xml | 16 ----- .../src/main/webapp-granular/WEB-INF/web.xml | 54 ---------------- .../src/main/webapp-granular/error.jsp | 48 -------------- .../src/main/webapp-granular/favicon.ico | Bin 3638 -> 0 bytes .../src/main/webapp-granular/index.html | 29 --------- .../src/main/webapp-granular/login.jsp | 9 --- .../it/wildfly/GranularServletIT.java | 59 ++++++++++++++++++ ...nfinispan-session-management-attribute.cli | 12 ++++ 12 files changed, 84 insertions(+), 243 deletions(-) delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/jboss-web.xml delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/WEB-INF/web.xml delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/error.jsp delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/favicon.ico delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/index.html delete mode 100644 clusterbench-ee10-web/src/main/webapp-granular/login.jsp create mode 100644 integration-tests/wildfly/src/test/java/org/jboss/test/clusterbench/it/wildfly/GranularServletIT.java create mode 100644 scripts/infinispan-session-management-attribute.cli 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 d558523ec09df9c2d3d650bf8b2d42b587812bf5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3638 zcmeHKX;4&G7XG?r7X=}1hyjHrDriK6sEG=OI7So4(Ks1MoJ7+}T!I-VPND{lCgZq` zxF9YpqJXk13W%bJF(~`eEYfVv4ub5P2omzWR)|I{r)qvo)l^Q^?fcF>_nmvTd%o9z z2x92!LP@Jt0W&@s8$aR$GyoT_O&}|55tc>ZBFR>yoSymV?d?UH*I-no{(!>Ei_u&b ziJV{ybhao^baf5lb^&#HC((W{4Viw1D3AXN-JSJFIs&8|9}UHIM>G@#A@{ruGEVEG zI_DQA4Vy zI%K{^s7TrjMT`T_JBRoKK*B+e!$2bKPIBYmImvt{*$L{j2}5n@6}mqB7Get zZ$5OAh3ZsIgFb$u`fH=d8qFKj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`% - - - - - 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