-
Notifications
You must be signed in to change notification settings - Fork 2k
OfficeFloor implementation of Framework Benchmark Performance Tests. #1760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
blee-techempower
merged 1 commit into
TechEmpower:master
from
sagenschneider:techempire_master
Nov 3, 2015
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/production/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"framework": "officefloor", | ||
"tests": [{ | ||
"default": { | ||
"setup_file": "setup", | ||
"json_url": "/json-service.woof", | ||
"db_url": "/singleQuery-service.woof", | ||
"query_url": "/multipleQueries-service.woof?queries=", | ||
"fortune_url": "/fortune.woof", | ||
"update_url": "/databaseUpdate-service.woof?queries=", | ||
"plaintext_url": "/plaintext.woof", | ||
"port": 7878, | ||
"approach": "Realistic", | ||
"classification": "Fullstack", | ||
"database": "MySQL", | ||
"framework": "officefloor", | ||
"language": "Java", | ||
"orm": "Full", | ||
"platform": "OfficeFloor", | ||
"webserver": "WoOF (Web on OfficeFloor)", | ||
"os": "Linux", | ||
"database_os": "Linux", | ||
"display_name": "officefloor", | ||
"notes": "", | ||
"versus": "" | ||
} | ||
}] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>net.officefloor.performance</groupId> | ||
<artifactId>TechEmpowerPerformance</artifactId> | ||
<version>0.0.1</version> | ||
<packaging>war</packaging> | ||
<name>TechEmpowerPerformance</name> | ||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<officefloor-version>2.16.0</officefloor-version> | ||
<compiler-version>3.1</compiler-version> | ||
<datanucleus-version>4.0.0-release</datanucleus-version> | ||
<mysql-version>5.1.36</mysql-version> | ||
<junit-version>4.11</junit-version> | ||
</properties> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-war-plugin</artifactId> | ||
<version>2.4</version> | ||
</plugin> | ||
<plugin> | ||
<!-- Standard JVM for compilation --> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>${compiler-version}</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.datanucleus</groupId> | ||
<artifactId>datanucleus-maven-plugin</artifactId> | ||
<version>${datanucleus-version}</version> | ||
<configuration> | ||
<api>JPA</api> | ||
<verbose>true</verbose> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>enhance</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>net.officefloor.plugin</groupId> | ||
<artifactId>officeplugin_woof</artifactId> | ||
<version>${officefloor-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.officefloor.plugin</groupId> | ||
<artifactId>officeplugin_json</artifactId> | ||
<version>${officefloor-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.officefloor.plugin</groupId> | ||
<artifactId>officeplugin_jpa</artifactId> | ||
<version>${officefloor-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.17</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.persistence</groupId> | ||
<artifactId>javax.persistence</artifactId> | ||
<version>2.1.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.datanucleus</groupId> | ||
<artifactId>datanucleus-accessplatform-jpa-rdbms</artifactId> | ||
<type>pom</type> | ||
<version>${datanucleus-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>${mysql-version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.mchange</groupId> | ||
<artifactId>c3p0</artifactId> | ||
<version>0.9.5.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<version>1.12.4</version> | ||
</dependency> | ||
<dependency> | ||
<!-- Should be scope test, but available to run stand alone for manual testing --> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>1.4.187</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
<version>4.3.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit-version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
datanucleus.ConnectionDriverName = com.mysql.jdbc.Driver | ||
datanucleus.ConnectionURL = jdbc:mysql://DATABASE_HOST:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true | ||
datanucleus.ConnectionUserName = benchmarkdbuser | ||
datanucleus.ConnectionPassword = benchmarkdbpass | ||
datanucleus.connectionPoolingType = C3P0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
# Propagate any failure | ||
set -e | ||
|
||
# Install Java8 manually (fw_depends java8 is failing in vagrant-development) | ||
sudo add-apt-repository -y ppa:webupd8team/java | ||
sudo apt-get update | ||
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections | ||
sudo apt-get install -y oracle-java8-installer | ||
|
||
# Ensure maven uses appropriate version of Java | ||
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/ | ||
sudo update-alternatives --set java /usr/lib/jvm/java-8-oracle/jre/bin/java | ||
sudo update-alternatives --set javac /usr/lib/jvm/java-8-oracle/bin/javac | ||
|
||
# Need maven 3.1.1 or higher (default for Ubuntu is 3.0.5) | ||
echo "Loading maven ..." | ||
sudo add-apt-repository "deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main" | ||
sudo apt-get update | ||
sudo apt-get -y --force-yes install maven3 | ||
if [ -e /usr/bin/mvn ] | ||
then | ||
sudo rm -f /usr/bin/mvn | ||
fi | ||
sudo ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn | ||
|
||
# Setup configuration file (normally properties files contains environment specific information but create copy to avoid SCM issues) | ||
echo "Creating configuration for OfficeFloor environment ..." | ||
mkdir -p ./production | ||
cp ./raw/datasource.properties ./production | ||
sed -i 's|DATABASE_HOST|'"${DBHOST}"'|g' ./production/datasource.properties | ||
echo "Configuration created" | ||
|
||
# Compile application | ||
echo "Building OfficeFloor test application ..." | ||
mvn -DskipTests clean package | ||
echo "OfficeFloor test application built" | ||
|
||
# Run application | ||
echo "Starting OfficeFloor application" | ||
mvn -DincludeGWT=false -DenvDir=production net.officefloor.maven:woof-maven-plugin:run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
./officefloor/pom.xml | ||
./officefloor/src/main/java/net/officefloor/performance/entities/Fortune.java | ||
./officefloor/src/main/java/net/officefloor/performance/entities/World.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/DatabaseUpdateLogic.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/FortunesLogic.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/JsonSerialisationLogic.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/LogicUtil.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/MultipleDatabaseQueriesLogic.java | ||
./officefloor/src/main/java/net/officefloor/performance/logic/SingleDatabaseQueryLogic.java | ||
./officefloor/src/main/resources/application.objects | ||
./officefloor/src/main/resources/application.teams | ||
./officefloor/src/main/resources/application.woof | ||
./officefloor/src/main/resources/c3p0.properties | ||
./officefloor/src/main/resources/datasource.properties | ||
./officefloor/src/main/resources/log4j.properties | ||
./officefloor/src/main/resources/META-INF/persistence.xml | ||
./officefloor/src/main/webapp/fortune.woof.html | ||
./officefloor/src/main/webapp/plaintext.woof.html | ||
./officefloor/src/main/webapp/service.woof.html | ||
./officefloor/src/main/webapp/WEB-INF/web.xml |
28 changes: 28 additions & 0 deletions
28
frameworks/Java/officefloor/src/main/java/net/officefloor/performance/entities/Fortune.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.officefloor.performance.entities; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
import javax.persistence.NamedQueries; | ||
import javax.persistence.NamedQuery; | ||
|
||
import net.officefloor.plugin.web.http.template.UnescapedHtml; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
|
||
/** | ||
* Fortune entity. | ||
* | ||
* @author Daniel Sagenschneider | ||
*/ | ||
@Data | ||
@Entity | ||
@NamedQueries({ @NamedQuery(name = "Fortune.getAll", query = "SELECT e FROM Fortune e") }) | ||
public class Fortune { | ||
public static final String NAMED_QUERY_ALL = "Fortune.getAll"; | ||
|
||
@Id | ||
private int id; | ||
|
||
@NonNull | ||
private String message; | ||
} |
19 changes: 19 additions & 0 deletions
19
frameworks/Java/officefloor/src/main/java/net/officefloor/performance/entities/World.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package net.officefloor.performance.entities; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.Id; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* World entity. | ||
* | ||
* @author Daniel Sagenschneider | ||
*/ | ||
@Data | ||
@Entity | ||
public class World { | ||
@Id | ||
private int id; | ||
private int randomNumber; | ||
} |
59 changes: 59 additions & 0 deletions
59
...Java/officefloor/src/main/java/net/officefloor/performance/logic/DatabaseUpdateLogic.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package net.officefloor.performance.logic; | ||
|
||
import java.io.IOException; | ||
import java.io.Serializable; | ||
import java.util.Arrays; | ||
|
||
import javax.persistence.EntityManager; | ||
|
||
import lombok.Data; | ||
import net.officefloor.performance.entities.World; | ||
import net.officefloor.plugin.json.JsonResponseWriter; | ||
import net.officefloor.plugin.web.http.application.HttpParameters; | ||
|
||
/** | ||
* Logic for Database Update query. | ||
* | ||
* @author Daniel Sagenschneider | ||
*/ | ||
public class DatabaseUpdateLogic { | ||
|
||
@Data | ||
@HttpParameters | ||
public static class Parameters implements Serializable { | ||
private String queries; | ||
} | ||
|
||
public void service(Parameters parameters, EntityManager entityManager, | ||
JsonResponseWriter response) throws IOException { | ||
|
||
// Obtain the number of queries | ||
int queryCount = LogicUtil.getQueryCount(parameters.queries); | ||
|
||
// Create the listing of random identifiers | ||
int[] identifiers = new int[queryCount]; | ||
for (int i = 0; i < identifiers.length; i++) { | ||
identifiers[i] = LogicUtil.generateRandomNumber(1, 10000); | ||
} | ||
|
||
// Sort identifiers to avoid dead locks | ||
Arrays.sort(identifiers); | ||
|
||
// Obtain the world objects (changing their random values) | ||
World[] list = new World[queryCount]; | ||
for (int i = 0; i < list.length; i++) { | ||
|
||
// Obtain the object | ||
int identifier = identifiers[i]; | ||
World world = entityManager.find(World.class, identifier); | ||
list[i] = world; | ||
|
||
// Change the random value | ||
world.setRandomNumber(LogicUtil.generateRandomNumber(1, 10000)); | ||
} | ||
|
||
// Send the response | ||
response.writeResponse(list); | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
...works/Java/officefloor/src/main/java/net/officefloor/performance/logic/FortunesLogic.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package net.officefloor.performance.logic; | ||
|
||
import java.util.Arrays; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
|
||
import javax.persistence.EntityManager; | ||
|
||
import lombok.Data; | ||
import net.officefloor.performance.entities.Fortune; | ||
|
||
/** | ||
* Logic for Database Update query. | ||
* | ||
* @author Daniel Sagenschneider | ||
*/ | ||
public class FortunesLogic { | ||
|
||
@Data | ||
public static class TemplateData { | ||
private final Fortune[] fortunes; | ||
} | ||
|
||
public TemplateData getTemplate(EntityManager entityManager) { | ||
|
||
// Obtain all the fortunes | ||
List<Fortune> list = entityManager.createNamedQuery( | ||
Fortune.NAMED_QUERY_ALL, Fortune.class).getResultList(); | ||
|
||
// Obtain the fortunes as array | ||
Fortune[] fortunes = list.toArray(new Fortune[list.size() + 1]); | ||
int index = 0; | ||
for (Fortune fortune : list) { | ||
fortunes[index++] = fortune; | ||
} | ||
|
||
// Add the necessary Fortune | ||
fortunes[fortunes.length - 1] = new Fortune( | ||
"Additional fortune added at request time."); | ||
|
||
// Sort the fortunes | ||
Arrays.sort(fortunes, new Comparator<Fortune>() { | ||
@Override | ||
public int compare(Fortune a, Fortune b) { | ||
return String.CASE_INSENSITIVE_ORDER.compare(a.getMessage(), | ||
b.getMessage()); | ||
} | ||
}); | ||
|
||
// Return the data for the template | ||
return new TemplateData(fortunes); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete everything about this and replace with:
We are presently in the midst of opening a pull request to fix up the various java version problems (likely, the culprit behind why you did your dependencies this way), so once we get that in (hopefully, today or tomorrow) you can open your new pull request.