Skip to content

Commit 875969e

Browse files
luyongshoulouis
and
louis
authored
add edap-http framework (#6160)
* 初始化edap-http-benchmark的项目 * 修改pom文件以及测试的配置 * 修改端口号,jdk版本以及去掉有问题的plaintext的测试项 * 修改Message启动时初始化为每次请求生成新的对象 * 去掉多余的"s"字符 * 增加plaintext的测试配置 * add edap-http framwork Co-authored-by: louis <luysh@yonyou.com>
1 parent 9e87fa9 commit 875969e

File tree

7 files changed

+200
-1
lines changed

7 files changed

+200
-1
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ env:
4848
- "TESTDIR=Haskell/warp"
4949
- "TESTDIR=Haskell/wizzardo-inline"
5050
- "TESTDIR=Haskell/postgrest"
51-
- 'TESTDIR="Java/act Java/comsat"'
51+
- 'TESTDIR="Java/act Java/comsat Java/edap-http"'
5252
- 'TESTDIR="Java/activeweb Java/armeria Java/baratine Java/bayou Java/blade Java/curacao Java/dropwizard Java/firenio Java/servicetalk Java/voovan"'
5353
- 'TESTDIR="Java/gemini Java/greenlightning Java/grizzly Java/helidon Java/httpserver Java/jetty Java/jlhttp Java/jooby Java/wicket"'
5454
- 'TESTDIR="Java/light-java Java/minijax Java/nanohttpd Java/netty Java/ninja-standalone Java/officefloor Java/proteus Java/quarkus"'

frameworks/Java/edap-http/README.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# edap-http Benchmarking Test
2+
3+
4+
This is the edap-http portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
5+
6+
### JSON Encoding Test
7+
* [JSON test source](src/main/java/io/edap/http/HttpBootstrap.java)
8+
* [Plaintext test source](src/main/java/io/edap/http/HttpBootstrap.java)
9+
10+
## Versions
11+
12+
* [Java OpenJDK 11](http://openjdk.java.net/)
13+
* [edap-http_0.1](https://github.com/edap-io/edap)
14+
15+
## Test URLs
16+
17+
### JSON Encoding Test
18+
19+
http://localhost:8080/json
20+
21+
### Plaintext Encoding Test
22+
23+
http://localhost:8080/plaintext
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"framework": "edap-http",
3+
"tests": [
4+
{
5+
"default": {
6+
"plaintext_url": "/plaintext",
7+
"json_url": "/json",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Platform",
11+
"database": "Postgres",
12+
"framework": "None",
13+
"language": "Java",
14+
"flavor": "None",
15+
"orm": "Raw",
16+
"platform": "edap",
17+
"webserver": "None",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "edap-http",
21+
"notes": "",
22+
"versus": "edap-http"
23+
}
24+
}
25+
]
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM maven:3.6.3-openjdk-8-slim as maven
2+
WORKDIR /edap-http
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
RUN mvn compile assembly:single -q
6+
7+
FROM openjdk:8u275-jdk-slim
8+
WORKDIR /edap-http
9+
COPY --from=maven /edap-http/target/edap-http-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar app.jar
10+
CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-cp", "app.jar", "io.edap.http.Bootstrap"]

frameworks/Java/edap-http/pom.xml

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>io.edap</groupId>
8+
<artifactId>edap-http-benchmark</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>jar</packaging>
11+
12+
<properties>
13+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<java.version>8</java.version>
15+
<maven.compiler.source>8</maven.compiler.source>
16+
<maven.compiler.target>8</maven.compiler.target>
17+
<maven.compiler.compilerVersion>8</maven.compiler.compilerVersion>
18+
<edap.version>0.1-SNAPSHOT</edap.version>
19+
<edap.name>edapx</edap.name>
20+
</properties>
21+
22+
<dependencies>
23+
<dependency>
24+
<groupId>io.edap</groupId>
25+
<artifactId>${edap.name}-http</artifactId>
26+
<version>${edap.version}</version>
27+
</dependency>
28+
</dependencies>
29+
30+
<repositories>
31+
<repository>
32+
<id>central</id>
33+
<name>Central Repository</name>
34+
<url>https://repo.maven.apache.org/maven2</url>
35+
</repository>
36+
<repository>
37+
<id>sonatype-nexus-snapshots</id>
38+
<name>Sonatype Nexus Snapshots</name>
39+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
40+
</repository>
41+
</repositories>
42+
<pluginRepositories>
43+
<pluginRepository>
44+
<id>central</id>
45+
<name>Central Repository</name>
46+
<url>https://repo.maven.apache.org/maven2</url>
47+
</pluginRepository>
48+
<pluginRepository>
49+
<id>sonatype-nexus-snapshots</id>
50+
<name>Sonatype Nexus Snapshots</name>
51+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
52+
<releases>
53+
<enabled>false</enabled>
54+
</releases>
55+
<snapshots>
56+
<enabled>true</enabled>
57+
</snapshots>
58+
</pluginRepository>
59+
</pluginRepositories>
60+
<build>
61+
<plugins>
62+
63+
<plugin>
64+
<inherited>true</inherited>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-compiler-plugin</artifactId>
67+
<version>3.8.0</version>
68+
<configuration>
69+
<debug>false</debug>
70+
<source>8</source>
71+
<target>8</target>
72+
</configuration>
73+
</plugin>
74+
75+
<plugin>
76+
<artifactId>maven-assembly-plugin</artifactId>
77+
<version>3.1.0</version>
78+
<configuration>
79+
<descriptorRefs>
80+
<descriptorRef>jar-with-dependencies</descriptorRef>
81+
</descriptorRefs>
82+
</configuration>
83+
<executions>
84+
<execution>
85+
<id>make-assembly</id>
86+
<phase>package</phase>
87+
<goals>
88+
<goal>single</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
94+
</plugins>
95+
</build>
96+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package io.edap.http;
2+
3+
import io.edap.http.model.Message;
4+
import io.edap.x.Edap;
5+
import io.edap.x.http.HttpServer;
6+
import io.edap.x.http.HttpServerBuilder;
7+
8+
import java.io.IOException;
9+
10+
import static io.edap.x.http.header.ContentType.JSON;
11+
import static io.edap.x.http.header.ContentType.PLAIN;
12+
13+
public class Bootstrap {
14+
15+
public static void main(String[] args) throws IOException {
16+
17+
HttpServer httpServer = new HttpServerBuilder()
18+
.listen(8080)
19+
.req("/plaintext", (req, resp) -> resp.contentType(PLAIN).write("Hello, World!"))
20+
.get("/json", (req, resp) -> resp.contentType(JSON).write(new Message("Hello, World!")))
21+
.build();
22+
Edap edap = new Edap();
23+
edap.addServer(httpServer);
24+
edap.run();
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.edap.http.model;
2+
3+
public class Message {
4+
private String message;
5+
6+
7+
public Message(String message) {
8+
this.message = message;
9+
}
10+
11+
public String getMessage() {
12+
return message;
13+
}
14+
15+
public void setMessage(String message) {
16+
this.message = message;
17+
}
18+
}

0 commit comments

Comments
 (0)