瀏覽代碼

Upgrade jetty (#2884)

* Update jetty

* Update ORM field to RAW

* Call correct JAR name

* Add missing ampersand in setup.sh

* Adjust contents of source_code file

* Remove jetty-servlet project from .travis.yml
Radoslav Petrov 8 年之前
父節點
當前提交
c69cd4e0a2

+ 0 - 1
.travis.yml

@@ -81,7 +81,6 @@ env:
     - "TESTDIR=Java/grizzly-bm"
     - "TESTDIR=Java/grizzly-jersey"
     - "TESTDIR=Java/jawn"
-    - "TESTDIR=Java/jetty-servlet"
     - "TESTDIR=Java/jetty"
     - "TESTDIR=Java/jlhttp"
     - "TESTDIR=Java/jooby"

+ 0 - 15
frameworks/Java/jetty-servlet/README.md

@@ -1,15 +0,0 @@
-# Jetty-9 Benchmarking Test
-
-This is the Jetty Servlet portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-* [JSON test source](src/main/java/hello/HelloWebServer.java)
-
-## Versions
-Jetty-9.2.10 (http://eclipse.org/jetty)
-
-## Test URLs
-
-### JSON Encoding Test
-
-    http://localhost:8080

+ 0 - 25
frameworks/Java/jetty-servlet/benchmark_config.json

@@ -1,25 +0,0 @@
-{
-  "framework": "jetty-servlet",
-  "tests": [{
-    "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "None",
-      "language": "Java",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "Jetty",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "jetty",
-      "notes": "Jetty 9.2 with ServletContext",
-      "versus": "servlet"
-    }
-  }]
-}

+ 0 - 64
frameworks/Java/jetty-servlet/pom.xml

@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>com.techempower</groupId>
-    <artifactId>jetty-servlet-example</artifactId>
-    <version>0.2</version>
-
-    <dependencies>
-        <!-- Web server -->
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-servlet</artifactId>
-            <version>9.2.10.v20150310</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util-ajax</artifactId>
-            <version>9.2.10.v20150310</version>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <inherited>true</inherited>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
-                    <optimize>true</optimize>
-                    <debug>false</debug>
-                </configuration>
-            </plugin>
-            <plugin>
-                <artifactId>maven-assembly-plugin</artifactId>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <mainClass>hello.HelloWebServer</mainClass>
-                        </manifest>
-                    </archive>
-                    <descriptorRefs>
-                        <descriptorRef>jar-with-dependencies</descriptorRef>
-                    </descriptorRefs>
-                </configuration>
-                <executions>
-                    <execution>
-                        <id>make-assembly</id> <!-- this is used for inheritance merges -->
-                        <phase>package</phase> <!-- bind to the packaging phase -->
-                        <goals>
-                            <goal>single</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-</project>

+ 0 - 8
frameworks/Java/jetty-servlet/setup.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-fw_depends java maven
-
-mvn clean compile assembly:single
-
-cd target
-java -jar jetty-servlet-example-0.2-jar-with-dependencies.jar &

+ 0 - 4
frameworks/Java/jetty-servlet/source_code

@@ -1,4 +0,0 @@
-./jetty-servlet/src/main/java/hello/
-./jetty-servlet/src/main/java/hello/HelloWebServer.java
-./jetty-servlet/src/main/java/hello/JsonServlet.java
-./jetty-servlet/src/main/java/hello/PlaintextServlet.java

+ 15 - 5
frameworks/Java/jetty/README.md

@@ -1,15 +1,25 @@
 # Jetty-9 Benchmarking Test
 
-This is the Jetty Handler portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+This is the Jetty portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+## Handler
 
 ### JSON Encoding Test
-* [JSON test source](src/main/java/hello/HelloWebServer.java)
+* [Plaintext test source](src/main/java/hello/handler/PlainTextHandler.java)
+* [JSON test source](src/main/java/hello/handler/JsonHandler.java)
+
+## Servlet
+
+### JSON Encoding Test
+* [Plaintext test source](src/main/java/hello/handler/PlaintextServlet.java)
+* [JSON test source](src/main/java/hello/servlet/JsonServlet.java)
 
 ## Versions
-Jetty-9.3.0.RC0 (http://eclipse.org/jetty)
+9.4.6.v20170531 (http://eclipse.org/jetty)
 
 ## Test URLs
 
-### JSON Encoding Test
+All implementations use the same URLs.
 
-    http://localhost:8080
+ * Plaintext - `http://localhost:8080/plaintext`
+ * JSON - `http://localhost:8080/json`

+ 22 - 2
frameworks/Java/jetty/benchmark_config.json

@@ -6,7 +6,7 @@
       "json_url": "/json",
       "plaintext_url": "/plaintext",
       "port": 8080,
-      "approach": "Stripped",
+      "approach": "Realistic",
       "classification": "Platform",
       "database": "None",
       "framework": "None",
@@ -18,7 +18,27 @@
       "os": "Linux",
       "database_os": "Linux",
       "display_name": "jetty",
-      "notes": "Jetty 9.3 with Handler",
+      "notes": "Jetty 9.4 with Handler",
+      "versus": "servlet"
+    },
+    "servlet": {
+      "setup_file": "setup_servlet",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "None",
+      "language": "Java",
+      "flavor": "None",
+      "orm": "Raw",
+      "platform": "Jetty",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "jetty",
+      "notes": "Jetty 9.4 with ServletContext",
       "versus": "servlet"
     }
   }]

+ 75 - 20
frameworks/Java/jetty/pom.xml

