Skip to content

Commit 732d0a5

Browse files
authored
Merge pull request #223 from spcl/java_benchmarks_support
Java benchmarks support
2 parents 1172d3f + c071f75 commit 732d0a5

48 files changed

Lines changed: 2193 additions & 199 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,5 +188,7 @@ cache
188188
.idea
189189
*.iml
190190

191+
# Visual Studio Code files
192+
.vscode/
191193
# MacOS Finder
192-
**/.DS_Store
194+
**/.DS_Store

.mypy.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ ignore_missing_imports = True
3636
[mypy-google.cloud.storage]
3737
ignore_missing_imports = True
3838

39+
[mypy-google.cloud.devtools]
40+
ignore_missing_imports = True
41+
3942
[mypy-google.api_core]
4043
ignore_missing_imports = True
4144

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Dynamic dependency resolution with CMake generation
1616
- Support for Boost, OpenCV, igraph, PyTorch, hiredis libraries
1717
- C++ implementations: 010.sleep, 210.thumbnailer, 501.graph-pagerank, 503.graph-bfs, 411.image-recognition
18+
* **Java benchmarks**: initial support for Java on all four platforms (#223), including benchmark **110.dynamic-html**.
1819
* **Python**: Updated support for Python 3.8, 3.9, 3.10, 3.11, 3.12
1920
* **Node.js**: Updated support for Node.js 14, 16, 18, 20
2021

@@ -104,6 +105,8 @@ This release includes contributions from:
104105
* @lawrence910426 - Colored CLI output (#141)
105106
* @alevy - Documentation improvements (#139)
106107
* @skehrli - Local memory measurements (#101)
108+
* @mahlashrifi - Java benchmarks support (#223)
109+
* @xSurus - improvements and extensions to Java benchmarks (#223)
107110
* And many others who contributed bug reports, testing, and feedback!
108111

109112
## [1.1.0](https://github.com/spcl/serverless-benchmarks/compare/v1.0...v1.1) (2022-05-30)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,5 @@ To verify the correctness of installation, you can use [our regression testing](
187187
* [Prajin Khadka](https://github.com/prajinkhadka) - contributed new language versions, container support, and ARM builds.
188188
* [Horia Mercan](https://github.com/HoriaMercan) - contributed new benchmarks in C++.
189189
* [Dillon Elste (ETH Zurich)](https://github.com/DJAntivenom) - bugfixing in C++.
190+
* [Mahla Sharifi](https://github.com/mahlashrifi) - contributed support for Java benchmarks.
191+
* [Alexander Schlieper (ETH Zurich)](https://github.com/xSurus) - improved support for Java benchmarks.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"timeout": 120,
33
"memory": 128,
4-
"languages": ["python", "nodejs", "cpp"],
4+
"languages": ["python", "nodejs", "java", "cpp"],
55
"modules": []
66
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>function</groupId>
7+
<artifactId>benchmark</artifactId>
8+
<version>1.0</version>
9+
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
<java.version>${env.JAVA_VERSION}</java.version>
13+
</properties>
14+
15+
<dependencies>
16+
<!-- PLATFORM_DEPENDENCIES -->
17+
</dependencies>
18+
19+
<build>
20+
<finalName>function</finalName>
21+
<plugins>
22+
<!-- Compiler Plugin using environment-sourced version -->
23+
<plugin>
24+
<groupId>org.apache.maven.plugins</groupId>
25+
<artifactId>maven-compiler-plugin</artifactId>
26+
<version>3.8.1</version>
27+
<configuration>
28+
<source>${java.version}</source>
29+
<target>${java.version}</target>
30+
</configuration>
31+
</plugin>
32+
33+
<!-- Shade plugin to build fat JAR -->
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-shade-plugin</artifactId>
37+
<version>3.2.4</version>
38+
<executions>
39+
<execution>
40+
<phase>package</phase>
41+
<goals><goal>shade</goal></goals>
42+
<configuration>
43+
<filters>
44+
<filter>
45+
<artifact>*:*</artifact>
46+
<excludes>
47+
<exclude>module-info.class</exclude>
48+
<exclude>META-INF/*.SF</exclude>
49+
<exclude>META-INF/*.DSA</exclude>
50+
<exclude>META-INF/*.RSA</exclude>
51+
</excludes>
52+
</filter>
53+
</filters>
54+
</configuration>
55+
</execution>
56+
</executions>
57+
</plugin>
58+
</plugins>
59+
</build>
60+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package function;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public class Function {
7+
8+
public Map<String, Object> handler(Map<String, Object> event) {
9+
double sleepSeconds = parseSeconds(event.get("sleep"));
10+
try {
11+
Thread.sleep((long) (sleepSeconds * 1000));
12+
} catch (InterruptedException e) {
13+
Thread.currentThread().interrupt();
14+
}
15+
Map<String, Object> result = new HashMap<>();
16+
result.put("result", sleepSeconds);
17+
return result;
18+
}
19+
20+
private double parseSeconds(Object value) {
21+
if (value instanceof Number) {
22+
return ((Number) value).doubleValue();
23+
}
24+
if (value instanceof String) {
25+
try {
26+
return Double.parseDouble((String) value);
27+
} catch (NumberFormatException ignored) {
28+
return 0;
29+
}
30+
}
31+
return 0;
32+
}
33+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"timeout": 10,
33
"memory": 128,
4-
"languages": ["python", "nodejs"],
4+
"languages": ["python", "nodejs", "java"],
55
"modules": []
66
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
OUTPUT_DIR=$1
4+
5+
# Copy templates directory to the output directory
6+
cp -r templates "$OUTPUT_DIR/"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+
<groupId>function</groupId>
7+
<artifactId>benchmark</artifactId>
8+
<version>1.0</version>
9+
<properties>
10+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
11+
<java.version>${env.JAVA_VERSION}</java.version>
12+
</properties>
13+
<dependencies>
14+
<!-- Mustache templating engine -->
15+
<dependency>
16+
<groupId>com.github.spullara.mustache.java</groupId>
17+
<artifactId>compiler</artifactId>
18+
<version>0.9.10</version>
19+
</dependency>
20+
<!-- PLATFORM_DEPENDENCIES -->
21+
</dependencies>
22+
<build>
23+
<!-- Force rebuild for Architecture fix -->
24+
<finalName>function</finalName>
25+
<resources>
26+
<resource>
27+
<directory>${project.basedir}/templates</directory>
28+
<targetPath>templates</targetPath>
29+
<includes>
30+
<include>**/*.html</include>
31+
</includes>
32+
</resource>
33+
</resources>
34+
<plugins>
35+
<!-- Compiler Plugin using environment-sourced version -->
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-compiler-plugin</artifactId>
39+
<version>3.8.1</version>
40+
<configuration>
41+
<source>${java.version}</source>
42+
<target>${java.version}</target>
43+
</configuration>
44+
</plugin>
45+
46+
<!-- Shade plugin to build fat JAR -->
47+
<plugin>
48+
<groupId>org.apache.maven.plugins</groupId>
49+
<artifactId>maven-shade-plugin</artifactId>
50+
<version>3.2.4</version>
51+
<executions>
52+
<execution>
53+
<phase>package</phase>
54+
<goals>
55+
<goal>shade</goal>
56+
</goals>
57+
<configuration>
58+
<createDependencyReducedPom>false</createDependencyReducedPom>
59+
<filters>
60+
<filter>
61+
<artifact>*:*</artifact>
62+
<excludes>
63+
<exclude>module-info.class</exclude>
64+
<exclude>META-INF/*.SF</exclude>
65+
<exclude>META-INF/*.RSA</exclude>
66+
<exclude>META-INF/*.DSA</exclude>
67+
<exclude>module-info.class</exclude>
68+
<exclude>META-INF/versions/*/module-info.class</exclude>
69+
<exclude>META-INF/versions/**/module-info.class</exclude>
70+
</excludes>
71+
</filter>
72+
</filters>
73+
</configuration>
74+
</execution>
75+
</executions>
76+
</plugin>
77+
</plugins>
78+
</build>
79+
</project>

0 commit comments

Comments
 (0)