Przeglądaj źródła

Retire JSON test permutations of JSON Afterburner and Custom JSON Serialiser (#5248)

Update README.md
Radoslav Petrov 5 lat temu
rodzic
commit
b532792955

+ 2 - 10
frameworks/Java/servlet/README.md

@@ -4,12 +4,12 @@ This is the Java Servlet portion of a [benchmarking test suite](../) comparing a
 
 There is a Servlet 3.1 based tests implementation in the [servlet3](./servlet3) sub-folder. It is using Tomcat 9 as Servlet containter.
 
+There are two retired implementations for the JSON test: usage of Jackson Afterburner module and usage of a custom Jackson serialization.
+
 ### Plaintext and JSON
 
 * [Plaintext test source](src/main/java/hello/PlaintextServlet.java)
 * [JSON test source](src/main/java/hello/JsonServlet.java)
-* [JSON test source with Jackson Afterburner module](src/main/java/hello/JsonAfterburnerServlet.java)
-* [JSON test source with custom Jackson serialization](src/main/java/hell/JsonCJSServlet.java)
 
 ### `MySQL` implementation
 
@@ -45,14 +45,6 @@ Please confirm the versions data with the latest install scripts of TFB project.
  * Plaintext - `http://localhost:8080/plaintext`
  * JSON - `http://localhost:8080/json`
 
-### `afterburner` Maven profile
-
- * JSON - `http://localhost:8080/json`
-
-### `cjs` Maven profile
-
- * JSON - `http://localhost:8080/json`
-
 ### `mysql` and `postgresql` Maven profiles
 
  * DB - `http://localhost:8080/db`

+ 0 - 36
frameworks/Java/servlet/benchmark_config.json

@@ -39,42 +39,6 @@
       "notes": "Using compiled native Resin library",
       "versus": "servlet"
     },