@@ -7,40 +7,95 @@
     <artifactId>jetty-example</artifactId>
     <version>0.1</version>
 
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <jetty.version>9.4.6.v20170531</jetty.version>
+        <main.class>hello.handler.HelloWebServer</main.class>
+    </properties>
+
+    <profiles>
+        <profile>
+            <id>handler</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <dependencies>
+                <dependency>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-server</artifactId>
+                    <version>${jetty.version}</version>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <inherited>true</inherited>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <version>2.3.2</version>
+                        <configuration>
+                            <excludes>
+                                <exclude>hello/servlet/**</exclude>
+                            </excludes>
+                            <source>1.8</source>
+                            <target>1.8</target>
+                            <optimize>true</optimize>
+                            <debug>false</debug>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>servlet</id>
+            <properties>
+                <main.class>hello.servlet.HelloWebServerServlet</main.class>
+            </properties>
+            <dependencies>
+                <dependency>
+                    <groupId>org.eclipse.jetty</groupId>
+                    <artifactId>jetty-servlet</artifactId>
+                    <version>${jetty.version}</version>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <inherited>true</inherited>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <version>2.3.2</version>
+                        <configuration>
+                            <excludes>
+                                <exclude>hello/handler/**</exclude>
+                            </excludes>
+                            <source>1.8</source>
+                            <target>1.8</target>
+                            <optimize>true</optimize>
+                            <debug>false</debug>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
     <dependencies>
-        <!-- Web server -->
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-server</artifactId>
-            <version>9.3.0.v20150612</version>
-        </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-util-ajax</artifactId>
-            <version>9.3.0.v20150612</version>
+            <version>${jetty.version}</version>
         </dependency>
     </dependencies>
 
     <build>
         <plugins>
-            <plugin>
-                <inherited>true</inherited>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <source>1.8</source>
-                    <target>1.8</target>
-                    <optimize>true</optimize>
-                    <debug>false</debug>
-                </configuration>
-            </plugin>
             <plugin>
                 <artifactId>maven-assembly-plugin</artifactId>
                 <configuration>
                     <archive>
                         <manifest>
-                            <mainClass>hello.HelloWebServer</mainClass>
+                            <mainClass>${main.class}</mainClass>
                         </manifest>
                     </archive>
                     <descriptorRefs>

+ 1 - 1
frameworks/Java/jetty/setup.sh

@@ -5,4 +5,4 @@ fw_depends java maven
 mvn clean compile assembly:single
 
 cd target
-java -jar jetty-example-0.1-jar-with-dependencies.jar
+java -XX:+UseNUMA -XX:+UseParallelGC -jar jetty-example-0.1-jar-with-dependencies.jar &

+ 8 - 0
frameworks/Java/jetty/setup_servlet.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+fw_depends java maven
+
+mvn -P servlet clean compile assembly:single
+
+cd target
+java -XX:+UseNUMA -XX:+UseParallelGC -jar jetty-example-0.1-jar-with-dependencies.jar &

+ 6 - 3
frameworks/Java/jetty/source_code

@@ -1,4 +1,7 @@
 ./jetty/src/main/java/hello/
-./jetty/src/main/java/hello/HelloWebServer.java
-./jetty/src/main/java/hello/JsonServlet.java
-./jetty/src/main/java/hello/PlaintextServlet.java
+./jetty/src/main/java/hello/handler/HelloWebServer.java
+./jetty/src/main/java/hello/handler/JsonHandler.java
+./jetty/src/main/java/hello/handler/PlainTextHandler.java
+./jetty/src/main/java/hello/servlet/HelloWebServerServlet.java
+./jetty/src/main/java/hello/servlet/JsonServlet.java
+./jetty/src/main/java/hello/servlet/PlaintextServlet.java

+ 1 - 1
frameworks/Java/jetty/src/main/java/hello/HelloWebServer.java → frameworks/Java/jetty/src/main/java/hello/handler/HelloWebServer.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.handler;
 
 import java.io.IOException;
 

+ 1 - 1
frameworks/Java/jetty/src/main/java/hello/JsonHandler.java → frameworks/Java/jetty/src/main/java/hello/handler/JsonHandler.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.handler;
 
 import java.io.IOException;
 import java.util.Collections;

+ 1 - 1
frameworks/Java/jetty/src/main/java/hello/PlainTextHandler.java → frameworks/Java/jetty/src/main/java/hello/handler/PlainTextHandler.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.handler;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;

+ 2 - 2
frameworks/Java/jetty-servlet/src/main/java/hello/HelloWebServer.java → frameworks/Java/jetty/src/main/java/hello/servlet/HelloWebServerServlet.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.servlet;
 
 import org.eclipse.jetty.server.HttpConfiguration;
 import org.eclipse.jetty.server.HttpConnectionFactory;
@@ -11,7 +11,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
  * An implementation of the TechEmpower benchmark tests using the Jetty web
  * server.  
  */
-public final class HelloWebServer 
+public final class HelloWebServerServlet 
 {
 
     public static void main(String[] args) throws Exception

+ 1 - 1
frameworks/Java/jetty-servlet/src/main/java/hello/JsonServlet.java → frameworks/Java/jetty/src/main/java/hello/servlet/JsonServlet.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.servlet;
 
 import java.io.IOException;
 import java.util.Collections;

+ 1 - 1
frameworks/Java/jetty-servlet/src/main/java/hello/PlaintextServlet.java → frameworks/Java/jetty/src/main/java/hello/servlet/PlaintextServlet.java

@@ -1,4 +1,4 @@
-package hello;
+package hello.servlet;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;