Browse Source

Merge branch 'master' into add-postgres-nodejs

Zane Kansil 10 years ago
parent
commit
28dd154ca5
47 changed files with 506 additions and 515 deletions
  1. 1 1
      .travis.yml
  2. 3 3
      frameworks/C++/silicon/main.cc
  3. 1 1
      frameworks/C++/silicon/setup_epoll_mysql.sh
  4. 1 1
      frameworks/C++/silicon/setup_tpc_mysql.sh
  5. 0 25
      frameworks/Java/dropwizard-mongodb/benchmark_config.json
  6. 0 20
      frameworks/Java/dropwizard-mongodb/hello-world.yml
  7. 0 3
      frameworks/Java/dropwizard-mongodb/install.sh
  8. 0 84
      frameworks/Java/dropwizard-mongodb/pom.xml
  9. 0 8
      frameworks/Java/dropwizard-mongodb/setup.sh
  10. 0 11
      frameworks/Java/dropwizard-mongodb/source_code
  11. 0 27
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldConfiguration.java
  12. 0 47
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldService.java
  13. 0 40
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/core/World.java
  14. 0 21
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoHealthCheck.java
  15. 0 45
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/Helper.java
  16. 0 30
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/JsonResource.java
  17. 0 66
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/WorldResource.java
  18. 24 3
      frameworks/Java/dropwizard/benchmark_config.json
  19. 10 2
      frameworks/Java/dropwizard/hello-world.yml
  20. 8 2
      frameworks/Java/dropwizard/pom.xml
  21. 11 3
      frameworks/Java/dropwizard/source_code
  22. 37 6
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/HelloWorldService.java
  23. 9 0
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/config/HelloWorldConfiguration.java
  24. 34 0
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/config/MongoConfiguration.java
  25. 5 5
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/MongoManaged.java
  26. 4 1
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/model/Fortune.java
  27. 10 3
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/model/World.java
  28. 37 0
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/MongoFortuneResource.java
  29. 65 0
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/MongoWorldResource.java
  30. 4 8
      frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/WorldResource.java
  31. 1 1
      frameworks/Java/grizzly-jersey/benchmark_config.json
  32. 15 13
      frameworks/Java/grizzly-jersey/src/main/java/hello/DbResource.java
  33. 2 2
      frameworks/Java/jetty/pom.xml
  34. 1 1
      frameworks/JavaScript/express/package.json
  35. 4 4
      frameworks/Scala/colossus/build.sbt
  36. 88 24
      frameworks/Scala/colossus/src/main/scala/example/Main.scala
  37. 8 0
      frameworks/Scala/finch/.gitignore
  38. 30 0
      frameworks/Scala/finch/README.md
  39. 23 0
      frameworks/Scala/finch/benchmark_config.json
  40. 16 0
      frameworks/Scala/finch/build.sbt
  41. 3 0
      frameworks/Scala/finch/install.sh
  42. 4 0
      frameworks/Scala/finch/project/build.properties
  43. 1 0
      frameworks/Scala/finch/project/plugins.sbt
  44. 8 0
      frameworks/Scala/finch/setup.sh
  45. 34 0
      frameworks/Scala/finch/src/main/scala/WebServer.scala
  46. 0 1
      source_code
  47. 4 3
      toolset/setup/linux/languages/java8.sh

+ 1 - 1
.travis.yml

@@ -64,7 +64,6 @@ env:
     - "TESTDIR=Java/activeweb"
     - "TESTDIR=Java/curacao"
     - "TESTDIR=Java/dropwizard"
-    - "TESTDIR=Java/dropwizard-mongodb"
     - "TESTDIR=Java/gemini"
     - "TESTDIR=Java/grizzly-bm"
     - "TESTDIR=Java/grizzly-jersey"
@@ -172,6 +171,7 @@ env:
     - "TESTDIR=Scala/spray-es"
     - "TESTDIR=Scala/unfiltered"
     - "TESTDIR=Scala/http4s"
+    - "TESTDIR=Scala/finch"
     - "TESTDIR=Ur/urweb"
 
 before_install:

+ 3 - 3
frameworks/C++/silicon/main.cc