-    "afterburner": {
-      "json_url": "/json",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "None",
-      "language": "Java",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "Resin",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "servlet",
-      "notes": "Jackson with Afterburner module",
-      "versus": "servlet"
-    },
-    "cjs": {
-      "json_url": "/json",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "None",
-      "language": "Java",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "Servlet",
-      "webserver": "Resin",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "servlet",
-      "notes": "Jackson with custom serialization",
-      "versus": "servlet"
-    },
     "mysql": {
       "db_url": "/db",
       "query_url": "/queries?queries=",

+ 1 - 59
frameworks/Java/servlet/pom.xml

@@ -12,7 +12,7 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<maven.compiler.source>11</maven.compiler.source>
 		<maven.compiler.target>11</maven.compiler.target>
-		<cache2k-version>1.2.1.Final</cache2k-version>
+		<cache2k-version>1.2.3.Final</cache2k-version>
 		<jackson-version>2.9.9</jackson-version>
 		<!-- This is the default web.xml for plaintext and json only -->
 		<maven.war.xml>src/main/webapp/WEB-INF/web.xml</maven.war.xml>
@@ -25,12 +25,6 @@
 			<version>${jackson-version}</version>
 		</dependency>
 
-		<dependency>
-			<groupId>com.fasterxml.jackson.module</groupId>
-			<artifactId>jackson-module-afterburner</artifactId>
-			<version>${jackson-version}</version>
-		</dependency>
-
 		<!-- Turn off to use the implementation provided from Resin
 		<dependency>
 			<groupId>org.apache.taglibs</groupId>
@@ -70,58 +64,6 @@
 	</dependencies>
 
 	<profiles>
-		<profile>
-			<id>afterburner</id>
-			<properties>
-				<maven.war.xml>src/main/resources/WEB-INF/afterburner/web.xml</maven.war.xml>
-			</properties>
-			<build>
-				<plugins>
-					<plugin>
-						<groupId>org.apache.maven.plugins</groupId>
-						<artifactId>maven-war-plugin</artifactId>
-						<configuration>
-							<webResources>
-								<resource>
-									<directory>src/main/resources/WEB-INF/afterburner</directory>
-									<excludes>
-										<exclude>src/main/resources/WEB-INF/</exclude>
-									</excludes>
-									<targetPath>WEB-INF</targetPath>
-								</resource>
-							</webResources>
-						</configuration>
-					</plugin>
-				</plugins>
-			</build>
-		</profile>
-
-		<profile>
-			<id>cjs</id>
-			<properties>
-				<maven.war.xml>src/main/resources/WEB-INF/cjs/web.xml</maven.war.xml>
-			</properties>
-			<build>
-				<plugins>
-					<plugin>
-						<groupId>org.apache.maven.plugins</groupId>
-						<artifactId>maven-war-plugin</artifactId>
-						<configuration>
-							<webResources>
-								<resource>
-									<directory>src/main/resources/WEB-INF/cjs</directory>
-									<excludes>
-										<exclude>src/main/resources/WEB-INF/</exclude>
-									</excludes>
-									<targetPath>WEB-INF</targetPath>
-								</resource>
-							</webResources>
-						</configuration>
-					</plugin>
-				</plugins>
-			</build>
-		</profile>
-
 		<profile>
 			<id>mysql</id>
 			<properties>

+ 0 - 13
frameworks/Java/servlet/servlet-afterburner.dockerfile

@@ -1,13 +0,0 @@
-FROM maven:3.6.1-jdk-11-slim as maven
-WORKDIR /servlet
-COPY src src
-COPY pom.xml pom.xml
-RUN mvn compile war:war -q -P afterburner
-
-FROM openjdk:11.0.3-jdk-stretch
-WORKDIR /resin
-RUN curl -sL http://caucho.com/download/resin-4.0.61.tar.gz | tar xz --strip-components=1
-RUN rm -rf webapps/*
-COPY --from=maven /servlet/target/servlet.war webapps/ROOT.war
-COPY resin.xml conf/resin.xml
-CMD ["java", "-jar", "lib/resin.jar", "console"]

+ 0 - 13
frameworks/Java/servlet/servlet-cjs.dockerfile

@@ -1,13 +0,0 @@
-FROM maven:3.6.1-jdk-11-slim as maven
-WORKDIR /servlet
-COPY src src
-COPY pom.xml pom.xml
-RUN mvn compile war:war -q -P cjs
-
-FROM openjdk:11.0.3-jdk-stretch
-WORKDIR /resin
-RUN curl -sL http://caucho.com/download/resin-4.0.61.tar.gz | tar xz --strip-components=1
-RUN rm -rf webapps/*
-COPY --from=maven /servlet/target/servlet.war webapps/ROOT.war
-COPY resin.xml conf/resin.xml
-CMD ["java", "-jar", "lib/resin.jar", "console"]

+ 1 - 22
frameworks/Java/servlet/src/main/java/hello/Common.java

@@ -12,7 +12,6 @@ import java.util.concurrent.ThreadLocalRandom;
 import com.fasterxml.jackson.core.JsonGenerator;
 import com.fasterxml.jackson.databind.*;
 import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
-import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
 
 /**
  * Some common functionality and constants used by the Servlet tests.
@@ -27,8 +26,6 @@ public class Common {
 	
 	// Jackson encoder, reused for each response.
 	protected static final ObjectMapper MAPPER = new ObjectMapper();
-	// Jackson encoder with AfterBurner module
-	protected static final ObjectMapper AF_MAPPER = new ObjectMapper().registerModule(new AfterburnerModule());
 
 	private static final String DB_QUERY = "SELECT * FROM world";
 
@@ -37,24 +34,6 @@ public class Common {
 		public final String message = "Hello, World!";
 	}
 	
-	// Response message class with custom Jackson serializer
-	public static class HelloMessageCJS implements JsonSerializable {
-		public final String message = "Hello, World!";
-		
-		@Override
-		public void serialize(JsonGenerator jg, SerializerProvider sp) throws IOException {
-			jg.writeStartObject();
-			jg.writeStringField("message", this.message);
-			jg.writeEndObject();
-		}
-
-		@Override
-		public void serializeWithType(JsonGenerator jg, SerializerProvider sp,
-				TypeSerializer ts) throws IOException {
-			throw new UnsupportedOperationException("Not needed so far.");
-		}
-	}
-	
 	// Request parameter checking and normalisation
 	public static int normalise(String param) {
 		int count = 1;
@@ -95,4 +74,4 @@ public class Common {
 	public static int getRandom() {
 		return 1 + ThreadLocalRandom.current().nextInt(DB_ROWS);
 	}
-}
+}

+ 0 - 24
frameworks/Java/servlet/src/main/java/hello/JsonAfterburnerServlet.java

@@ -1,24 +0,0 @@
-package hello;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * JSON Encoding Test
- */
-@SuppressWarnings("serial")
-public class JsonAfterburnerServlet extends HttpServlet {
-	@Override
-	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
-			IOException {
-		// Set content type to JSON
-		res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);
-
-		// Write JSON encoded message to the response.
-		Common.AF_MAPPER.writeValue(res.getOutputStream(), new Common.HelloMessage());
-	}
-}

+ 0 - 24
frameworks/Java/servlet/src/main/java/hello/JsonCJSServlet.java

@@ -1,24 +0,0 @@
-package hello;
-
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * JSON Encoding Test
- */
-@SuppressWarnings("serial")
-public class JsonCJSServlet extends HttpServlet {
-	@Override
-	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
-			IOException {
-		// Set content type to JSON
-		res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);
-
-		// Write JSON encoded message to the response using the class with custom Jackson serialization.
-		Common.MAPPER.writeValue(res.getOutputStream(), new Common.HelloMessageCJS());
-	}
-}

+ 0 - 15
frameworks/Java/servlet/src/main/resources/WEB-INF/afterburner/web.xml

@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-	version="2.4">
-	<servlet>
-		<servlet-name>json</servlet-name>
-		<servlet-class>hello.JsonAfterburnerServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>json</servlet-name>
-		<url-pattern>/json</url-pattern>
-	</servlet-mapping>
-</web-app>

+ 0 - 15
frameworks/Java/servlet/src/main/resources/WEB-INF/cjs/web.xml

@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
-	version="2.4">
-	<servlet>
-		<servlet-name>json</servlet-name>
-		<servlet-class>hello.JsonCJSServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>json</servlet-name>
-		<url-pattern>/json</url-pattern>
-	</servlet-mapping>
-</web-app>