@@ -42,9 +42,9 @@ std::string escape_html_entities(const std::string& data)
 int main(int argc, char* argv[])
 {
 
-  if (argc != 3)
+  if (argc != 4)
   {
-    std::cerr << "Usage: " << argv[0] << " mysql_host port" << std::endl;
+    std::cerr << "Usage: " << argv[0] << " mysql_host port nthreads" << std::endl;
     return 1;
   }
   
@@ -120,7 +120,7 @@ int main(int argc, char* argv[])
     // Start the server.
     sl::mhd_json_serve(hello_api, atoi(argv[2])
 #ifdef TFB_USE_EPOLL
-                       , _linux_epoll, _nthreads = 1000
+                       , _linux_epoll, _nthreads = atoi(argv[3])
 #else
                        , _one_thread_per_connection
 #endif

+ 1 - 1
frameworks/C++/silicon/setup_epoll_mysql.sh

@@ -1,3 +1,3 @@
 #! /bin/bash
 
-$TROOT/build/silicon_epoll_mysql ${DBHOST} 8080 &
+$TROOT/build/silicon_epoll_mysql ${DBHOST} 8080 ${MAX_THREADS} &

+ 1 - 1
frameworks/C++/silicon/setup_tpc_mysql.sh

@@ -1,3 +1,3 @@
 #! /bin/bash
 
-$TROOT/build/silicon_tpc_mysql ${DBHOST} 8080 &
+$TROOT/build/silicon_tpc_mysql ${DBHOST} 8080 ${MAX_THREADS} &

+ 0 - 25
frameworks/Java/dropwizard-mongodb/benchmark_config.json

@@ -1,25 +0,0 @@
-{
-  "framework": "dropwizard-mongodb",
-  "tests": [{
-    "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/db?queries=",
-      "port": 9000,
-      "approach": "Realistic",
-      "classification": "Fullstack",
-      "database": "MongoDB",
-      "framework": "dropwizard",
-      "language": "Java",
-      "orm": "Full",
-      "platform": "Jetty",
-      "webserver": "Jetty",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "dropwizard-mongodb",
-      "notes": "mongodb implementation of dropwizard example",
-      "versus": ""
-    }
-  }]
-}

+ 0 - 20
frameworks/Java/dropwizard-mongodb/hello-world.yml

@@ -1,20 +0,0 @@
-http:
-  port: 9000
-
-  requestLog:
-
-    # Settings for logging to stdout.
-    console:
-      # If true, log requests to stdout.
-      enabled: false
-
-logging:
-
-  # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
-  level: OFF
-
-  console:
-
-    # If true, write log statements to stdout.
-    enabled: false
-

+ 0 - 3
frameworks/Java/dropwizard-mongodb/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends java7 maven

+ 0 - 84
frameworks/Java/dropwizard-mongodb/pom.xml

@@ -1,84 +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.danielt</groupId>
-    <artifactId>dropwizard-mongodb</artifactId>
-    <version>0.0.1-SNAPSHOT</version>
-
-    <dependencies>
-        <dependency>
-            <groupId>com.yammer.dropwizard</groupId>
-            <artifactId>dropwizard-core</artifactId>
-            <version>0.6.2</version>
-        </dependency>
-		<dependency>
-			<groupId>org.mongojack</groupId>
-			<artifactId>mongojack</artifactId>
-			<version>2.0.0</version>
-		</dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <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>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
-                <version>2.3.2</version>
-                <configuration>
-                    <archive>
-                        <manifest>
-                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-                        </manifest>
-                    </archive>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-shade-plugin</artifactId>
-                <version>1.6</version>
-                <configuration>
-                    <createDependencyReducedPom>true</createDependencyReducedPom>
-                    <filters>
-                        <filter>
-                            <artifact>*:*</artifact>
-                            <excludes>
-                                <exclude>META-INF/*.SF</exclude>
-                                <exclude>META-INF/*.DSA</exclude>
-                                <exclude>META-INF/*.RSA</exclude>
-                            </excludes>
-                        </filter>
-                    </filters>
-                </configuration>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <transformers>
-                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
-                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
-                                    <mainClass>com.example.helloworld.HelloWorldService</mainClass>
-                                </transformer>
-                            </transformers>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-</project>

+ 0 - 8
frameworks/Java/dropwizard-mongodb/setup.sh

@@ -1,8 +0,0 @@
-#!/bin/bash
-
-# load java environment variables
-source $IROOT/java7.installed
-
-mvn clean package
-
-java -jar target/dropwizard-mongodb-0.0.1-SNAPSHOT.jar server hello-world.yml &

+ 0 - 11
frameworks/Java/dropwizard-mongodb/source_code

@@ -1,11 +0,0 @@
-./dropwizard-mongodb/src/main/java/com/example/helloworld/
-./dropwizard-mongodb/src/main/java/com/example/helloworld/db
-./dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoHealthCheck.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoManaged.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldService.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/resources
-./dropwizard-mongodb/src/main/java/com/example/helloworld/resources/WorldResource.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/resources/JsonResource.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/core
-./dropwizard-mongodb/src/main/java/com/example/helloworld/core/World.java
-./dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldConfiguration.java

+ 0 - 27
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldConfiguration.java

@@ -1,27 +0,0 @@
-
-package com.example.helloworld;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-import org.hibernate.validator.constraints.NotEmpty;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.yammer.dropwizard.config.Configuration;
-
-public class HelloWorldConfiguration
-    extends Configuration
-{
-	@JsonProperty
-    @NotEmpty
-    public String mongohost = "localhost";
- 
-    @JsonProperty
-    @Min(1)
-    @Max(65535)
-    public int mongoport = 27017;
- 
-    @JsonProperty
-    @NotEmpty
-    public String mongodb = "hello_world";
-}

+ 0 - 47
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldService.java

@@ -1,47 +0,0 @@
-
-package com.example.helloworld;
-
-import java.net.UnknownHostException;
-
-import org.mongojack.JacksonDBCollection;
-
-import com.example.helloworld.core.World;
-import com.example.helloworld.db.MongoHealthCheck;
-import com.example.helloworld.db.MongoManaged;
-import com.example.helloworld.resources.JsonResource;
-import com.example.helloworld.resources.WorldResource;
-import com.mongodb.DB;
-import com.mongodb.Mongo;
-import com.yammer.dropwizard.Service;
-import com.yammer.dropwizard.config.Bootstrap;
-import com.yammer.dropwizard.config.Environment;
-
-public class HelloWorldService
-    extends Service<HelloWorldConfiguration>
-{
-
-  public static void main(String[] args) throws Exception
-  {
-    new HelloWorldService().run(args);
-  }
-
-  @Override
-  public void initialize(Bootstrap<HelloWorldConfiguration> bootstrap)
-  {
-    bootstrap.setName("hello-world");
-  }
-
-  @Override
-  public void run(HelloWorldConfiguration config, Environment environment) throws UnknownHostException
-  {
-    Mongo mongo = new Mongo(config.mongohost, config.mongoport);
-    MongoManaged mongoManaged = new MongoManaged(mongo);
-    environment.manage(mongoManaged);
-    environment.addHealthCheck(new MongoHealthCheck(mongo));
-    DB db = mongo.getDB(config.mongodb);
-    JacksonDBCollection<World, String> worlds = JacksonDBCollection.wrap(db.getCollection("world"), World.class, String.class);
-    environment.addResource(new WorldResource(worlds));
-    environment.addResource(new JsonResource());
-  }
-
-}

+ 0 - 40
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/core/World.java

@@ -1,40 +0,0 @@
-
-package com.example.helloworld.core;
-
-import javax.persistence.*;
-
-import org.mongojack.Id;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@Entity
-@Table(name = "World")
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class World
-{
-  @Id
-  private long id;
-
-  @Column(name = "randomNumber", nullable = false)
-  private long randomNumber;
-
-  public long getId()
-  {
-    return id;
-  }
-
-  public void setId(long id)
-  {
-    this.id = id;
-  }
-
-  public long getRandomNumber()
-  {
-    return this.randomNumber;
-  }
-
-  public void setRandomNumber(long randomNumber)
-  {
-    this.randomNumber = randomNumber;
-  }
-}

+ 0 - 21
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoHealthCheck.java

@@ -1,21 +0,0 @@
-package com.example.helloworld.db;
-
-import com.mongodb.Mongo;
-import com.yammer.metrics.core.HealthCheck;
- 
-public class MongoHealthCheck extends HealthCheck {
- 
-    private Mongo mongo;
- 
-    public MongoHealthCheck(Mongo mongo) {
-        super("MongoDBHealthCheck");
-        this.mongo = mongo;
-    }
- 
-    @Override
-    protected Result check() throws Exception {
-        mongo.getDatabaseNames();
-        return Result.healthy();
-    }
- 
-}

+ 0 - 45
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/Helper.java

@@ -1,45 +0,0 @@
-package com.example.helloworld.resources;
-
-import java.util.concurrent.ThreadLocalRandom;
-
-import com.google.common.base.Optional;
-
-/**
- * Provides utility methods for the benchmark tests.
- * Taken from undertow-edge project.
- */
-final class Helper {
-  private Helper() {
-    throw new AssertionError();
-  }
-
-  /**
-   * Returns the value of the "queries" request parameter, which is an integer
-   * bound between 1 and 500 with a default value of 1.
-   *
-   * @param exchange the current HTTP exchange
-   * @return the value of the "queries" request parameter
-   */
-  static int getQueries(Optional<String> queries) {
-    String value = queries.orNull();
-    if (value == null) {
-      return 1;
-    }
-    try {
-      int parsedValue = Integer.parseInt(value);
-      return Math.min(500, Math.max(1, parsedValue));
-    } catch (NumberFormatException e) {
-      return 1;
-    }
-  }
-
-  /**
-   * Returns a random integer that is a suitable value for both the {@code id}
-   * and {@code randomNumber} properties of a world object.
-   *
-   * @return a random world number
-   */
-  static int randomWorld() {
-    return 1 + ThreadLocalRandom.current().nextInt(10000);
-  }
-}

+ 0 - 30
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/JsonResource.java

@@ -1,30 +0,0 @@
-
-package com.example.helloworld.resources;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-@Path("/json")
-@Produces(MediaType.APPLICATION_JSON)
-public class JsonResource
-{
-  // Response message class (copied from 'servlet' test)
-  public final static class HelloMessage {
-    public final String message;
-
-    public HelloMessage(String m) { message = m; }
-  }
-
-  public JsonResource() { }
-
-  @GET
-  public HelloMessage sayHello()
-  {
-    return new HelloMessage("Hello, World!");
-  }
-}

+ 0 - 66
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/WorldResource.java

@@ -1,66 +0,0 @@
-package com.example.helloworld.resources;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-
-import org.mongojack.DBCursor;
-import org.mongojack.JacksonDBCollection;
-
-import com.example.helloworld.core.World;
-import com.google.common.base.Optional;
-import com.google.common.primitives.Ints;
-import com.mongodb.BasicDBObject;
-import com.mongodb.DBObject;
-
-@Path("/db")
-@Produces(MediaType.APPLICATION_JSON)
-public class WorldResource
-{
-
-  private JacksonDBCollection<World, String> collection;
- 
-  public WorldResource(JacksonDBCollection<World, String> collection)
-  {
-    this.collection = collection;
-  }
-
-  @GET
-  public Object dbTest(@QueryParam("queries") Optional<String> queries)
-  {
-    if (!queries.isPresent()) 
-    {
-      DBObject query = new BasicDBObject();
-      query.put("_id", Helper.randomWorld());
-      DBCursor<World> dbCursor = collection.find(query);
-      return (dbCursor.hasNext()) ? dbCursor.next() : null;
-    }
-    Integer totalQueries = Ints.tryParse(queries.orNull());
-    if (totalQueries != null) 
-    {
-      if (totalQueries > 500) 
-      {
-        totalQueries = 500;
-      }
-      else if (totalQueries < 1) 
-      {
-        totalQueries = 1;
-      }
-    } 
-    else 
-    {
-      totalQueries = 1;
-    }
-    final World[] worlds = new World[totalQueries];
-    for (int i = 0; i < totalQueries; i++)
-    {
-      DBObject query = new BasicDBObject();
-      query.put("_id", Helper.randomWorld());
-      DBCursor<World> dbCursor = collection.find(query);
-      worlds[i] = (dbCursor.hasNext()) ? dbCursor.next() : null;
-    }
-    return worlds;
-  }
-}

+ 24 - 3
frameworks/Java/dropwizard/benchmark_config.json

@@ -9,7 +9,7 @@
       "fortune_url": "/fortunes",
       "update_url": "/db/update?queries=",
       "plaintext_url": "/plaintext",
-      "port": 9000,
+      "port": 9090,
       "approach": "Realistic",
       "classification": "Fullstack",
       "database": "MySQL",
@@ -21,8 +21,29 @@
       "os": "Linux",
       "database_os": "Linux",
       "display_name": "dropwizard",
-      "notes": "",
+      "notes": "dropwizard with mysql using hibernate",
+      "versus": ""
+    },
+    "mongodb": {
+      "setup_file": "setup",
+      "db_url": "/mongo/db",
+      "query_url": "/mongo/db?queries=",
+      "fortune_url": "/mongo/fortunes",
+      "update_url": "/mongo/db/update?queries=",
+      "port": 9090,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "MongoDB",
+      "framework": "dropwizard",
+      "language": "Java",
+      "orm": "Full",
+      "platform": "Jetty",
+      "webserver": "Jetty",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "dropwizard-mongodb",
+      "notes": "dropwizard with mongodb using mongojack",
       "versus": ""
     }
   }]
-}
+}

+ 10 - 2
frameworks/Java/dropwizard/hello-world.yml

@@ -3,7 +3,7 @@ server:
   applicationContextPath: /
   connector:
     type: http
-    port: 9000
+    port: 9090
     useServerHeader: true
 
   requestLog:
@@ -23,7 +23,7 @@ database:
   password: benchmarkdbpass
 
   # the JDBC URL
-  url: jdbc:mysql://localhost: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
+  url: jdbc:mysql://127.0.0.1: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
 
   # any properties specific to your JDBC driver:
   properties:
@@ -40,3 +40,11 @@ database:
 
   # whether or not idle connections should be validated
   checkConnectionWhileIdle: false
+
+  properties:
+    hibernate.dialect: org.hibernate.dialect.MySQLDialect
+
+mongo:
+  host: 127.0.0.1
+  port: 27017
+  db: hello_world

+ 8 - 2
frameworks/Java/dropwizard/pom.xml

@@ -9,8 +9,9 @@
     <properties>
         <jdk.version>1.7</jdk.version>
 
-        <dropwizard.version>0.7.0</dropwizard.version>
-        <mysql-connector-java.version>5.1.30</mysql-connector-java.version>
+        <dropwizard.version>0.7.1</dropwizard.version>
+        <mysql-connector-java.version>5.1.35</mysql-connector-java.version>
+        <mongojack.version>2.1.0</mongojack.version>
     </properties>
 
     <dependencies>
@@ -34,6 +35,11 @@
             <artifactId>mysql-connector-java</artifactId>
             <version>${mysql-connector-java.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.mongojack</groupId>
+            <artifactId>mongojack</artifactId>
+            <version>${mongojack.version}</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 11 - 3
frameworks/Java/dropwizard/source_code

@@ -1,12 +1,17 @@
 ./dropwizard/src/main/java/com/example/helloworld/
 ./dropwizard/src/main/java/com/example/helloworld/config
-./dropwizard/src/main/java/com/example/helloworld/config/HelloWorldConfiguration
+./dropwizard/src/main/java/com/example/helloworld/config/HelloWorldConfiguration.java
+./dropwizard-mongodb/src/main/java/com/example/helloworld/config/MongoConfiguration.java
 ./dropwizard/src/main/java/com/example/helloworld/db
 ./dropwizard/src/main/java/com/example/helloworld/db/model
-./dropwizard/src/main/java/com/example/helloworld/db/model/Fortune
-./dropwizard/src/main/java/com/example/helloworld/db/model/World
+./dropwizard/src/main/java/com/example/helloworld/db/model/Fortune.java
+./dropwizard/src/main/java/com/example/helloworld/db/model/World.java
 ./dropwizard/src/main/java/com/example/helloworld/db/FortuneDAO.java
 ./dropwizard/src/main/java/com/example/helloworld/db/WorldDAO.java
+./dropwizard/src/main/java/com/example/helloworld/db/mongo
+./dropwizard/src/main/java/com/example/helloworld/db/mongo/MongoManaged.java
+./dropwizard/src/main/java/com/example/helloworld/db/mongo/MongoWorldDAO.java
+./dropwizard/src/main/java/com/example/helloworld/db/mongo/MongoFortuneDAO.java
 ./dropwizard/src/main/java/com/example/helloworld/resources
 ./dropwizard/src/main/java/com/example/helloworld/resources/api
 ./dropwizard/src/main/java/com/example/helloworld/resources/api/HelloMessage
@@ -16,5 +21,8 @@
 ./dropwizard/src/main/java/com/example/helloworld/resources/JsonResource.java
 ./dropwizard/src/main/java/com/example/helloworld/resources/TextResource.java
 ./dropwizard/src/main/java/com/example/helloworld/resources/WorldResource.java
+./dropwizard/src/main/java/com/example/helloworld/resources/MongoFortuneResource.java
+./dropwizard/src/main/java/com/example/helloworld/resources/MongoWorldResource.java
+./dropwizard/src/main/java/com/example/helloworld/resources/Helper.java
 ./dropwizard/src/main/java/com/example/helloworld/HelloWorldService.java
 ./dropwizard/src/main/resources/fortunes.mustache

+ 37 - 6
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/HelloWorldService.java

@@ -1,20 +1,27 @@
 package com.example.helloworld;
 
 import com.example.helloworld.config.HelloWorldConfiguration;
+import com.example.helloworld.config.MongoConfiguration;
 import com.example.helloworld.db.FortuneDAO;
+import com.example.helloworld.db.MongoManaged;
+import com.example.helloworld.db.WorldDAO;
 import com.example.helloworld.db.model.Fortune;
 import com.example.helloworld.db.model.World;
-import com.example.helloworld.db.WorldDAO;
-import com.example.helloworld.resources.FortuneResource;
-import com.example.helloworld.resources.JsonResource;
-import com.example.helloworld.resources.TextResource;
-import com.example.helloworld.resources.WorldResource;
+import com.example.helloworld.resources.*;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.mongodb.DB;
+import com.mongodb.MongoClient;
 import io.dropwizard.Application;
 import io.dropwizard.db.DataSourceFactory;
 import io.dropwizard.hibernate.HibernateBundle;
+import io.dropwizard.jackson.Jackson;
 import io.dropwizard.setup.Bootstrap;
 import io.dropwizard.setup.Environment;
 import io.dropwizard.views.ViewBundle;
+import org.mongojack.JacksonDBCollection;
+import org.mongojack.internal.MongoJackModule;
+
+import java.net.UnknownHostException;
 
 public class HelloWorldService extends Application<HelloWorldConfiguration> {
 
@@ -36,10 +43,34 @@ public class HelloWorldService extends Application<HelloWorldConfiguration> {
     }
 
     @Override
-    public void run(HelloWorldConfiguration config, Environment environment) {
+    public void run(HelloWorldConfiguration config, Environment environment) throws UnknownHostException {
         environment.jersey().register(new JsonResource()); // Test type 1: JSON serialization
         environment.jersey().register(new WorldResource(new WorldDAO(hibernate.getSessionFactory()))); // Test types 2, 3 & 5: Single database query, Multiple database queries & Database updates
         environment.jersey().register(new FortuneResource(new FortuneDAO(hibernate.getSessionFactory()))); // Test type 4: Fortunes
         environment.jersey().register(new TextResource()); // Test type 6: Plaintext
+
+        setUpMongo(config.getMongo(), environment);
+    }
+
+    private void setUpMongo(MongoConfiguration config, Environment environment) throws UnknownHostException {
+        final MongoClient mongoClient = new MongoClient(config.getHost(), config.getPort());
+        environment.lifecycle().manage(new MongoManaged(mongoClient));
+
+        final DB db = mongoClient.getDB(config.getDb());
+        final ObjectMapper mongoJackMapper = MongoJackModule.configure(Jackson.newObjectMapper());
+        final JacksonDBCollection<World, Long> worlds = JacksonDBCollection.wrap(
+                db.getCollection("World"),
+                World.class,
+                Long.class,
+                mongoJackMapper);
+
+        final JacksonDBCollection<Fortune, Long> fortunes = JacksonDBCollection.wrap(
+                db.getCollection("Fortune"),
+                Fortune.class,
+                Long.class,
+                mongoJackMapper);
+
+        environment.jersey().register(new MongoWorldResource(worlds));
+        environment.jersey().register(new MongoFortuneResource(fortunes));
     }
 }

+ 9 - 0
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/config/HelloWorldConfiguration.java

@@ -14,7 +14,16 @@ public class HelloWorldConfiguration extends Configuration {
     @JsonProperty
     private DataSourceFactory database = new DataSourceFactory();
 
+    @Valid
+    @NotNull
+    @JsonProperty
+    private MongoConfiguration mongo = new MongoConfiguration();
+
     public DataSourceFactory getDatabaseConfiguration() {
         return database;
     }
+
+    public MongoConfiguration getMongo() {
+        return mongo;
+    }
 }

+ 34 - 0
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/config/MongoConfiguration.java

@@ -0,0 +1,34 @@
+package com.example.helloworld.config;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.hibernate.validator.constraints.NotEmpty;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+public class MongoConfiguration {
+    @JsonProperty
+    @NotEmpty
+    private String host;
+
+    @JsonProperty
+    @Min(1)
+    @Max(65535)
+    private int port;
+
+    @JsonProperty
+    @NotEmpty
+    private String db;
+
+    public String getHost() {
+        return host;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public String getDb() {
+        return db;
+    }
+}

+ 5 - 5
frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoManaged.java → frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/MongoManaged.java

@@ -1,13 +1,13 @@
 package com.example.helloworld.db;
 
-import com.mongodb.Mongo;
-import com.yammer.dropwizard.lifecycle.Managed;
- 
+import com.mongodb.MongoClient;
+import io.dropwizard.lifecycle.Managed;
+
 public class MongoManaged implements Managed {
  
-    private Mongo mongo;
+    private MongoClient mongo;
  
-    public MongoManaged(Mongo mongo) {
+    public MongoManaged(MongoClient mongo) {
         this.mongo = mongo;
     }
  

+ 4 - 1
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/model/Fortune.java

@@ -1,5 +1,7 @@
 package com.example.helloworld.db.model;
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+
 import javax.persistence.*;
 
 @Entity
@@ -7,9 +9,10 @@ import javax.persistence.*;
 public class Fortune implements Comparable<Fortune> {
 
     @Id
-    @GeneratedValue(strategy = GenerationType.AUTO)
+    @JsonProperty
     private long id;
 
+    @JsonProperty
     @Column(name = "message", nullable = false)
     private String message;
 

+ 10 - 3
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/db/model/World.java

@@ -1,19 +1,26 @@
 package com.example.helloworld.db.model;
 
-import javax.persistence.*;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
 
 @Entity
 @Table(name = "World")
 public class World {
 
     @Id
-    @GeneratedValue(strategy = GenerationType.AUTO)
+    @JsonProperty
     private long id;
 
+    @JsonProperty
     @Column(name = "randomNumber", nullable = false)
     private long randomNumber;
 
-    public World() {}
+    public World() {
+    }
 
     public long getId() {
         return id;

+ 37 - 0
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/MongoFortuneResource.java

@@ -0,0 +1,37 @@
+package com.example.helloworld.resources;
+
+import com.example.helloworld.db.model.Fortune;
+import com.example.helloworld.resources.views.FortuneView;
+import com.google.common.collect.Lists;
+import org.mongojack.DBProjection;
+import org.mongojack.DBQuery;
+import org.mongojack.JacksonDBCollection;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import java.util.Collections;
+import java.util.List;
+
+@Path("/mongo/fortunes")
+@Produces(MediaType.TEXT_HTML + ";charset=UTF-8")
+public class MongoFortuneResource {
+
+    private final JacksonDBCollection<Fortune, Long> fortuneCollection;
+
+    public MongoFortuneResource(JacksonDBCollection<Fortune, Long> fortuneCollection) {
+        this.fortuneCollection = fortuneCollection;
+    }
+
+    @GET
+    public FortuneView dbTest() {
+        final List<Fortune> fortunes = Lists.newArrayListWithExpectedSize(32);
+
+        fortunes.addAll(fortuneCollection.find(DBQuery.empty(), DBProjection.include("_id", "message")).toArray());
+        fortunes.add(new Fortune("Additional fortune added at request time."));
+
+        Collections.sort(fortunes);
+        return new FortuneView(fortunes);
+    }
+}

+ 65 - 0
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/MongoWorldResource.java

@@ -0,0 +1,65 @@
+package com.example.helloworld.resources;
+
+import com.example.helloworld.db.model.World;
+import com.google.common.base.Optional;
+import org.mongojack.DBProjection;
+import org.mongojack.DBQuery;
+import org.mongojack.DBUpdate;
+import org.mongojack.JacksonDBCollection;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import static com.example.helloworld.resources.Helper.getQueries;
+
+@Path("/mongo/db")
+@Produces(MediaType.APPLICATION_JSON)
+public class MongoWorldResource {
+    private final JacksonDBCollection<World, Long> worldsCollection;
+
+    public MongoWorldResource(JacksonDBCollection<World, Long> worldsCollection) {
+        this.worldsCollection = worldsCollection;
+    }
+
+    @GET
+    public Object dbTest(@QueryParam("queries") Optional<String> queries) {
+        int totalQueries = getQueries(queries);
+        final World[] worlds = new World[totalQueries];
+
+        for (int i = 0; i < totalQueries; i++) {
+            worlds[i] = worldsCollection.findOneById(
+                    (long) Helper.randomWorld(),
+                    DBProjection.include("_id", "randomNumber")
+            );
+        }
+        if (!queries.isPresent()) {
+            return worlds[0];
+        } else {
+            return worlds;
+        }
+    }
+
+    @GET
+    @Path("/update")
+    public World[] updateTest(@QueryParam("queries") Optional<String> queries) {
+        int totalQueries = getQueries(queries);
+        final World[] worlds = new World[totalQueries];
+
+        for (int i = 0; i < totalQueries; i++) {
+            // use findAndModify() similar to nodejs-mongodb-raw
+            worlds[i] = worldsCollection.findAndModify(
+                    DBQuery.is("_id", (long) Helper.randomWorld()),
+                    DBProjection.include("_id", "randomNumber"),
+                    null,
+                    false,
+                    DBUpdate.set("randomNumber", (long) Helper.randomWorld()),
+                    true,
+                    false
+            );
+        }
+        return worlds;
+    }
+}

+ 4 - 8
frameworks/Java/dropwizard/src/main/java/com/example/helloworld/resources/WorldResource.java

@@ -1,5 +1,8 @@
 package com.example.helloworld.resources;
 
+import com.example.helloworld.db.WorldDAO;
+import com.example.helloworld.db.model.World;
+import com.google.common.base.Optional;
 import io.dropwizard.hibernate.UnitOfWork;
 
 import javax.ws.rs.GET;
@@ -8,10 +11,6 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 
-import com.example.helloworld.db.WorldDAO;
-import com.example.helloworld.db.model.World;
-import com.google.common.base.Optional;
-
 @Path("/db")
 @Produces(MediaType.APPLICATION_JSON)
 public class WorldResource {
@@ -24,10 +23,9 @@ public class WorldResource {
     @GET
     @UnitOfWork
     public Object dbTest(@QueryParam("queries") Optional<String> queries) {
-    	int totalQueries = Helper.getQueries(queries);
+        int totalQueries = Helper.getQueries(queries);
         final World[] worlds = new World[totalQueries];
 
-        // TODO: Is parallelising this cheating?
         for (int i = 0; i < totalQueries; i++) {
             final long worldId = Helper.randomWorld();
             worlds[i] = worldDAO.findById(worldId).orNull();
@@ -46,7 +44,6 @@ public class WorldResource {
         int totalQueries = Helper.getQueries(queries);
         final World[] worlds = new World[totalQueries];
 
-        // TODO: Is parallelising this cheating?
         for (int i = 0; i < totalQueries; i++) {
             final long worldId = Helper.randomWorld();
 
@@ -54,7 +51,6 @@ public class WorldResource {
             world.setRandomNumber(Helper.randomWorld());
             worlds[i] = worldDAO.update(world);
         }
-
         return worlds;
     }
 }

+ 1 - 1
frameworks/Java/grizzly-jersey/benchmark_config.json

@@ -4,7 +4,7 @@
     "default": {
       "setup_file": "setup",
       "json_url": "/json",
-      "db_url": "/db",
+      "db_url": "/db?single=true",
       "query_url": "/db?queries=",
       "fortune_url": "/fortunes",
       "port": 8080,

+ 15 - 13
frameworks/Java/grizzly-jersey/src/main/java/hello/DbResource.java

@@ -11,14 +11,12 @@ import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.concurrent.ThreadLocalRandom;
 
-import javax.ws.rs.DefaultValue;
 import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.Context;
 
-import org.hibernate.IdentifierLoadAccess;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 
@@ -35,15 +33,12 @@ public class DbResource {
   
   @GET
   @Produces(APPLICATION_JSON + "; charset=utf-8")
-  public Object db(@QueryParam("queries") String queriesParam)
+  public Object db(@QueryParam("queries") String queryParam, @QueryParam("single") boolean isSingle)
       throws ExecutionException, InterruptedException {
 
-    final int queries = getQueries(queriesParam);
+    final int queries = getQueries(queryParam);
     final World[] worlds = new World[queries];
     final Random random = ThreadLocalRandom.current();
-    final Session session = sessionFactory.openSession();
-    session.setDefaultReadOnly(true);
-    final IdentifierLoadAccess accessor = session.byId(World.class);
 
     Map<Integer, Future<World>> futureWorlds = new ConcurrentHashMap<>();
     for (int i = 0; i < queries; i++) {
@@ -51,7 +46,14 @@ public class DbResource {
         new Callable<World>() {
           @Override
           public World call() throws Exception {
-            return (World) accessor.load(random.nextInt(DB_ROWS) + 1);
+            Session session = sessionFactory.openSession();
+            session.setDefaultReadOnly(true);
+
+            try {
+              return (World) session.byId(World.class).load(random.nextInt(DB_ROWS) + 1);
+            } finally {
+              session.close();
+            }
           }
         }
       ));
@@ -61,16 +63,16 @@ public class DbResource {
       worlds[i] = futureWorlds.get(i).get();
     }
 
-    return queries == 1 ? worlds[0] : worlds;
+    return isSingle ? worlds[0] : worlds;
   }
 
   private int getQueries(String proto) {
     int result = 1;
     try {
-      result = Integer.parseInt(proto);
-    } catch (NumberFormatException e) {
-      e.printStackTrace();
-    }
+      if (proto != null && !proto.trim().isEmpty()) {
+        result = Integer.parseInt(proto);
+      }
+    } catch (NumberFormatException e) {/* by test contract */}
 
     return Math.min(500, Math.max(1, result));
   }

+ 2 - 2
frameworks/Java/jetty/pom.xml

@@ -12,12 +12,12 @@
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-server</artifactId>
-            <version>9.3.0.RC1</version>
+            <version>9.3.0.v20150612</version>
         </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>jetty-util-ajax</artifactId>
-            <version>9.3.0.RC1</version>
+            <version>9.3.0.v20150612</version>
         </dependency>
     </dependencies>
 

+ 1 - 1
frameworks/JavaScript/express/package.json

@@ -9,7 +9,7 @@
     , "errorhandler": "1.3.5"
     , "mongoose": "4.0.1"
     , "async": "0.9.0"
-    , "jade": "1.10.0"
+    , "jade": "1.11.0"
     , "sequelize": "2.0.6"
     , "mysql": "2.6.2"
   }

+ 4 - 4
frameworks/Scala/colossus/build.sbt

@@ -1,14 +1,14 @@
 name := """colossus-example"""
 
-version := "0.1.0"
+version := "0.2.0"
 
-scalaVersion := "2.11.5"
+scalaVersion := "2.11.6"
 
 com.github.retronym.SbtOneJar.oneJarSettings
 
 mainClass in oneJar := Some("example.Main")
 
 libraryDependencies ++= Seq(
-  "com.tumblr" %% "colossus" % "0.6.1",
+  "com.tumblr" %% "colossus" % "0.6.4-RC1",
   "net.liftweb" %% "lift-json" % "2.6-RC1"
-)
+)

+ 88 - 24
frameworks/Scala/colossus/src/main/scala/example/Main.scala

@@ -3,36 +3,100 @@ package example
 import java.util.Date
 import java.text.SimpleDateFormat
 
-import colossus._
-import service._
-import protocols.http._
-import UrlParsing._
-import HttpMethod._
+import akka.actor.{Actor, ActorRef, Props}
+import akka.util.ByteString
+import scala.concurrent.duration._
+import colossus.IOSystem
+import colossus.core.{ServerRef, ServerSettings}
+import colossus.service._
+import colossus.protocols.http._
 
 import net.liftweb.json._
 import JsonDSL._
 
-object Main extends App {
+object BenchmarkService {
 
-  implicit val io_system = IOSystem()
+  class Timestamp(server: ServerRef) extends Actor {
+        
+    val sdf = new SimpleDateFormat("EEE, MMM d yyyy HH:MM:ss z")
+    case object Tick
+    import context.dispatcher
 
-  Service.become[Http]("sample", 9007) {
-    case request @ Get on Root / "json" => {
-      val json = ("message" -> "Hello, World!")
-      val sdf = new SimpleDateFormat("EEE, MMM d yyyy HH:MM:ss z")
-      val v = request.ok(compact(render(json)))
-        .withHeader("Content-Type", "application/json")
-        .withHeader("Server", "Colossus")
-        .withHeader("Date", sdf.format(new Date()))
-      Callback.successful(v)
+    override def preStart() {
+      self ! Tick
     }
-    case request @ Get on Root / "plaintext" => {
-      val sdf = new SimpleDateFormat("EEE, MMM d yyyy HH:MM:ss z")
-      val res = request.ok("Hello, World!")
-        .withHeader("Content-Type", "text/plain")
-        .withHeader("Server", "Colossus")
-        .withHeader("Date", sdf.format(new Date()))
-      Callback.successful(res)
+
+    def receive = {
+      case Tick => {
+        server.delegatorBroadcast(sdf.format(new Date()))
+        context.system.scheduler.scheduleOnce(1.second, self, Tick)
+      }
+    }
+  }
+  val response          = ByteString("Hello, World!")
+  val plaintextHeader   = ("Content-Type", "text/plain")
+  val jsonHeader        = ("Content-Type", "application/json")
+  val serverHeader      = ("Server", "Colossus")
+
+
+  def start(port: Int)(implicit io: IOSystem) {
+
+    val serverConfig = ServerSettings(
+      port = port,
+      maxConnections = 16384,
+      tcpBacklogSize = Some(1024)
+    )
+    val serviceConfig = ServiceConfig(
+      name = "/sample",
+      requestTimeout = Duration.Inf,
+      requestMetrics = false
+    )
+
+    val server = Service.serve[Http](serverConfig, serviceConfig) { context =>
+
+      ///the ??? is filled in almost immediately by the actor
+      var dateHeader = ("Date", "???")
+
+      context.receive {
+        case ts: String => dateHeader = ("Date", ts)
+      }
+      
+      context.handle { connection =>
+        connection.become{ case request =>
+          if (request.head.url == "/plaintext") {
+            val res = HttpResponse(
+              version  = HttpVersion.`1.1`,
+              code    = HttpCodes.OK,
+              data    = response,
+              headers = Vector(plaintextHeader, serverHeader, dateHeader)
+            )
+            Callback.successful(res)
+          } else if (request.head.url == "/json") {
+            val json = ("message" -> "Hello, World!")
+            val res = HttpResponse(
+              version  = HttpVersion.`1.1`,
+              code    = HttpCodes.OK,
+              data    = compact(render(json)),
+              headers = Vector(jsonHeader, serverHeader, dateHeader)
+            )
+            Callback.successful(res)
+          } else {
+            Callback.successful(request.notFound("invalid path"))
+          }
+        }
+      }
     }
+
+    val timestamp = io.actorSystem.actorOf(Props(classOf[Timestamp], server))
   }
-}
+
+}
+
+
+object Main extends App {
+
+  implicit val io_system = IOSystem()
+
+  BenchmarkService.start(9007)
+
+}

+ 8 - 0
frameworks/Scala/finch/.gitignore

@@ -0,0 +1,8 @@
+target/
+project/target
+bin/
+logs/
+.cache
+.classpath
+.project
+/bin/

+ 30 - 0
frameworks/Scala/finch/README.md

@@ -0,0 +1,30 @@
+#finch Benchmarking Test
+
+### JSON Encoding Test
+
+* [JSON test source](src/main/scala/example/Main.scala)
+
+### Plaintext Test
+
+* [JSON test source](src/main/scala/example/Main.scala)
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [Java Oracle 1.8.0_25](http://www.oracle.com/technetwork/java/javase)
+* [finch 0.7.0](https://github.com/finagle/finch)
+
+## Test URLs
+### JSON Encoding Test
+
+http://localhost:9000/json
+
+### Plaintext Test
+
+http://localhost:9000/plaintext
+
+## How to run
+sbt 'oneJar'
+
+`java -jar target/scala-2.11/*finch*one-jar.jar`
+

+ 23 - 0
frameworks/Scala/finch/benchmark_config.json

@@ -0,0 +1,23 @@
+{
+  "framework": "finch",
+  "tests": [{
+    "default": {
+      "orm": "Raw",
+      "database_os": "Linux",
+      "setup_file": "setup",
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 9000,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "database": "None",
+      "framework": "finch",
+      "language": "Scala",
+      "platform": "Netty",
+      "webserver": "None",
+      "os": "Linux",
+      "display_name": "finch",
+      "notes": ""
+    }
+  }]
+}

+ 16 - 0
frameworks/Scala/finch/build.sbt

@@ -0,0 +1,16 @@
+name := """techempower-benchmarks-finch"""
+
+version := "0.0.1-SNAPSHOT"
+
+scalaVersion := "2.11.6"
+
+com.github.retronym.SbtOneJar.oneJarSettings
+
+mainClass in (Compile, run) := Some("WebServer")
+
+libraryDependencies ++= Seq(
+  "com.github.finagle" %% "finch-core" % "0.7.0",
+  "com.github.finagle" %% "finch-argonaut" % "0.7.0"
+)
+
+resolvers += Resolver.sonatypeRepo("snapshots")

+ 3 - 0
frameworks/Scala/finch/install.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+fw_depends java8 sbt

+ 4 - 0
frameworks/Scala/finch/project/build.properties

@@ -0,0 +1,4 @@
+#Activator-generated Properties
+#Wed Feb 25 16:26:13 CET 2015
+template.uuid=6a24da4f-6985-4cd1-a841-205d69ced830
+sbt.version=0.13.7

+ 1 - 0
frameworks/Scala/finch/project/plugins.sbt

@@ -0,0 +1 @@
+addSbtPlugin("org.scala-sbt.plugins" % "sbt-onejar" % "0.8")

+ 8 - 0
frameworks/Scala/finch/setup.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+source $IROOT/java8.installed
+export SBT_HOME=${IROOT}/sbt
+
+${SBT_HOME}/bin/sbt 'oneJar'
+
+java -jar target/scala-2.11/*finch*one-jar.jar

+ 34 - 0
frameworks/Scala/finch/src/main/scala/WebServer.scala

@@ -0,0 +1,34 @@
+import java.net.InetSocketAddress
+
+import argonaut._, Argonaut._
+
+import io.finch._
+import io.finch.{Endpoint => _, _}
+
+import io.finch.route._
+import io.finch.route.Endpoint
+import io.finch.response._
+
+import com.twitter.finagle.Service
+import com.twitter.finagle.Httpx
+
+import com.twitter.util.Await
+
+object WebServer extends App {
+
+  val json: Endpoint[HttpRequest, HttpResponse] = {
+    import io.finch.argonaut._
+    Get / "json" /> Ok(Json("message" -> jString("Hello, World!"))).toFuture
+  }
+
+  val plaintext: Endpoint[HttpRequest, HttpResponse] =
+    Get / "plaintext" /> Ok("Hello, World!").toFuture
+
+  val api: Service[HttpRequest, HttpResponse] = plaintext | json
+
+  Await.ready(
+    Httpx.serve(
+      "0.0.0.0:9000", api
+    )
+  )
+}

+ 0 - 1
source_code

@@ -1 +0,0 @@
-./src/main.rs

+ 4 - 3
toolset/setup/linux/languages/java8.sh

@@ -17,7 +17,7 @@ sudo update-alternatives --set java $J7_HOME/jre/bin/java
 sudo update-alternatives --set javac $J7_HOME/bin/javac
 
 # try to make sure all JDK binaries default to OpenJDK 7, not Java 8
-update-alternatives --get-selections | grep java-8 | sed -e "s/java-8-oracle/$J7_HOME/" | while read line
+update-alternatives --get-selections | grep java-8 | sed -e "s|java-8-oracle|$J7_HOME|" | while read line
 do
   l=(${line// / })
   n=${l[0]}
@@ -28,5 +28,6 @@ do
 done
 
 # Setup environment variables
-echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" > $IROOT/java8.installed
-echo "export PATH=$JAVA_HOME/bin:$PATH" >> $IROOT/java8.installed
+JAVA_HOME=/usr/lib/jvm/java-8-oracle
+echo "export JAVA_HOME=${JAVA_HOME}" > $IROOT/java8.installed
+echo "export PATH=${JAVA_HOME}/bin:$PATH" >> $IROOT/java8.installed