Browse Source

Merge remote-tracking branch 'upstream/master'

MTD 10 years ago
parent
commit
04e4e32f82
100 changed files with 1146 additions and 725 deletions
  1. 17 2
      .travis.yml
  2. 28 11
      frameworks/C++/ULib/benchmark_config.json
  3. 12 12
      frameworks/C++/ULib/install.sh
  4. 0 13
      frameworks/C++/ULib/setup.sh
  5. 12 0
      frameworks/C++/ULib/setup_json.sh
  6. 7 9
      frameworks/C++/ULib/setup_mysql.sh
  7. 12 0
      frameworks/C++/ULib/setup_plaintext.sh
  8. 10 6
      frameworks/C++/ULib/setup_postgres.sh
  9. 9 11
      frameworks/C++/ULib/setup_sqlite.sh
  10. 15 13
      frameworks/C++/ULib/src/fortune.usp
  11. 1 1
      frameworks/C++/cpoll_cppsp/install.sh
  12. 1 1
      frameworks/C++/silicon/install.sh
  13. 3 3
      frameworks/C++/silicon/main.cc
  14. 1 1
      frameworks/C++/silicon/setup_epoll_mysql.sh
  15. 1 1
      frameworks/C++/silicon/setup_tpc_mysql.sh
  16. 2 3
      frameworks/C/duda/install.sh
  17. 1 1
      frameworks/C/duda/setup.sh
  18. 1 1
      frameworks/C/haywire/setup.sh
  19. 2 1
      frameworks/Crystal/crystal-raw/benchmark_config.json
  20. 1 1
      frameworks/Crystal/crystal-raw/install.sh
  21. 2 0
      frameworks/Crystal/crystal-raw/setup.sh
  22. 4 0
      frameworks/Crystal/moonshine/.gitignore
  23. 4 0
      frameworks/Crystal/moonshine/Projectfile
  24. 5 0
      frameworks/Crystal/moonshine/README.md
  25. 28 0
      frameworks/Crystal/moonshine/benchmark_config.json
  26. 4 0
      frameworks/Crystal/moonshine/install.sh
  27. 154 0
      frameworks/Crystal/moonshine/server.cr
  28. 5 0
      frameworks/Crystal/moonshine/setup.sh
  29. 7 0
      frameworks/D/vibed/.gitignore
  30. 34 0
      frameworks/D/vibed/README.md
  31. 26 0
      frameworks/D/vibed/benchmark_config.json
  32. 10 0
      frameworks/D/vibed/dub.json
  33. 11 0
      frameworks/D/vibed/dub.selections.json
  34. 3 0
      frameworks/D/vibed/install.sh
  35. 14 0
      frameworks/D/vibed/setup.sh
  36. 102 0
      frameworks/D/vibed/source/app.d
  37. 19 0
      frameworks/D/vibed/views/index.dt
  38. 5 0
      frameworks/Elixir/cowboy/.gitignore
  39. 1 0
      frameworks/Elixir/cowboy/README.md
  40. 24 0
      frameworks/Elixir/cowboy/benchmark_config.json
  41. 7 0
      frameworks/Elixir/cowboy/config/config.exs
  42. 3 0
      frameworks/Elixir/cowboy/install.sh
  43. 56 0
      frameworks/Elixir/cowboy/lib/hello.ex
  44. 20 0
      frameworks/Elixir/cowboy/mix.exs
  45. 13 0
      frameworks/Elixir/cowboy/setup.sh
  46. 3 2
      frameworks/Elixir/phoenix/.gitignore
  47. 7 3
      frameworks/Elixir/phoenix/benchmark_config.json
  48. 4 3
      frameworks/Elixir/phoenix/config/config.exs
  49. 24 4
      frameworks/Elixir/phoenix/config/dev.exs
  50. 12 3
      frameworks/Elixir/phoenix/config/prod.exs
  51. 7 0
      frameworks/Elixir/phoenix/config/prod.secret.exs
  52. 0 7
      frameworks/Elixir/phoenix/config/test.exs
  53. 2 1
      frameworks/Elixir/phoenix/lib/hello.ex
  54. 8 6
      frameworks/Elixir/phoenix/lib/hello/endpoint.ex
  55. 3 0
      frameworks/Elixir/phoenix/lib/hello/repo.ex
  56. 17 10
      frameworks/Elixir/phoenix/mix.exs
  57. 6 6
      frameworks/Elixir/phoenix/setup.sh
  58. 0 7
      frameworks/Elixir/phoenix/test/hello_test.exs
  59. 0 1
      frameworks/Elixir/phoenix/test/test_helper.exs
  60. 26 13
      frameworks/Elixir/phoenix/web/controllers/page_controller.ex
  61. 15 0
      frameworks/Elixir/phoenix/web/models/fortune.ex
  62. 0 11
      frameworks/Elixir/phoenix/web/models/repo.exs
  63. 15 0
      frameworks/Elixir/phoenix/web/models/world.ex
  64. 0 7
      frameworks/Elixir/phoenix/web/models/world.exs
  65. 5 5
      frameworks/Elixir/phoenix/web/router.ex
  66. 1 31
      frameworks/Elixir/phoenix/web/templates/layout/application.html.eex
  67. 0 1
      frameworks/Elixir/phoenix/web/templates/page/error.html.eex
  68. 1 0
      frameworks/Elixir/phoenix/web/templates/page/fortunes.html.eex
  69. 0 34
      frameworks/Elixir/phoenix/web/templates/page/index.html.eex
  70. 0 1
      frameworks/Elixir/phoenix/web/templates/page/not_found.html.eex
  71. 0 17
      frameworks/Elixir/phoenix/web/view.ex
  72. 4 3
      frameworks/Elixir/phoenix/web/views/error_view.ex
  73. 1 1
      frameworks/Elixir/phoenix/web/views/layout_view.ex
  74. 1 1
      frameworks/Elixir/phoenix/web/views/page_view.ex
  75. 73 0
      frameworks/Elixir/phoenix/web/web.ex
  76. 1 1
      frameworks/Erlang/cowboy/install.sh
  77. 2 3
      frameworks/Erlang/cowboy/setup.sh
  78. 1 1
      frameworks/Erlang/elli/install.sh
  79. 2 3
      frameworks/Erlang/elli/setup.sh
  80. 18 6
      frameworks/Go/gin/hello.go
  81. 0 25
      frameworks/Java/dropwizard-mongodb/benchmark_config.json
  82. 0 20
      frameworks/Java/dropwizard-mongodb/hello-world.yml
  83. 0 84
      frameworks/Java/dropwizard-mongodb/pom.xml
  84. 0 8
      frameworks/Java/dropwizard-mongodb/setup.sh
  85. 0 11
      frameworks/Java/dropwizard-mongodb/source_code
  86. 0 27
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldConfiguration.java
  87. 0 47
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/HelloWorldService.java
  88. 0 40
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/core/World.java
  89. 0 21
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/db/MongoHealthCheck.java
  90. 0 45
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/Helper.java
  91. 0 30
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/JsonResource.java
  92. 0 66
      frameworks/Java/dropwizard-mongodb/src/main/java/com/example/helloworld/resources/WorldResource.java
  93. 9 0
      frameworks/Java/dropwizard/README.md
  94. 46 4
      frameworks/Java/dropwizard/benchmark_config.json
  95. 18 0
      frameworks/Java/dropwizard/hello-world-mongo.yml
  96. 3 2
      frameworks/Java/dropwizard/hello-world-mysql.yml
  97. 43 0
      frameworks/Java/dropwizard/hello-world-postgres.yml
  98. 58 9
      frameworks/Java/dropwizard/pom.xml
  99. 10 0
      frameworks/Java/dropwizard/setup_mongo.sh
  100. 3 3
      frameworks/Java/dropwizard/setup_mysql.sh

+ 17 - 2
.travis.yml

@@ -1,3 +1,4 @@
+sudo: required
 language: python
 language: python
 python:
 python:
   - "2.7"
   - "2.7"
@@ -36,11 +37,14 @@ env:
     - "TESTDIR=Clojure/pedestal"
     - "TESTDIR=Clojure/pedestal"
     - "TESTDIR=Clojure/aleph"
     - "TESTDIR=Clojure/aleph"
     - "TESTDIR=Crystal/crystal-raw"
     - "TESTDIR=Crystal/crystal-raw"
+    - "TESTDIR=Crystal/moonshine"
+    - "TESTDIR=D/vibed"
     - "TESTDIR=Dart/dart"
     - "TESTDIR=Dart/dart"
     - "TESTDIR=Dart/dart-redstone"
     - "TESTDIR=Dart/dart-redstone"
     - "TESTDIR=Dart/dart-start"
     - "TESTDIR=Dart/dart-start"
     - "TESTDIR=Dart/dart-stream"
     - "TESTDIR=Dart/dart-stream"
     - "TESTDIR=Elixir/phoenix"
     - "TESTDIR=Elixir/phoenix"
+    - "TESTDIR=Elixir/cowboy"
     - "TESTDIR=Erlang/cowboy"
     - "TESTDIR=Erlang/cowboy"
     - "TESTDIR=Erlang/elli"
     - "TESTDIR=Erlang/elli"
     - "TESTDIR=Go/beego"
     - "TESTDIR=Go/beego"
@@ -60,19 +64,23 @@ env:
     - "TESTDIR=Java/activeweb"
     - "TESTDIR=Java/activeweb"
     - "TESTDIR=Java/curacao"
     - "TESTDIR=Java/curacao"
     - "TESTDIR=Java/dropwizard"
     - "TESTDIR=Java/dropwizard"
-    - "TESTDIR=Java/dropwizard-mongodb"
     - "TESTDIR=Java/gemini"
     - "TESTDIR=Java/gemini"
     - "TESTDIR=Java/grizzly-bm"
     - "TESTDIR=Java/grizzly-bm"
     - "TESTDIR=Java/grizzly-jersey"
     - "TESTDIR=Java/grizzly-jersey"
+    - "TESTDIR=Java/jawn"
     - "TESTDIR=Java/jetty-servlet"
     - "TESTDIR=Java/jetty-servlet"
+    - "TESTDIR=Java/jetty"
+    - "TESTDIR=Java/mangooio"
     - "TESTDIR=Java/netty"
     - "TESTDIR=Java/netty"
     - "TESTDIR=Java/ninja-standalone"
     - "TESTDIR=Java/ninja-standalone"
     - "TESTDIR=Java/play1"
     - "TESTDIR=Java/play1"
     - "TESTDIR=Java/play1siena"
     - "TESTDIR=Java/play1siena"
     - "TESTDIR=Java/play2-java"
     - "TESTDIR=Java/play2-java"
+    - "TESTDIR=Java/rapidoid"
     - "TESTDIR=Java/restexpress"
     - "TESTDIR=Java/restexpress"
     - "TESTDIR=Java/servlet"
     - "TESTDIR=Java/servlet"
     - "TESTDIR=Java/servlet3-cass"
     - "TESTDIR=Java/servlet3-cass"
+    - "TESTDIR=Java/servlet-dsl"
     - "TESTDIR=Java/spark"
     - "TESTDIR=Java/spark"
     - "TESTDIR=Java/sabina"
     - "TESTDIR=Java/sabina"
     - "TESTDIR=Java/spring"
     - "TESTDIR=Java/spring"
@@ -88,6 +96,7 @@ env:
     - "TESTDIR=JavaScript/nodejs"
     - "TESTDIR=JavaScript/nodejs"
     - "TESTDIR=JavaScript/ringojs"
     - "TESTDIR=JavaScript/ringojs"
     - "TESTDIR=JavaScript/ringojs-convenient"
     - "TESTDIR=JavaScript/ringojs-convenient"
+    - "TESTDIR=JavaScript/sailsjs"
     - "TESTDIR=Lua/lapis"
     - "TESTDIR=Lua/lapis"
     - "TESTDIR=Lua/openresty"
     - "TESTDIR=Lua/openresty"
     - "TESTDIR=Nim/jester"
     - "TESTDIR=Nim/jester"
@@ -102,12 +111,14 @@ env:
     - "TESTDIR=PHP/php"
     - "TESTDIR=PHP/php"
     - "TESTDIR=PHP/cygnite-php-framework"
     - "TESTDIR=PHP/cygnite-php-framework"
     - "TESTDIR=PHP/codeigniter"
     - "TESTDIR=PHP/codeigniter"
+    - "TESTDIR=PHP/clancats"
     - "TESTDIR=PHP/php-fatfree"
     - "TESTDIR=PHP/php-fatfree"
     - "TESTDIR=PHP/fuel"
     - "TESTDIR=PHP/fuel"
     - "TESTDIR=PHP/kohana"
     - "TESTDIR=PHP/kohana"
     - "TESTDIR=PHP/php-laravel"
     - "TESTDIR=PHP/php-laravel"
     - "TESTDIR=PHP/limonade"
     - "TESTDIR=PHP/limonade"
     - "TESTDIR=PHP/lithium"
     - "TESTDIR=PHP/lithium"
+    - "TESTDIR=PHP/lumen"
     - "TESTDIR=PHP/php-micromvc"
     - "TESTDIR=PHP/php-micromvc"
     - "TESTDIR=PHP/php-phalcon"
     - "TESTDIR=PHP/php-phalcon"
     - "TESTDIR=PHP/php-phalcon-micro"
     - "TESTDIR=PHP/php-phalcon-micro"
@@ -123,7 +134,7 @@ env:
     - "TESTDIR=PHP/php-zend-framework"
     - "TESTDIR=PHP/php-zend-framework"
     - "TESTDIR=PHP/php-zend-framework1"
     - "TESTDIR=PHP/php-zend-framework1"
     - "TESTDIR=PHP/phreeze"
     - "TESTDIR=PHP/phreeze"
-    - "TESTDIR=Python/API-Hour"
+    - "TESTDIR=Python/AsyncIO"
     - "TESTDIR=Python/bottle"
     - "TESTDIR=Python/bottle"
     - "TESTDIR=Python/cherrypy"
     - "TESTDIR=Python/cherrypy"
     - "TESTDIR=Python/django"
     - "TESTDIR=Python/django"
@@ -146,6 +157,9 @@ env:
     - "TESTDIR=Ruby/rails"
     - "TESTDIR=Ruby/rails"
     - "TESTDIR=Ruby/rails-stripped"
     - "TESTDIR=Ruby/rails-stripped"
     - "TESTDIR=Ruby/sinatra"
     - "TESTDIR=Ruby/sinatra"
+    - "TESTDIR=Rust/iron"
+    - "TESTDIR=Rust/nickel"
+    - "TESTDIR=Rust/hyper"
     - "TESTDIR=Scala/akka-http"
     - "TESTDIR=Scala/akka-http"
     - "TESTDIR=Scala/colossus"
     - "TESTDIR=Scala/colossus"
     - "TESTDIR=Scala/finagle"
     - "TESTDIR=Scala/finagle"
@@ -158,6 +172,7 @@ env:
     - "TESTDIR=Scala/spray-es"
     - "TESTDIR=Scala/spray-es"
     - "TESTDIR=Scala/unfiltered"
     - "TESTDIR=Scala/unfiltered"
     - "TESTDIR=Scala/http4s"
     - "TESTDIR=Scala/http4s"
+    - "TESTDIR=Scala/finch"
     - "TESTDIR=Ur/urweb"
     - "TESTDIR=Ur/urweb"
 
 
 before_install:
 before_install:

+ 28 - 11
frameworks/C++/ULib/benchmark_config.json

@@ -2,8 +2,7 @@
   "framework": "ULib",
   "framework": "ULib",
   "tests": [{
   "tests": [{
     "default": {
     "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
+      "setup_file": "setup_plaintext",
       "plaintext_url": "/plaintext",
       "plaintext_url": "/plaintext",
       "port": 8080,
       "port": 8080,
       "approach": "Realistic",
       "approach": "Realistic",
@@ -20,6 +19,24 @@
       "notes": "",
       "notes": "",
       "versus": ""
       "versus": ""
     },
     },
+    "json": {
+      "setup_file": "setup_json",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "userver_tcp",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib",
+      "notes": "",
+      "versus": ""
+    },
     "mysql": {
     "mysql": {
       "setup_file": "setup_mysql",
       "setup_file": "setup_mysql",
       "db_url": "/db",
       "db_url": "/db",
@@ -41,15 +58,16 @@
       "notes": "",
       "notes": "",
       "versus": ""
       "versus": ""
     },
     },
-    "sqlite": {
-      "setup_file": "setup_sqlite",
+    "postgres": {
+      "setup_file": "setup_postgres",
       "db_url": "/db",
       "db_url": "/db",
       "query_url": "/query?queries=",
       "query_url": "/query?queries=",
       "fortune_url": "/fortune",
       "fortune_url": "/fortune",
+      "update_url": "/update?queries=",
       "port": 8080,
       "port": 8080,
       "approach": "Realistic",
       "approach": "Realistic",
       "classification": "Platform",
       "classification": "Platform",
-      "database": "SQLite",
+      "database": "Postgres",
       "framework": "ULib",
       "framework": "ULib",
       "language": "C++",
       "language": "C++",
       "orm": "Micro",
       "orm": "Micro",
@@ -57,20 +75,19 @@
       "webserver": "userver_tcp",
       "webserver": "userver_tcp",
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
-      "display_name": "ULib-sqlite",
+      "display_name": "ULib-postgres",
       "notes": "",
       "notes": "",
       "versus": ""
       "versus": ""
     },
     },
-    "postgres": {
-      "setup_file": "setup_postgres",
+    "sqlite": {
+      "setup_file": "setup_sqlite",
       "db_url": "/db",
       "db_url": "/db",
       "query_url": "/query?queries=",
       "query_url": "/query?queries=",
       "fortune_url": "/fortune",
       "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
       "port": 8080,
       "port": 8080,
       "approach": "Realistic",
       "approach": "Realistic",
       "classification": "Platform",
       "classification": "Platform",
-      "database": "Postgres",
+      "database": "SQLite",
       "framework": "ULib",
       "framework": "ULib",
       "language": "C++",
       "language": "C++",
       "orm": "Micro",
       "orm": "Micro",
@@ -78,7 +95,7 @@
       "webserver": "userver_tcp",
       "webserver": "userver_tcp",
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
-      "display_name": "ULib-postgres",
+      "display_name": "ULib-sqlite",
       "notes": "",
       "notes": "",
       "versus": ""
       "versus": ""
     }
     }

+ 12 - 12
frameworks/C++/ULib/install.sh

@@ -1,5 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 
 
+# --------------------------------------------------------------------------------------------------------
 # install.sh
 # install.sh
 # --------------------------------------------------------------------------------------------------------
 # --------------------------------------------------------------------------------------------------------
 # toolset/run-tests.py --install server --test ULib-mysql  --type all --verbose
 # toolset/run-tests.py --install server --test ULib-mysql  --type all --verbose
@@ -18,15 +19,15 @@
 
 
 ULIB_VERSION=1.4.2
 ULIB_VERSION=1.4.2
 ULIB_ROOT=$IROOT/ULib
 ULIB_ROOT=$IROOT/ULib
-ULIB_DOCUMENT_ROOT=${ULIB_ROOT}/ULIB_DOCUMENT_ROOT
+ULIB_DOCUMENT_ROOT=$ULIB_ROOT/ULIB_DOCUMENT_ROOT
 
 
 # Check if ULib is already installed
 # Check if ULib is already installed
-ULIB_INSTALLED_FILE="${IROOT}/ULib-${ULIB_VERSION}.installed"
-RETCODE=$(fw_exists ${ULIB_INSTALLED_FILE})
+ULIB_INSTALLED_FILE="$IROOT/ULib-${ULIB_VERSION}.installed"
+RETCODE=$(fw_exists $ULIB_INSTALLED_FILE)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 
 # Create a run directory for ULIB
 # Create a run directory for ULIB
-[ ! -e ${ULIB_INSTALLED_FILE} -a -d ${IROOT}/ULib ] && rm -rf ${IROOT}/ULib*
+[ ! -e $ULIB_INSTALLED_FILE -a -d $IROOT/ULib ] && rm -rf $IROOT/ULib*
 
 
 if [ ! -d "$ULIB_ROOT" ]; then
 if [ ! -d "$ULIB_ROOT" ]; then
   mkdir -p $ULIB_ROOT
   mkdir -p $ULIB_ROOT
@@ -42,9 +43,8 @@ if [ ! -f "benchmark.cfg" ]; then
 userver {
 userver {
  PORT 8080
  PORT 8080
  PREFORK_CHILD 4
  PREFORK_CHILD 4
- MAX_KEEP_ALIVE 1023
- LISTEN_BACKLOG 16384
- CLIENT_FOR_PARALLELIZATION 256
+ TCP_LINGER_SET -1
+ LISTEN_BACKLOG 256
  ORM_DRIVER "mysql pgsql sqlite"
  ORM_DRIVER "mysql pgsql sqlite"
  DOCUMENT_ROOT $ULIB_DOCUMENT_ROOT
  DOCUMENT_ROOT $ULIB_DOCUMENT_ROOT
 }
 }
@@ -53,7 +53,7 @@ fi
 
 
 # 1. Download ULib
 # 1. Download ULib
 cd $IROOT
 cd $IROOT
-fw_get -O ULib-${ULIB_VERSION}.tar.gz https://github.com/stefanocasazza/ULib/archive/v${ULIB_VERSION}.tar.gz 
+fw_get -o ULib-${ULIB_VERSION}.tar.gz https://github.com/stefanocasazza/ULib/archive/v${ULIB_VERSION}.tar.gz 
 fw_untar  ULib-${ULIB_VERSION}.tar.gz
 fw_untar  ULib-${ULIB_VERSION}.tar.gz
 
 
 # 2. Compile application (userver_tcp)
 # 2. Compile application (userver_tcp)
@@ -67,8 +67,8 @@ gcc_version=`g++ -dumpversion`
 
 
 case "$gcc_version" in
 case "$gcc_version" in
   3*|4.0*|4.1*|4.2*|4.3*|4.4*|4.5*|4.6*|4.7*)
   3*|4.0*|4.1*|4.2*|4.3*|4.4*|4.5*|4.6*|4.7*)
-	  CC='gcc-4.8'
-	 CXX='g++-4.8'
+	  CC='gcc-4.9'
+	 CXX='g++-4.9'
   ;;
   ;;
 esac
 esac
 
 
@@ -88,7 +88,7 @@ USP_FLAGS="-DAS_cpoll_cppsp_DO" \
 #USP_LIBS="-ljson" \
 #USP_LIBS="-ljson" \
 
 
 make install
 make install
-cp -r tests/examples/benchmark/FrameworkBenchmarks/ULib/db ${ULIB_ROOT}
+cp -r tests/examples/benchmark/FrameworkBenchmarks/ULib/db $ULIB_ROOT
 
 
 cd examples/userver
 cd examples/userver
 make install
 make install
@@ -105,4 +105,4 @@ fi
 mkdir -p $ULIB_DOCUMENT_ROOT
 mkdir -p $ULIB_DOCUMENT_ROOT
 cp .libs/db.so .libs/fortune.so .libs/json.so .libs/plaintext.so .libs/query.so .libs/update.so $ULIB_DOCUMENT_ROOT
 cp .libs/db.so .libs/fortune.so .libs/json.so .libs/plaintext.so .libs/query.so .libs/update.so $ULIB_DOCUMENT_ROOT
 
 
-touch ${ULIB_INSTALLED_FILE}
+touch $ULIB_INSTALLED_FILE

+ 0 - 13
frameworks/C++/ULib/setup.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-export ULIB_VERSION=1.4.2
-export ULIB_ROOT=$IROOT/ULib
-export ULIB_DOCUMENT_ROOT=${ULIB_ROOT}/ULIB_DOCUMENT_ROOT
-
-export UMEMPOOL="136,0,0,85,1160,155,-17,-22,40"
-
-# 1. Change ULib Server configuration
-sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g" ${IROOT}/ULib/benchmark.cfg
-
-# 2. Start ULib Server (userver_tcp)
-${IROOT}/ULib/bin/userver_tcp -c ${IROOT}/ULib/benchmark.cfg &

+ 12 - 0
frameworks/C++/ULib/setup_json.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# 1. Change ULib Server (userver_tcp) configuration
+sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g"										$IROOT/ULib/benchmark.cfg
+sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"					  $IROOT/ULib/benchmark.cfg
+sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT/ULib/benchmark.cfg
+
+# 2. Start ULib Server (userver_tcp)
+export UMEMPOOL="56,0,0,40,150,-24,-13,-20,0"
+
+$IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 7 - 9
frameworks/C++/ULib/setup_mysql.sh

@@ -1,16 +1,14 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export ULIB_VERSION=1.4.2
-export ULIB_ROOT=$IROOT/ULib
-export ULIB_DOCUMENT_ROOT=${ULIB_ROOT}/ULIB_DOCUMENT_ROOT
+# 1. Change ULib Server (userver_tcp) configuration
+sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET -2|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"					  $IROOT/ULib/benchmark.cfg
+sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT/ULib/benchmark.cfg
 
 
+# 2. Start ULib Server (userver_tcp)
 export ORM_DRIVER="mysql"
 export ORM_DRIVER="mysql"
+export UMEMPOOL="146,0,0,90,150,-22,-12,-20,0"
 export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=hello_world"
 export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=hello_world"
 
 
-export UMEMPOOL="136,0,0,85,1160,155,-17,-22,40"
-
-# 1. Change ULib Server configuration
-sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g" $IROOT/ULib/benchmark.cfg
-
-# 2. Start ULib Server (userver_tcp)
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 12 - 0
frameworks/C++/ULib/setup_plaintext.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# 1. Change ULib Server (userver_tcp) configuration
+sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g"										$IROOT/ULib/benchmark.cfg
+sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 16384|g"								$IROOT/ULib/benchmark.cfg
+sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"						$IROOT/ULib/benchmark.cfg
+sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 8000|g" $IROOT/ULib/benchmark.cfg
+
+# 2. Start ULib Server (userver_tcp)
+export UMEMPOOL="982,0,0,36,9846,-24,-23,1727,1151"
+
+$IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 10 - 6
frameworks/C++/ULib/setup_postgres.sh

@@ -1,12 +1,16 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export ORM_DRIVER="pgsql"
-export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass dbname=hello_world client_encoding=UTF8"
-
-export UMEMPOOL="136,0,0,85,1160,155,-17,-22,40"
+MAX_THREADS=$((2 * $MAX_THREADS))
 
 
-# 1. Change ULib Server configuration
-sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g" $IROOT/ULib/benchmark.cfg
+# 1. Change ULib Server (userver_tcp) configuration
+sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET -2|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"					  $IROOT/ULib/benchmark.cfg
+sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT/ULib/benchmark.cfg
 
 
 # 2. Start ULib Server (userver_tcp)
 # 2. Start ULib Server (userver_tcp)
+export ORM_DRIVER="pgsql"
+export UMEMPOOL="146,0,0,90,150,-22,-12,-20,0"
+export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass dbname=hello_world client_encoding=UTF8"
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 9 - 11
frameworks/C++/ULib/setup_sqlite.sh

@@ -1,16 +1,14 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export ULIB_VERSION=1.4.2
-export ULIB_ROOT=$IROOT/ULib
-export ULIB_DOCUMENT_ROOT=${ULIB_ROOT}/ULIB_DOCUMENT_ROOT
+# 1. Change ULib Server (userver_tcp) configuration
+sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g"									  $IROOT/ULib/benchmark.cfg
+sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g"								  $IROOT/ULib/benchmark.cfg
+sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g"					  $IROOT/ULib/benchmark.cfg
+sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT/ULib/benchmark.cfg
 
 
+# 2. Start ULib Server (userver_tcp)
 export ORM_DRIVER="sqlite"
 export ORM_DRIVER="sqlite"
-export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=${ULIB_ROOT}/db/%.*s"
-
-export UMEMPOOL="136,0,0,85,1160,155,-17,-22,40"
+export UMEMPOOL="146,0,0,90,150,-22,-12,-20,0"
+export ORM_OPTION="host=${DBHOST} user=benchmarkdbuser password=benchmarkdbpass character-set=utf8 dbname=${IROOT}/ULib/db/%.*s"
 
 
-# 1. Change ULib Server configuration
-sed -i "s|PREFORK_CHILD .*|PREFORK_CHILD ${MAX_THREADS}|g" ${IROOT}/ULib/benchmark.cfg
-
-# 2. Start ULib Server (userver_tcp)
-${IROOT}/ULib/bin/userver_tcp -c ${IROOT}/ULib/benchmark.cfg &
+$IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 15 - 13
frameworks/C++/ULib/src/fortune.usp

@@ -7,6 +7,7 @@ TechEmpower Web Framework Benchmarks
 
 
 static Fortune*           pfortune;
 static Fortune*           pfortune;
 static UString*           pmessage;
 static UString*           pmessage;
+static UString*           pencoded;
 static UOrmSession*       psql_fortune;
 static UOrmSession*       psql_fortune;
 static UOrmStatement*     pstmt_fortune;
 static UOrmStatement*     pstmt_fortune;
 static UVector<Fortune*>* pvfortune;
 static UVector<Fortune*>* pvfortune;
@@ -29,6 +30,7 @@ static void usp_fork_fortune()
 
 
       pstmt_fortune->into(*pfortune);
       pstmt_fortune->into(*pfortune);
 
 
+      pencoded  = U_NEW(UString(100U));
       pmessage  = U_NEW(U_STRING_FROM_CONSTANT("Additional fortune added at request time."));
       pmessage  = U_NEW(U_STRING_FROM_CONSTANT("Additional fortune added at request time."));
       pvfortune = U_NEW(UVector<Fortune*>);
       pvfortune = U_NEW(UVector<Fortune*>);
       }
       }
@@ -40,21 +42,19 @@ static void usp_end_fortune()
    U_TRACE(5, "::usp_end_fortune()")
    U_TRACE(5, "::usp_end_fortune()")
 
 
    if (pstmt_fortune)
    if (pstmt_fortune)
-   {
-   delete pstmt_fortune;
+      {
+      delete pstmt_fortune;
 
 
-   delete psql_fortune;
-   delete pvfortune;
-   delete pfortune;
-   delete pmessage;
-   }
+      delete psql_fortune;
+      delete pvfortune;
+      delete pfortune;
+      delete pmessage;
+      delete pencoded;
+      }
 }
 }
 #endif
 #endif
 -->
 -->
 <!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
 <!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
-Fortune* elem;
-unsigned char encoded[1024];
-
 pstmt_fortune->execute();
 pstmt_fortune->execute();
 
 
      pvfortune->push_back(U_NEW(Fortune(0, *pmessage)));
      pvfortune->push_back(U_NEW(Fortune(0, *pmessage)));
@@ -64,14 +64,16 @@ pvfortune->sort(Fortune::cmp_obj);
 
 
 for (uint32_t i = 0, n = pvfortune->size(); i < n; ++i)
 for (uint32_t i = 0, n = pvfortune->size(); i < n; ++i)
    {
    {
-   elem = (*pvfortune)[i];
+   Fortune* elem = (*pvfortune)[i];
+
+   UXMLEscape::encode(elem->message, *pencoded);
 
 
    USP_PRINTF_ADD(
    USP_PRINTF_ADD(
       "<tr>"
       "<tr>"
       "<td>%u</td>"
       "<td>%u</td>"
-      "<td>%.*s</td>"
+      "<td>%v</td>"
       "</tr>",
       "</tr>",
-      elem->id, u_xml_encode((const unsigned char*)U_STRING_TO_PARAM(elem->message), encoded), encoded);
+      elem->id, pencoded->rep);
    }
    }
 
 
 pvfortune->clear();
 pvfortune->clear();

+ 1 - 1
frameworks/C++/cpoll_cppsp/install.sh

@@ -5,7 +5,7 @@ RETCODE=$(fw_exists ${IROOT}/cppsp.installed)
 
 
 sudo apt-get install -y postgresql-server-dev-9.3 libpq-dev
 sudo apt-get install -y postgresql-server-dev-9.3 libpq-dev
 
 
-fw_get -O cppsp_0.2.3.tar.xz http://downloads.sourceforge.net/project/cpollcppsp/CPPSP%200.2%20%28testing%29/cppsp_0.2.3.tar.xz
+fw_get -o cppsp_0.2.3.tar.xz http://downloads.sourceforge.net/project/cpollcppsp/CPPSP%200.2%20%28testing%29/cppsp_0.2.3.tar.xz
 fw_untar cppsp_0.2.3.tar.xz
 fw_untar cppsp_0.2.3.tar.xz
 
 
 # Using cp+rm over mv intentionally, because apparently this download
 # Using cp+rm over mv intentionally, because apparently this download

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

@@ -9,7 +9,7 @@ CXX=/usr/bin/g++-4.9 ./install.sh $IROOT
 
 
 # Install microhttpd
 # Install microhttpd
 cd $DIR
 cd $DIR
-fw_get http://mirror.ibcp.fr/pub/gnu/libmicrohttpd/libmicrohttpd-0.9.39.tar.gz
+fw_get -O http://mirror.ibcp.fr/pub/gnu/libmicrohttpd/libmicrohttpd-0.9.39.tar.gz
 fw_untar libmicrohttpd-0.9.39.tar.gz
 fw_untar libmicrohttpd-0.9.39.tar.gz
 cd libmicrohttpd-0.9.39
 cd libmicrohttpd-0.9.39
 ./configure --prefix=$IROOT
 ./configure --prefix=$IROOT

+ 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[])
 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;
     return 1;
   }
   }
   
   
@@ -120,7 +120,7 @@ int main(int argc, char* argv[])
     // Start the server.
     // Start the server.
     sl::mhd_json_serve(hello_api, atoi(argv[2])
     sl::mhd_json_serve(hello_api, atoi(argv[2])
 #ifdef TFB_USE_EPOLL
 #ifdef TFB_USE_EPOLL
-                       , _linux_epoll, _nthreads = 1000
+                       , _linux_epoll, _nthreads = atoi(argv[3])
 #else
 #else
                        , _one_thread_per_connection
                        , _one_thread_per_connection
 #endif
 #endif

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

@@ -1,3 +1,3 @@
 #! /bin/bash
 #! /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
 #! /bin/bash
 
 
-$TROOT/build/silicon_tpc_mysql ${DBHOST} 8080 &
+$TROOT/build/silicon_tpc_mysql ${DBHOST} 8080 ${MAX_THREADS} &

+ 2 - 3
frameworks/C/duda/install.sh

@@ -3,10 +3,9 @@
 RETCODE=$(fw_exists ${IROOT}/duda-0.23.installed)
 RETCODE=$(fw_exists ${IROOT}/duda-0.23.installed)
 [ ! "$RETCODE" == 0 ] || { return 0; }
 [ ! "$RETCODE" == 0 ] || { return 0; }
 
 
-fw_get http://duda.io/releases/duda-client/dudac-0.23.tar.gz -O dudac-0.23.tar.gz
-fw_untar dudac-0.23.tar.gz
+git clone https://github.com/monkey/dudac.git
 
 
-cd dudac-0.23
+cd dudac/
 
 
 ./dudac -r
 ./dudac -r
 ./dudac -s
 ./dudac -s

+ 1 - 1
frameworks/C/duda/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export DUDA_HOME=${IROOT}/dudac-0.23
+export DUDA_HOME=${IROOT}/dudac
 export PATH=${DUDA_HOME}:$PATH
 export PATH=${DUDA_HOME}:$PATH
 
 
 dudac -w $TROOT/webservice -p 2001 &
 dudac -w $TROOT/webservice -p 2001 &

+ 1 - 1
frameworks/C/haywire/setup.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
 
 
-$IROOT/Haywire/builds/unix/release/techempower_benchmark &
+$IROOT/Haywire/builds/unix/release/techempower_benchmark 8000 48 &

+ 2 - 1
frameworks/Crystal/crystal-raw/benchmark_config.json

@@ -17,7 +17,8 @@
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
       "display_name": "Crystal",
       "display_name": "Crystal",
-      "notes": ""
+      "notes": "",
+      "versus": "ruby"
     }
     }
   }]
   }]
 }
 }

+ 1 - 1
frameworks/Crystal/crystal-raw/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
 
 
-fw_depends crystal
+fw_depends crystal-0.7.1

+ 2 - 0
frameworks/Crystal/crystal-raw/setup.sh

@@ -1,4 +1,6 @@
 #!/bin/bash
 #!/bin/bash
+source ${IROOT}/crystal-0.7.1.installed
 
 
 crystal build --release server.cr -o server.out
 crystal build --release server.cr -o server.out
+
 ./server.out
 ./server.out

+ 4 - 0
frameworks/Crystal/moonshine/.gitignore

@@ -0,0 +1,4 @@
+.deps
+.deps.lock
+libs/
+.crystal

+ 4 - 0
frameworks/Crystal/moonshine/Projectfile

@@ -0,0 +1,4 @@
+deps do
+  github "dhruvrajvanshi/Moonshine", name: "moonshine"
+  github "stefanwille/crystal-redis"
+end

+ 5 - 0
frameworks/Crystal/moonshine/README.md

@@ -0,0 +1,5 @@
+# Crystal-Moonshine
+
+This is the [Moonshine](https://github.com/dhruvrajvanshi/Moonshine) test of the Framework Benchmarks. Crystal is a new language that closely resembles Ruby with a goal of removing typed variables and parameters (instead inferencing), whilst maintaining top speed through bindings into C.
+
+Moonshine is a minimal web framework for the Crystal language.

+ 28 - 0
frameworks/Crystal/moonshine/benchmark_config.json

@@ -0,0 +1,28 @@
+{
+  "framework": "moonshine",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/redis/db",
+      "query_url": "/redis/queries?queries=",
+      "fortune_url": "/redis/fortunes",
+      "update_url": "/redis/updates?queries=",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "Redis",
+      "framework": "moonshine",
+      "language": "Crystal",
+      "orm": "micro",
+      "platform": "Crystal",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Moonshine",
+      "notes": "",
+      "versus": "ruby"
+    }
+  }]
+}

+ 4 - 0
frameworks/Crystal/moonshine/install.sh

@@ -0,0 +1,4 @@
+#!/bin/bash
+
+fw_depends crystal-0.7.1
+

+ 154 - 0
frameworks/Crystal/moonshine/server.cr

@@ -0,0 +1,154 @@
+require "moonshine"
+require "redis"
+require "html/builder"
+
+include Moonshine
+include Moonshine::Utils::Shortcuts
+include Moonshine::Base
+
+# Compose Objects (like Hash) to have a to_json method
+require "json/to_json"
+
+REDIS = Redis.new
+app = App.new
+
+class CONTENT
+  UTF8 = "; charset=UTF-8"
+  JSON = "application/json" + UTF8
+  PLAIN = "text/plain"
+  HTML = "text/html" + UTF8
+end
+
+ID_MAXIMUM = 10_000
+
+app.response_middleware do |req, res|
+    res.headers["Server"] = "Moonshine"
+    res.headers["Date"] = Time.now.to_s
+    res
+end
+
+private def randomWorld
+  id = rand(1..ID_MAXIMUM)
+  num = REDIS.get("world:" + id.to_s)
+  { :id => id, :randomNumber => num }
+end
+
+private def setWorld(world)
+  id = "world:" + world[:id].to_s
+  REDIS.set(id, world[:randomNumber])
+  world
+end
+
+private def sanitizedQueryCount(request)
+  begin
+    queries = request.get["queries"].to_i
+  rescue
+    queries = 1
+  end
+  queries = 1 if queries < 1
+  queries = 500 if queries > 500
+  queries
+end
+
+#
+# Basic Tests
+#
+
+# Test 1: JSON Serialization
+app.get "/json", do |request|
+  res = ok({ :message => "Hello, World!" }.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+# Test 6: Plaintext
+app.get "/plaintext", do |request|
+  res = ok("Hello, World!")
+  res.headers["Content-type"] = CONTENT::PLAIN
+  res
+end
+
+#
+# Redis DatabaseTests
+#
+
+# Redis Test 2: Single database query
+app.get "/redis/db", do |request|
+  res = ok(randomWorld.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+# Redis Test 3: Multiple database query
+app.get "/redis/queries", do |request|
+  results = (1..sanitizedQueryCount(request)).map do
+    randomWorld
+  end
+
+  res = ok(results.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+# Redis Test 4: Fortunes
+app.get "/redis/fortunes", do |request|
+  data = [] of  Hash(Symbol, (String | Int32))
+
+  REDIS.lrange("fortunes", 0, -1).each_with_index do |e, i|
+    data.push({ :id => i + 1, :message => e.to_s })
+  end
+  
+  additional_fortune = {
+    :id => 0
+    :message => "Additional fortune added at request time."
+  }
+  data.push(additional_fortune)
+
+  data.sort! do |a, b|
+    a[:message].to_s <=> b[:message].to_s
+  end
+
+  # New builder for each request!
+  html = HTML::Builder.new.build do
+    html {
+      head {
+        title { text "Fortunes" }
+      }
+      body {
+        table {
+          tr {
+            thead { text "id" }
+            thead { text "message" }
+          }
+          data.each { |e|
+            tr {
+              td { text e[:id].to_s }
+              td { text e[:message].to_s }
+            }
+          }
+        }
+      }
+    }
+  end
+
+  # Doctype not available in builder
+  # builder only supports `thead`, tests need to see `th`
+  res = ok("<!doctype html>" + html.gsub("thead", "th"))
+  res.headers["Content-type"] = CONTENT::HTML
+  res
+end
+
+# Redis Test 5: Database Updates
+app.get "/redis/updates", do |request|
+  updated = (1..sanitizedQueryCount(request)).map do
+    world = randomWorld
+    world[:randomNumber] = rand(1..ID_MAXIMUM)
+    setWorld(world)
+  end
+
+  res = ok(updated.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+app.run(8080)

+ 5 - 0
frameworks/Crystal/moonshine/setup.sh

@@ -0,0 +1,5 @@
+source ${IROOT}/crystal-0.7.1.installed
+
+crystal deps install
+
+crystal server.cr &

+ 7 - 0
frameworks/D/vibed/.gitignore

@@ -0,0 +1,7 @@
+.dub
+docs.json
+__dummy.html
+*.o
+*.obj
+*.dll
+*.exe

+ 34 - 0
frameworks/D/vibed/README.md

@@ -0,0 +1,34 @@
+# Vibe.D Benchmarking Test
+
+This is the Vibe.D portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+
+* [JSON test controller/view](source/app.d)
+
+### Data-Store/Database Mapping Test
+
+* [DB test controller/model](source/app.d)
+
+## Infrastructure Software Versions
+The tests were run with:
+* [Vibe.D v0.7.19](http://vibed.org/)
+
+## Test URLs
+### JSON Encoding Test
+
+http://localhost:8080/json
+
+### Plaintext Test
+
+http://localhost:8080/plaintext
+
+### Data-Store/Database Mapping Test
+
+MongoRaw:
+http://localhost:8080/db
+
+### Variable Query Test
+
+MongoDB Raw:
+http://localhost:8080/queries?queries=5

+ 26 - 0
frameworks/D/vibed/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "vibed",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/json",
+      "db_url": "/db",
+      "query_url": "/queries?queries=",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MongoDB",
+      "framework": "vibed",
+      "language": "D",
+      "orm": "Raw",
+      "platform": "D",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Vibe.D",
+      "notes": "",
+      "versus": "vibed"
+    }
+  }]
+}

+ 10 - 0
frameworks/D/vibed/dub.json

@@ -0,0 +1,10 @@
+{
+  "name": "fwb",
+  "description": "A simple vibe.d server application.",
+  "copyright": "Copyright © 2015, jin",
+  "authors": ["jin"],
+  "dependencies": {
+    "vibe-d": "~>0.7.19"
+  },
+  "versions": ["VibeDefaultMain"]
+}

+ 11 - 0
frameworks/D/vibed/dub.selections.json

@@ -0,0 +1,11 @@
+{
+  "fileVersion": 1,
+  "versions": {
+    "memutils": "0.3.5",
+    "vibe-d": "0.7.23",
+    "libevent": "2.0.1+2.0.16",
+    "openssl": "1.1.4+1.0.1g",
+    "libev": "5.0.0+4.04",
+    "libasync": "0.7.1"
+  }
+}

+ 3 - 0
frameworks/D/vibed/install.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+fw_depends dlang dub

+ 14 - 0
frameworks/D/vibed/setup.sh

@@ -0,0 +1,14 @@
+#!/bin/bash
+
+source $IROOT/dlang.installed
+source $IROOT/dub.installed
+
+sed -i 's|127.0.0.1|'"${DBHOST}"'|g' source/app.d
+
+# Clean any files from last run
+rm -f fwb
+rm -rf .dub
+
+dub build --force
+
+./fwb &

+ 102 - 0
frameworks/D/vibed/source/app.d

@@ -0,0 +1,102 @@
+import vibe.appmain;
+import vibe.d;
+import std.random;
+
+const worldSize = 10000;
+const fortunesSize = 100;
+const mongoUrl = "mongodb://127.0.0.1/";
+
+MongoClient mongo;
+MongoCollection worldCollection;
+MongoCollection fortunesCollection;
+
+shared static this()
+{
+  mongo = connectMongoDB( mongoUrl );
+  worldCollection = mongo.getCollection( "hello_world.World" );
+  fortunesCollection = mongo.getCollection( "hello_world.Fortunes" );
+
+  auto router = new URLRouter;
+  router.get("/plaintext", &plaintext);
+  router.get("/json", &json);
+  router.get("/db", &db);
+  router.get("/queries", &queries);
+  router.get("/generate-world", &generateWorld);
+  router.get("/generate-fortunes", &generateFortunes);
+  router.get("/", staticTemplate!"index.dt");
+
+  auto settings = new HTTPServerSettings;
+  settings.port = 8080;
+
+  listenHTTP(settings, router);
+}
+
+void json(HTTPServerRequest req, HTTPServerResponse res)
+{
+  auto helloWorld  = Json([
+    "message" : *new Json( "Hello, World!" )
+  ]);
+  res.writeJsonBody( helloWorld );
+}
+
+void generateWorld(HTTPServerRequest req, HTTPServerResponse res)
+{
+  try {
+    worldCollection.drop();
+  } catch( Exception error ) {}
+  for( auto i = 0 ; i < worldSize ; ++i ) {
+    worldCollection.insert([
+      "_id": i + 1,
+      "randomNumber": uniform( 0 , worldSize )
+    ]);
+  }
+  res.writeBody( "Generated" );
+}
+
+void generateFortunes(HTTPServerRequest req, HTTPServerResponse res)
+{
+  try {
+    fortunesCollection.drop();
+  } catch( Exception error ) {}
+  for( uint i = 0 ; i < worldSize ; ++i ) {
+    fortunesCollection.insert([
+      "_id": new Bson( i + 1 ),
+      "message": new Bson( to!string( uniform( 0 , fortunesSize ) ) )
+    ]);
+  }
+  res.writeBody( "Generated" );
+}
+
+void db(HTTPServerRequest req, HTTPServerResponse res)
+{
+  auto data = worldCollection.findOne([
+    "_id": uniform( 1 , worldSize + 1 )
+  ]); 
+  res.writeJsonBody( data );
+}
+
+void queries(HTTPServerRequest req, HTTPServerResponse res)
+{
+  auto count = 1;
+  try {
+    count = to!uint( req.query["queries"] );
+    if( !count ) {
+      count = 1;
+    } else if( count > 500 ) {
+      count = 500;
+    }
+  } catch( Exception error ) { }
+  
+  auto data = new Bson[ count ];
+  for( uint i = 0 ; i < count ; ++i ) {
+    data[i] = worldCollection.findOne([
+      "_id": uniform( 1 , worldSize + 1 )
+    ]);
+  }
+  res.writeJsonBody( data );
+}
+
+void plaintext(HTTPServerRequest req, HTTPServerResponse res)
+{
+  res.writeBody("Hello, World!");
+}

+ 19 - 0
frameworks/D/vibed/views/index.dt

@@ -0,0 +1,19 @@
+doctype html
+html
+  head
+    style a { display: block }
+  body
+    ul
+      li
+        a(href="/generate-world") generate world
+      li
+        a(href="/generate-fortunes") generate fortunes
+    ol
+      li
+        a(href="/json") json stringify
+      li
+        a(href="/db") single query
+      li
+        a(href="/queries?queries=5") multiple queries
+      li
+        a(href="/plaintext") plain text

+ 5 - 0
frameworks/Elixir/cowboy/.gitignore

@@ -0,0 +1,5 @@
+_build/
+rel/
+deps/
+erl_crash.dump
+*.ez

+ 1 - 0
frameworks/Elixir/cowboy/README.md

@@ -0,0 +1 @@
+# Elixir-cowboy

+ 24 - 0
frameworks/Elixir/cowboy/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+    "framework": "elixir-cowboy",
+    "tests": [{
+        "default": {
+            "setup_file": "setup",
+            "json_url": "/json",
+            "plaintext_url": "/plaintext",
+            "port": 8080,
+            "approach": "Realistic",
+            "classification": "Platform",
+            "database": "None",
+            "framework": "cowboy",
+            "language": "elixir",
+            "orm": "raw",
+            "platform": "Erlang/OTP",
+            "webserver": "cowboy",
+            "os": "Linux",
+            "database_os": "Linux",
+            "display_name": "elixir-cowboy",
+            "notes": "",
+            "versus": ""
+        }
+    }]
+}

+ 7 - 0
frameworks/Elixir/cowboy/config/config.exs

@@ -0,0 +1,7 @@
+use Mix.Config
+
+config :mysql,
+  username: "benchmarkdbuser",
+  password: "benchmarkdbpass",
+  database: "hello_world",
+  hostname: "localhost"

+ 3 - 0
frameworks/Elixir/cowboy/install.sh

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

+ 56 - 0
frameworks/Elixir/cowboy/lib/hello.ex

@@ -0,0 +1,56 @@
+defmodule Hello do
+
+  def start(_type, _args) do
+    dispatch = :cowboy_router.compile([
+
+      { :_,
+        [
+          {"/json", JsonHandler, []},
+          {"/plaintext", PlaintextHandler, []}
+      ]}
+    ])
+    { :ok, _ } = :cowboy.start_http(:http,
+                                    5000,
+                                   [{:port, 8080}],
+                                   [{ :env, [{:dispatch, dispatch}]}]
+                                   )
+  end
+end
+
+defmodule JsonHandler do
+  def init(_type, req, []) do
+    {:ok, req, :no_state}
+  end
+
+  def handle(request, state) do
+    Poison.encode!(%{message: "Hello, World!"})
+    { :ok, reply } = :cowboy_req.reply(200,
+      [{"content-type", "application/json"}],
+      Poison.encode!(%{:message => "Hello, World!"}),
+      request)
+    { :ok, reply, state }
+  end
+
+  def terminate(reason, request, state) do
+    :ok
+  end
+end
+
+defmodule PlaintextHandler do
+  def init(_type, req, []) do
+    {:ok, req, :no_state}
+  end
+
+  def handle(request, state) do
+    Poison.encode!(%{message: "Hello, World!"})
+    { :ok, reply } = :cowboy_req.reply(200,
+      [{"content-type", "text/plain"}],
+      "Hello, World!",
+      request)
+    { :ok, reply, state }
+  end
+
+  def terminate(reason, request, state) do
+    :ok
+  end
+end

+ 20 - 0
frameworks/Elixir/cowboy/mix.exs

@@ -0,0 +1,20 @@
+defmodule Hello.Mixfile do
+  use Mix.Project
+
+  def project do
+    [app: :hello,
+     version: "0.0.1",
+     elixir: "~> 1.0",
+     deps: deps]
+  end
+
+  def application do
+    [mod: {Hello, []},
+     applications: [:cowboy, :ranch, :poison]]
+  end
+
+  defp deps do
+    [{:cowboy, "~> 1.0"},
+     {:poison, "~> 1.4.0"}]
+  end
+end

+ 13 - 0
frameworks/Elixir/cowboy/setup.sh

@@ -0,0 +1,13 @@
+#!/bin/bash
+
+source $IROOT/elixir.installed
+
+rm -rf _build deps rel
+
+MIX_ENV=prod
+export MIX_ENV
+mix local.hex --force
+mix deps.get --force
+mix compile --force
+
+elixir --detached --no-halt -S mix

+ 3 - 2
frameworks/Elixir/phoenix/.gitignore

@@ -1,4 +1,5 @@
-/_build
-/deps
+_build/
+rel/
+deps/
 erl_crash.dump
 erl_crash.dump
 *.ez
 *.ez

+ 7 - 3
frameworks/Elixir/phoenix/benchmark_config.json

@@ -4,19 +4,23 @@
         "default": {
         "default": {
             "setup_file": "setup",
             "setup_file": "setup",
             "json_url": "/json",
             "json_url": "/json",
+            "db_url": "/db",
+            "query_url": "/queries?queries=",
+            "fortune_url": "/fortune",
+            "update_url": "/update?queries=",
             "plaintext_url": "/plaintext",
             "plaintext_url": "/plaintext",
             "port": 8080,
             "port": 8080,
             "approach": "Realistic",
             "approach": "Realistic",
-            "classification": "Framework",
+            "classification": "Micro",
             "database": "Postgres",
             "database": "Postgres",
             "framework": "Phoenix",
             "framework": "Phoenix",
             "language": "elixir",
             "language": "elixir",
-            "orm": "etco",
+            "orm": "full",
             "platform": "Erlang/OTP",
             "platform": "Erlang/OTP",
             "webserver": "cowboy",
             "webserver": "cowboy",
             "os": "Linux",
             "os": "Linux",
             "database_os": "Linux",
             "database_os": "Linux",
-            "display_name": "phoenix",
+            "display_name": "Phoenix",
             "notes": "",
             "notes": "",
             "versus": ""
             "versus": ""
         }
         }

+ 4 - 3
frameworks/Elixir/phoenix/config/config.exs

@@ -8,10 +8,11 @@ use Mix.Config
 # Configures the endpoint
 # Configures the endpoint
 config :hello, Hello.Endpoint,
 config :hello, Hello.Endpoint,
   url: [host: "localhost"],
   url: [host: "localhost"],
-  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx",
+  http: [port: 8080],
+  root: Path.expand(__DIR__),
   debug_errors: false,
   debug_errors: false,
-  pubsub: [adapter: Phoenix.PubSub.PG2]
-
+  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx",
+  pubsub: [name: Hello.PubSub, adapter: Phoenix.PubSub.PG2]
 
 
 # Configures Elixir's Logger
 # Configures Elixir's Logger
 config :logger, :console,
 config :logger, :console,

+ 24 - 4
frameworks/Elixir/phoenix/config/dev.exs

@@ -1,13 +1,33 @@
 use Mix.Config
 use Mix.Config
 
 
+# For development, we disable any cache and enable
+# debugging and code reloading.
+#
+# The watchers configuration can be used to run external
+# watchers to your application. For example, we use it
+# with brunch.io to recompile .js and .css sources.
 config :hello, Hello.Endpoint,
 config :hello, Hello.Endpoint,
-  url: [host: "localhost", port: 8080],
-  http: [port: System.get_env("PORT") || 8080],
+  http: [port: 8080],
   debug_errors: true,
   debug_errors: true,
+  code_reloader: true,
   cache_static_lookup: false
   cache_static_lookup: false
 
 
-# Enables code reloading for development
-config :phoenix, :code_reloader, true
+# Watch static and templates for browser reloading.
+config :hello, Hello.Endpoint,
+  live_reload: [
+    patterns: [
+      ~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$},
+      ~r{web/views/.*(ex)$},
+      ~r{web/templates/.*(eex)$}
+    ]
+  ]
+
+config :hello, Hello.Repo,
+  adapter: Ecto.Adapters.MySQL,
+  username: "benchmarkdbuser",
+  password: "benchmarkdbpass",
+  database: "hello_world",
+  hostname: "localhost"
 
 
 # Do not include metadata nor timestamps in development logs
 # Do not include metadata nor timestamps in development logs
 config :logger, :console, format: "[$level] $message\n"
 config :logger, :console, format: "[$level] $message\n"

+ 12 - 3
frameworks/Elixir/phoenix/config/prod.exs

@@ -1,10 +1,17 @@
 use Mix.Config
 use Mix.Config
 
 
 config :hello, Hello.Endpoint,
 config :hello, Hello.Endpoint,
-  url: [host: "localhost", port: 8080],
+  url: [host: "0.0.0.0"],
   http: [port: 8080],
   http: [port: 8080],
-  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx",
-  cache_static_lookup: false
+  cache_static_lookup: false,
+  server: true
+
+config :hello, Hello.Repo,
+  adapter: Ecto.Adapters.MySQL,
+  username: "benchmarkdbuser",
+  password: "benchmarkdbpass",
+  database: "hello_world",
+  hostname: "localhost"
 
 
 # ## SSL Support
 # ## SSL Support
 #
 #
@@ -36,3 +43,5 @@ config :logger, level: :info
 #
 #
 #     config :hello, Hello.Endpoint, server: true
 #     config :hello, Hello.Endpoint, server: true
 #
 #
+
+import_config "prod.secret.exs"

+ 7 - 0
frameworks/Elixir/phoenix/config/prod.secret.exs

@@ -0,0 +1,7 @@
+use Mix.Config
+
+# In this file, we keep production configuration that
+# you likely want to automate and keep it away from
+# your version control system.
+config :hello, Hello.Endpoint,
+  secret_key_base: "Z18ZjzZslFpKd8HB41IljqMavPiOKVF9y1DIQ+S2Ytg7Op0EIauwJgd7mtRStssx"

+ 0 - 7
frameworks/Elixir/phoenix/config/test.exs

@@ -1,7 +0,0 @@
-use Mix.Config
-
-config :hello, Hello.Endpoint,
-  http: [port: System.get_env("PORT") || 4001]
-
-# Print only warnings and errors during test
-config :logger, level: :warn

+ 2 - 1
frameworks/Elixir/phoenix/lib/hello.ex

@@ -10,8 +10,9 @@ defmodule Hello do
       # Start the endpoint when the application starts
       # Start the endpoint when the application starts
       supervisor(Hello.Endpoint, []),
       supervisor(Hello.Endpoint, []),
       # Here you could define other workers and supervisors as children
       # Here you could define other workers and supervisors as children
+      # Start the Ecto repository
+      worker(Hello.Repo, [])
       # worker(Hello.Worker, [arg1, arg2, arg3]),
       # worker(Hello.Worker, [arg1, arg2, arg3]),
-      # worker(Hello.Repo, [])
     ]
     ]
 
 
     # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
     # See http://elixir-lang.org/docs/stable/elixir/Supervisor.html

+ 8 - 6
frameworks/Elixir/phoenix/lib/hello/endpoint.ex

@@ -3,14 +3,17 @@ defmodule Hello.Endpoint do
 
 
   # Serve at "/" the given assets from "priv/static" directory
   # Serve at "/" the given assets from "priv/static" directory
   plug Plug.Static,
   plug Plug.Static,
-    at: "/", from: :hello,
+    at: "/", from: :hello, gzip: false,
     only: ~w(css images js favicon.ico robots.txt)
     only: ~w(css images js favicon.ico robots.txt)
 
 
-  plug Plug.Logger
-
   # Code reloading will only work if the :code_reloader key of
   # Code reloading will only work if the :code_reloader key of
   # the :phoenix application is set to true in your config file.
   # the :phoenix application is set to true in your config file.
-  plug Phoenix.CodeReloader
+  if code_reloading? do
+    plug Phoenix.LiveReloader
+    plug Phoenix.CodeReloader
+  end
+
+  plug Plug.Logger
 
 
   plug Plug.Parsers,
   plug Plug.Parsers,
     parsers: [:urlencoded, :multipart, :json],
     parsers: [:urlencoded, :multipart, :json],
@@ -23,8 +26,7 @@ defmodule Hello.Endpoint do
   plug Plug.Session,
   plug Plug.Session,
     store: :cookie,
     store: :cookie,
     key: "_hello_key",
     key: "_hello_key",
-    signing_salt: "DNlAnJ2o",
-    encryption_salt: "AOXxaZRq"
+    signing_salt: "DNlAnJ2o"
 
 
   plug :router, Hello.Router
   plug :router, Hello.Router
 end
 end

+ 3 - 0
frameworks/Elixir/phoenix/lib/hello/repo.ex

@@ -0,0 +1,3 @@
+defmodule Hello.Repo do
+    use Ecto.Repo, otp_app: :hello
+end

+ 17 - 10
frameworks/Elixir/phoenix/mix.exs

@@ -2,12 +2,14 @@ defmodule Hello.Mixfile do
   use Mix.Project
   use Mix.Project
 
 
   def project do
   def project do
-    [app: :hello,
-     version: "0.0.1",
-     elixir: "~> 1.0",
-     elixirc_paths: ["lib", "web"],
-     compilers: [:phoenix] ++ Mix.compilers,
-     deps: deps]
+   [app: :hello,
+    version: "0.0.1",
+    elixir: "~> 1.0",
+    elixirc_paths: elixirc_paths(Mix.env),
+    compilers: [:phoenix] ++ Mix.compilers,
+    build_embedded: Mix.env == :prod,
+    start_permanent: Mix.env == :prod,
+    deps: deps]
   end
   end
 
 
   # Configuration for the OTP application
   # Configuration for the OTP application
@@ -15,16 +17,21 @@ defmodule Hello.Mixfile do
   # Type `mix help compile.app` for more information
   # Type `mix help compile.app` for more information
   def application do
   def application do
     [mod: {Hello, []},
     [mod: {Hello, []},
-     applications: [:phoenix, :cowboy, :logger, :postgrex, :ecto]]
+     applications: [:phoenix, :phoenix_ecto, :mariaex, :cowboy, :logger, :phoenix_html]]
   end
   end
 
 
+  defp elixirc_paths(_), do: ["lib", "web"]
+
   # Specifies your project dependencies
   # Specifies your project dependencies
   #
   #
   # Type `mix help deps` for examples and options
   # Type `mix help deps` for examples and options
   defp deps do
   defp deps do
-    [{:phoenix, "~> 0.9.0"},
+    [{:phoenix, "~> 0.13.1"},
+     {:phoenix_ecto, "~> 0.4"},
+     {:mariaex, ">= 0.0.0"},
      {:cowboy, "~> 1.0"},
      {:cowboy, "~> 1.0"},
-     {:postgrex, "~> 0.6.0"},
-     {:ecto, "~> 0.2.5"}]
+     {:phoenix_html, "~> 1.0"},
+     {:phoenix_live_reload, "~> 0.4", only: :dev},
+     {:exrm, "~> 0.15.3"}]
   end
   end
 end
 end

+ 6 - 6
frameworks/Elixir/phoenix/setup.sh

@@ -2,14 +2,14 @@
 
 
 source $IROOT/elixir.installed
 source $IROOT/elixir.installed
 
 
-sed -i 's|db_host: "localhost",|db_host: "${DBHOST}",|g' config/config.exs
+sed -i 's|hostname: "localhost"|hostname: "'${DBHOST}'"|g' config/prod.exs
 
 
-rm -rf _build deps
+rm -rf _build deps rel
 
 
+MIX_ENV=prod
+export MIX_ENV
 mix local.hex --force
 mix local.hex --force
-mix local.rebar --force
 mix deps.get --force
 mix deps.get --force
+mix compile --force
 
 
-MIX_ENV=prod mix compile.protocols --force
-MIX_ENV=prod elixir --detached -pa _build/$MIX_ENV/consolidated -S mix phoenix.server
-
+elixir --detached -S mix phoenix.server

+ 0 - 7
frameworks/Elixir/phoenix/test/hello_test.exs

@@ -1,7 +0,0 @@
-defmodule HelloTest do
-  use ExUnit.Case
-
-  test "the truth" do
-    assert 1 + 1 == 2
-  end
-end

+ 0 - 1
frameworks/Elixir/phoenix/test/test_helper.exs

@@ -1 +0,0 @@
-ExUnit.start

+ 26 - 13
frameworks/Elixir/phoenix/web/controllers/page_controller.ex

@@ -1,14 +1,14 @@
 defmodule Hello.PageController do
 defmodule Hello.PageController do
-  use Phoenix.Controller
+  use Hello.Web, :controller
+  alias Hello.World
+  alias Hello.Fortune
 
 
   plug :action
   plug :action
+  plug :scrub_params, "world" when action in [:create, :update]
+
 
 
   def index(conn, _params) do
   def index(conn, _params) do
-    json conn, %{
-      "TE Benchmarks\n" => "Started",
-      "DBHOST" => System.get_env("DBHOST"),
-      "DBPORT" => System.get_env("DBPORT"),
-    }
+    json conn, %{"TE Benchmarks\n" => "Started"}
   end
   end
 
 
   # avoid namespace collision
   # avoid namespace collision
@@ -17,22 +17,35 @@ defmodule Hello.PageController do
   end
   end
 
 
   def db(conn, _params) do
   def db(conn, _params) do
-    :random.seed(:erlang.now)
-    id = :random.uniform(10000)
-    text conn, "TE Benchmarks\n"
+    json conn, Repo.get(World, :random.uniform(10000))
   end
   end
 
 
   def queries(conn, _params) do
   def queries(conn, _params) do
-    text conn, "TE Benchmarks\n"
+    q = case String.to_integer(_params["queries"]) do
+      x when x < 1    -> 1
+      x when x > 500  -> 500
+      x               -> x
+    end
+    json conn, Enum.map(1..q, fn _ -> Repo.get(World, :random.uniform(10000)) end)
   end
   end
 
 
   def fortunes(conn, _params) do
   def fortunes(conn, _params) do
-    text conn, "TE Benchmarks\n"
+    fortunes = List.insert_at(Repo.all(Fortune), 0, %Fortune{:id => 0, :message  => "Additional fortune added at request time."})
+    render conn, "fortunes.html", fortunes: Enum.sort(fortunes, fn f1, f2 -> f1.message < f2.message end)
   end
   end
 
 
   def updates(conn, _params) do
   def updates(conn, _params) do
-    text conn, "TE Benchmarks\n"
-  end
+    q = case String.to_integer(_params["queries"]) do
+      x when x < 1    -> 1
+      x when x > 500  -> 500
+      x               -> x
+    end
+    json conn, Enum.map(1..q, fn _ ->
+      w = Repo.get(World, :random.uniform(10000))
+      changeset = World.changeset(w, %{randomNumber: :random.uniform(10000)})
+      Repo.update(changeset)
+      w end)
+    end
 
 
   def plaintext(conn, _params) do
   def plaintext(conn, _params) do
     text conn, "Hello, world!"
     text conn, "Hello, world!"

+ 15 - 0
frameworks/Elixir/phoenix/web/models/fortune.ex

@@ -0,0 +1,15 @@
+defmodule Hello.Fortune do
+  use Hello.Web, :model
+
+  schema "fortune" do
+    field :message, :string
+  end
+
+  @required_fields ~w(message)
+  @optional_fields ~w()
+
+  def changeset(model, params \\ nil) do
+    model
+    |> cast(params, @required_fields, @optional_fields)
+  end
+end

+ 0 - 11
frameworks/Elixir/phoenix/web/models/repo.exs

@@ -1,11 +0,0 @@
-defmodule Hello.Repo do
-  use Ecto.Repo, adapter: Ecto.Adapters.Postgres
-
-  def conf do
-    parse_url "ecto://username:password@host/database_name"
-  end
-
-  def priv do
-    app_dir(:hello, "priv/repo")
-  end
-end

+ 15 - 0
frameworks/Elixir/phoenix/web/models/world.ex

@@ -0,0 +1,15 @@
+defmodule Hello.World do
+  use Hello.Web, :model
+
+  schema "world" do
+    field :randomNumber, :integer
+  end
+
+  @required_fields ~w(randomNumber)
+  @optional_fields ~w()
+
+  def changeset(model, params \\ nil) do
+    model
+    |> cast(params, @required_fields, @optional_fields)
+  end
+end

+ 0 - 7
frameworks/Elixir/phoenix/web/models/world.exs

@@ -1,7 +0,0 @@
-defmodule Hello.User do
-  use Ecto.Model
-
-  schema "world" do
-    field :randomNumber, :integer
-  end
-end

+ 5 - 5
frameworks/Elixir/phoenix/web/router.ex

@@ -1,15 +1,15 @@
 defmodule Hello.Router do
 defmodule Hello.Router do
-  use Phoenix.Router
+  use Hello.Web, :router
 
 
   pipeline :browser do
   pipeline :browser do
-    plug :accepts, ~w(html)
+    plug :accepts, ["html"]
     plug :fetch_session
     plug :fetch_session
     plug :fetch_flash
     plug :fetch_flash
     plug :protect_from_forgery
     plug :protect_from_forgery
   end
   end
 
 
   pipeline :api do
   pipeline :api do
-    plug :accepts, ~w(json)
+    plug :accepts, ["json"]
   end
   end
 
 
   scope "/", Hello do
   scope "/", Hello do
@@ -18,8 +18,8 @@ defmodule Hello.Router do
     get "/json", PageController, :_json
     get "/json", PageController, :_json
     get "/db", PageController, :db
     get "/db", PageController, :db
     get "/queries", PageController, :queries
     get "/queries", PageController, :queries
-    get "/fortunes", PageController, :fortunes
-    get "/updates", PageController, :updates
+    get "/fortune", PageController, :fortunes
+    get "/update", PageController, :updates
     get "/plaintext", PageController, :plaintext
     get "/plaintext", PageController, :plaintext
     get "/", PageController, :index
     get "/", PageController, :index
   end
   end

+ 1 - 31
frameworks/Elixir/phoenix/web/templates/layout/application.html.eex

@@ -1,31 +1 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <meta name="description" content="">
-    <meta name="author" content="">
-
-    <title>Hello Phoenix!</title>
-    <link rel="stylesheet" href="/css/phoenix.css">
-  </head>
-
-  <body>
-    <div class="container">
-      <div class="header">
-        <ul class="nav nav-pills pull-right">
-          <li><a href="http://www.phoenixframework.org/docs">Get Started</a></li>
-        </ul>
-        <span class="logo"></span>
-      </div>
-
-      <%= @inner %>
-
-      <div class="footer">
-        <p><a href="http://phoenixframework.org">phoenixframework.org</a></p>
-      </div>
-
-    </div> <!-- /container -->
-  </body>
-</html>
+<!DOCTYPE html><html lang="en"><head><title>Fortunes</title></head><body><%= @inner %></body></html>

+ 0 - 1
frameworks/Elixir/phoenix/web/templates/page/error.html.eex

@@ -1 +0,0 @@
-Something went wrong

+ 1 - 0
frameworks/Elixir/phoenix/web/templates/page/fortunes.html.eex

@@ -0,0 +1 @@
+<table><tr><th>id</th><th>message</th></tr><%= for f <- @fortunes do %><tr><td><%= f.id %></td><td><%= f.message %></td></tr><% end %></table>

+ 0 - 34
frameworks/Elixir/phoenix/web/templates/page/index.html.eex

@@ -1,34 +0,0 @@
-<div class="jumbotron">
-  <h2>Welcome to Phoenix!</h2>
-  <p class="lead">Phoenix is an Elixir Web Framework targeting full-featured, fault tolerant applications with realtime functionality.</p>
-</div>
-
-<div class="row marketing">
-  <div class="col-lg-6">
-    <h4>Resources</h4>
-    <ul>
-      <li>
-        <a href="http://hexdocs.pm/phoenix">Docs</a>
-      </li>
-      <li>
-        <a href="https://github.com/phoenixframework/phoenix">Source</a>
-      </li>
-    </ul>
-  </div>
-
-  <div class="col-lg-6">
-    <h4>Help</h4>
-    <ul>
-      <li>
-        <a href="https://github.com/phoenixframework/phoenix/issues?state=open">Issues</a>
-      </li>
-      <li>
-        <a href="irc://irc.freenode.net/elixir-lang">#elixir-lang on freenode IRC</a>
-      </li>
-      <li>
-        <a href="https://twitter.com/chris_mccord">@chris_mccord</a>
-      </li>
-    </ul>
-  </div>
-</div>
-

+ 0 - 1
frameworks/Elixir/phoenix/web/templates/page/not_found.html.eex

@@ -1 +0,0 @@
-The page you are looking for does not exist

+ 0 - 17
frameworks/Elixir/phoenix/web/view.ex

@@ -1,17 +0,0 @@
-defmodule Hello.View do
-  use Phoenix.View, root: "web/templates"
-
-  # The quoted expression returned by this block is applied
-  # to this module and all other views that use this module.
-  using do
-    quote do
-      # Import common functionality
-      import Hello.Router.Helpers
-
-      # Use Phoenix.HTML to import all HTML functions (forms, tags, etc)
-      use Phoenix.HTML
-    end
-  end
-
-  # Functions defined here are available to all other views/templates
-end

+ 4 - 3
frameworks/Elixir/phoenix/web/views/error_view.ex

@@ -1,5 +1,5 @@
 defmodule Hello.ErrorView do
 defmodule Hello.ErrorView do
-  use Hello.View
+  use Hello.Web, :view
 
 
   def render("404.html", _assigns) do
   def render("404.html", _assigns) do
     "Page not found - 404"
     "Page not found - 404"
@@ -9,8 +9,9 @@ defmodule Hello.ErrorView do
     "Server internal error - 500"
     "Server internal error - 500"
   end
   end
 
 
-  # Render all other templates as 500
-  def render(_, assigns) do
+  # In case no render clause matches or no
+  # template is found, let's render it as 500
+  def template_not_found(_template, assigns) do
     render "500.html", assigns
     render "500.html", assigns
   end
   end
 end
 end

+ 1 - 1
frameworks/Elixir/phoenix/web/views/layout_view.ex

@@ -1,3 +1,3 @@
 defmodule Hello.LayoutView do
 defmodule Hello.LayoutView do
-  use Hello.View
+  use Hello.Web, :view
 end
 end

+ 1 - 1
frameworks/Elixir/phoenix/web/views/page_view.ex

@@ -1,3 +1,3 @@
 defmodule Hello.PageView do
 defmodule Hello.PageView do
-  use Hello.View
+  use Hello.Web, :view
 end
 end

+ 73 - 0
frameworks/Elixir/phoenix/web/web.ex

@@ -0,0 +1,73 @@
+defmodule Hello.Web do
+  @moduledoc """
+  A module that keeps using definitions for controllers,
+  views and so on.
+
+  This can be used in your application as:
+
+      use Hello.Web, :controller
+      use Hello.Web, :view
+
+  Keep the definitions in this module short and clean,
+  mostly focused on imports, uses and aliases.
+  """
+
+  def model do
+    quote do
+      use Ecto.Model
+    end
+  end
+
+  def controller do
+    quote do
+      use Phoenix.Controller
+
+      # Alias the data repository and import query/model functions
+      alias Hello.Repo
+      import Ecto.Model
+      import Ecto.Query
+
+      # Import URL helpers from the router
+      import Hello.Router.Helpers
+    end
+  end
+
+  def view do
+    quote do
+      use Phoenix.View, root: "web/templates"
+
+      # Import convenience functions from controllers
+      import Phoenix.Controller, only: [get_csrf_token: 0, get_flash: 2, view_module: 1]
+
+      # Import URL helpers from the router
+      import Hello.Router.Helpers
+
+      # Import all HTML functions (forms, tags, etc)
+      use Phoenix.HTML
+    end
+  end
+
+  def router do
+    quote do
+      use Phoenix.Router
+    end
+  end
+
+
+  def channel do
+    quote do
+      use Phoenix.Channel
+      # Alias the data repository and import query/model functions
+      alias Hello.Repo
+      import Ecto.Model
+      import Ecto.Query, only: [from: 2]
+    end
+  end
+
+  @doc """
+  When used, dispatch to the appropriate controller/view/etc.
+  """
+  defmacro __using__(which) when is_atom(which) do
+    apply(__MODULE__, which, [])
+  end
+end

+ 1 - 1
frameworks/Erlang/cowboy/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
 
 
-fw_depends erlang rebar
+fw_depends erlang

+ 2 - 3
frameworks/Erlang/cowboy/setup.sh

@@ -1,11 +1,10 @@
 #!/bin/bash
 #!/bin/bash
 
 
 source $IROOT/erlang.installed
 source $IROOT/erlang.installed
-source $IROOT/rebar.installed
 
 
 sed -i 's|"benchmarkdbpass", ".*", 3306|"benchmarkdbpass", "'"${DBHOST}"'", 3306|g' src/hello_world_app.erl
 sed -i 's|"benchmarkdbpass", ".*", 3306|"benchmarkdbpass", "'"${DBHOST}"'", 3306|g' src/hello_world_app.erl
 
 
 rm -rf deps/* ebin/*
 rm -rf deps/* ebin/*
-$REBAR_HOME/rebar get-deps
-$REBAR_HOME/rebar compile
+rebar get-deps
+rebar compile
 erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s hello_world -noshell -detached
 erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s hello_world -noshell -detached

+ 1 - 1
frameworks/Erlang/elli/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 #!/bin/bash
 
 
-fw_depends erlang rebar
+fw_depends erlang

+ 2 - 3
frameworks/Erlang/elli/setup.sh

@@ -1,11 +1,10 @@
 #!/bin/bash
 #!/bin/bash
 
 
 source $IROOT/erlang.installed
 source $IROOT/erlang.installed
-source $IROOT/rebar.installed
 
 
 sed -i 's|"benchmarkdbpass", ".*", 3306|"benchmarkdbpass", "'"${DBHOST}"'", 3306|g' src/elli_bench_sup.erl
 sed -i 's|"benchmarkdbpass", ".*", 3306|"benchmarkdbpass", "'"${DBHOST}"'", 3306|g' src/elli_bench_sup.erl
 
 
 rm -rf deps/* ebin/*
 rm -rf deps/* ebin/*
-$REBAR_HOME/rebar get-deps
-$REBAR_HOME/rebar compile
+rebar get-deps
+rebar compile
 erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s elli_bench -noshell -detached
 erl -pa ebin deps/*/ebin +sbwt very_long +swt very_low -s elli_bench -noshell -detached

+ 18 - 6
frameworks/Go/gin/hello.go

@@ -72,7 +72,8 @@ func db(c *gin.Context) {
 	var world World
 	var world World
 	err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world.Id, &world.RandomNumber)
 	err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world.Id, &world.RandomNumber)
 	if err != nil {
 	if err != nil {
-		c.Fail(500, err)
+		c.AbortWithError(500, err)
+		return
 	}
 	}
 	c.JSON(200, &world)
 	c.JSON(200, &world)
 }
 }
@@ -85,7 +86,8 @@ func dbs(c *gin.Context) {
 	for i := 0; i < numQueries; i++ {
 	for i := 0; i < numQueries; i++ {
 		err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&worlds[i].Id, &worlds[i].RandomNumber)
 		err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&worlds[i].Id, &worlds[i].RandomNumber)
 		if err != nil {
 		if err != nil {
-			c.Fail(500, err)
+			c.AbortWithError(500, err)
+			return
 		}
 		}
 	}
 	}
 	c.JSON(200, &worlds)
 	c.JSON(200, &worlds)
@@ -95,14 +97,16 @@ func dbs(c *gin.Context) {
 func fortunes(c *gin.Context) {
 func fortunes(c *gin.Context) {
 	rows, err := fortuneStatement.Query()
 	rows, err := fortuneStatement.Query()
 	if err != nil {
 	if err != nil {
-		c.Fail(500, err)
+		c.AbortWithError(500, err)
+		return
 	}
 	}
 
 
 	fortunes := make(Fortunes, 0, 16)
 	fortunes := make(Fortunes, 0, 16)
 	for rows.Next() { //Fetch rows
 	for rows.Next() { //Fetch rows
 		fortune := Fortune{}
 		fortune := Fortune{}
 		if err := rows.Scan(&fortune.Id, &fortune.Message); err != nil {
 		if err := rows.Scan(&fortune.Id, &fortune.Message); err != nil {
-			c.Fail(500, err)
+			c.AbortWithError(500, err)
+			return
 		}
 		}
 		fortunes = append(fortunes, &fortune)
 		fortunes = append(fortunes, &fortune)
 	}
 	}
@@ -118,11 +122,13 @@ func update(c *gin.Context) {
 	world := make([]World, numQueries)
 	world := make([]World, numQueries)
 	for i := 0; i < numQueries; i++ {
 	for i := 0; i < numQueries; i++ {
 		if err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world[i].Id, &world[i].RandomNumber); err != nil {
 		if err := worldStatement.QueryRow(rand.Intn(worldRowCount)+1).Scan(&world[i].Id, &world[i].RandomNumber); err != nil {
-			c.Fail(500, err)
+			c.AbortWithError(500, err)
+			return
 		}
 		}
 		world[i].RandomNumber = uint16(rand.Intn(worldRowCount) + 1)
 		world[i].RandomNumber = uint16(rand.Intn(worldRowCount) + 1)
 		if _, err := updateStatement.Exec(world[i].RandomNumber, world[i].Id); err != nil {
 		if _, err := updateStatement.Exec(world[i].RandomNumber, world[i].Id); err != nil {
-			c.Fail(500, err)
+			c.AbortWithError(500, err)
+			return
 		}
 		}
 	}
 	}
 	c.JSON(200, world)
 	c.JSON(200, world)
@@ -134,7 +140,13 @@ func plaintext(c *gin.Context) {
 }
 }
 
 
 func main() {
 func main() {
+	gin.SetMode(gin.ReleaseMode)
+
 	r := gin.New()
 	r := gin.New()
+	serverHeader := []string{"Gin"}
+	r.Use(func(c *gin.Context) {
+		c.Writer.Header()["Server"] = serverHeader
+	})
 	r.LoadHTMLFiles("fortune.html")
 	r.LoadHTMLFiles("fortune.html")
 	r.GET("/json", json)
 	r.GET("/json", json)
 	r.GET("/db", db)
 	r.GET("/db", db)

+ 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 - 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;
-  }
-}

+ 9 - 0
frameworks/Java/dropwizard/README.md

@@ -0,0 +1,9 @@
+# Dropwizard Benchmarking Test
+
+This project consists of 3 tests:
+
+* MySql and Postgres - uses: `HelloWorldService.java` and `HelloWorldConfiguration.java`
+* MongoDB - uses: `HelloMongoService.java` and `HelloMongoConfiguration.java`
+
+All other `resources` and `model` code are shared. The main `*Service.java` is set based on maven profiles.
+Respective `.yml` configuration files are specified in each `setup_*.sh` script.

+ 46 - 4
frameworks/Java/dropwizard/benchmark_config.json

@@ -2,14 +2,14 @@
   "framework": "dropwizard",
   "framework": "dropwizard",
   "tests": [{
   "tests": [{
     "default": {
     "default": {
-      "setup_file": "setup",
+      "setup_file": "setup_mysql",
       "json_url": "/json",
       "json_url": "/json",
       "db_url": "/db",
       "db_url": "/db",
       "query_url": "/db?queries=",
       "query_url": "/db?queries=",
       "fortune_url": "/fortunes",
       "fortune_url": "/fortunes",
       "update_url": "/db/update?queries=",
       "update_url": "/db/update?queries=",
       "plaintext_url": "/plaintext",
       "plaintext_url": "/plaintext",
-      "port": 9000,
+      "port": 9090,
       "approach": "Realistic",
       "approach": "Realistic",
       "classification": "Fullstack",
       "classification": "Fullstack",
       "database": "MySQL",
       "database": "MySQL",
@@ -21,8 +21,50 @@
       "os": "Linux",
       "os": "Linux",
       "database_os": "Linux",
       "database_os": "Linux",
       "display_name": "dropwizard",
       "display_name": "dropwizard",
-      "notes": "",
+      "notes": "dropwizard mysql using hibernate",
+      "versus": "servlet"
+    },
+    "mongodb": {
+      "setup_file": "setup_mongo",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "fortune_url": "/fortunes",
+      "update_url": "/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",
+      "notes": "dropwizard mongodb using mongojack",
       "versus": ""
       "versus": ""
+    },
+    "postgres": {
+      "setup_file": "setup_postgres",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "fortune_url": "/fortunes",
+      "update_url": "/db/update?queries=",
+      "port": 9090,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "Postgres",
+      "framework": "dropwizard",
+      "language": "Java",
+      "orm": "Full",
+      "platform": "Jetty",
+      "webserver": "Jetty",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "dropwizard",
+      "notes": "dropwizard postgres using hibernate",
+      "versus": "servlet"
     }
     }
   }]
   }]
-}
+}

+ 18 - 0
frameworks/Java/dropwizard/hello-world-mongo.yml

@@ -0,0 +1,18 @@
+server:
+  type: simple
+  applicationContextPath: /
+  connector:
+    type: http
+    port: 9090
+    useServerHeader: true
+
+  requestLog:
+    appenders: []
+
+logging:
+  appenders: []
+
+mongo:
+  host: 127.0.0.1
+  port: 27017
+  db: hello_world

+ 3 - 2
frameworks/Java/dropwizard/hello-world.yml → frameworks/Java/dropwizard/hello-world-mysql.yml

@@ -3,7 +3,7 @@ server:
   applicationContextPath: /
   applicationContextPath: /
   connector:
   connector:
     type: http
     type: http
-    port: 9000
+    port: 9090
     useServerHeader: true
     useServerHeader: true
 
 
   requestLog:
   requestLog:
@@ -23,11 +23,12 @@ database:
   password: benchmarkdbpass
   password: benchmarkdbpass
 
 
   # the JDBC URL
   # 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:
   # any properties specific to your JDBC driver:
   properties:
   properties:
     charSet: UTF-8
     charSet: UTF-8
+    hibernate.dialect: org.hibernate.dialect.MySQLDialect
 
 
   # the maximum amount of time to wait on an empty pool before throwing an exception
   # the maximum amount of time to wait on an empty pool before throwing an exception
   maxWaitForConnection: 1s
   maxWaitForConnection: 1s

+ 43 - 0
frameworks/Java/dropwizard/hello-world-postgres.yml

@@ -0,0 +1,43 @@
+server:
+  type: simple
+  applicationContextPath: /
+  connector:
+    type: http
+    port: 9090
+    useServerHeader: true
+
+  requestLog:
+    appenders: []
+
+logging:
+  appenders: []
+
+database:
+  # the name of your JDBC driver
+  driverClass: org.postgresql.Driver
+
+  # the username
+  user: benchmarkdbuser
+
+  # the password
+  password: benchmarkdbpass
+
+  # the JDBC URL
+  url: jdbc:postgresql://127.0.0.1:5432/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:
+    charSet: UTF-8
+    hibernate.dialect: org.hibernate.dialect.PostgreSQL9Dialect
+
+  # the maximum amount of time to wait on an empty pool before throwing an exception
+  maxWaitForConnection: 1s
+
+  # the minimum number of connections to keep open
+  minSize: 8
+
+  # the maximum number of connections to keep open
+  maxSize: 256
+
+  # whether or not idle connections should be validated
+  checkConnectionWhileIdle: false

+ 58 - 9
frameworks/Java/dropwizard/pom.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?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">
+<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>
     <modelVersion>4.0.0</modelVersion>
 
 
     <groupId>com.xekm</groupId>
     <groupId>com.xekm</groupId>
@@ -9,10 +10,45 @@
     <properties>
     <properties>
         <jdk.version>1.7</jdk.version>
         <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.8.1</dropwizard.version>
+        <mysql-connector-java.version>5.1.35</mysql-connector-java.version>
+        <mongojack.version>2.3.0</mongojack.version>
+        <postgres-jdbc.version>9.4-1201-jdbc41</postgres-jdbc.version>
+        <dropwizard.java8.version>0.8.0-1</dropwizard.java8.version>
+
+        <main.class>com.example.helloworld.HelloWorldService</main.class>
     </properties>
     </properties>
 
 
+
+    <profiles>
+        <profile>
+            <id>mysql</id>
+            <dependencies>
+                <dependency>
+                    <groupId>mysql</groupId>
+                    <artifactId>mysql-connector-java</artifactId>
+                    <version>${mysql-connector-java.version}</version>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>mongo</id>
+            <properties>
+                <main.class>com.example.helloworld.HelloMongoService</main.class>
+            </properties>
+        </profile>
+        <profile>
+            <id>postgres</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.postgresql</groupId>
+                    <artifactId>postgresql</artifactId>
+                    <version>${postgres-jdbc.version}</version>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
     <dependencies>
     <dependencies>
         <dependency>
         <dependency>
             <groupId>io.dropwizard</groupId>
             <groupId>io.dropwizard</groupId>
@@ -30,9 +66,20 @@
             <version>${dropwizard.version}</version>
             <version>${dropwizard.version}</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <version>${mysql-connector-java.version}</version>
+            <groupId>io.dropwizard.modules</groupId>
+            <artifactId>dropwizard-java8</artifactId>
+            <version>${dropwizard.java8.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mongojack</groupId>
+            <artifactId>mongojack</artifactId>
+            <version>${mongojack.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.fasterxml.jackson.core</groupId>
+                    <artifactId>jackson-databind</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
 
 
@@ -84,9 +131,11 @@
                         </goals>
                         </goals>
                         <configuration>
                         <configuration>
                             <transformers>
                             <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
+                                        implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
+                                <transformer
+                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+                                    <mainClass>${main.class}</mainClass>
                                 </transformer>
                                 </transformer>
                             </transformers>
                             </transformers>
                         </configuration>
                         </configuration>

+ 10 - 0
frameworks/Java/dropwizard/setup_mongo.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# load java environment variables
+source $IROOT/java7.installed
+
+sed -i 's|host: 127.0.0.1|host: '"${DBHOST}"'|g' hello-world-mongo.yml
+
+mvn -P mongo clean package
+
+java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world-mongo.yml &

+ 3 - 3
frameworks/Java/dropwizard/setup.sh → frameworks/Java/dropwizard/setup_mysql.sh

@@ -3,8 +3,8 @@
 # load java environment variables
 # load java environment variables
 source $IROOT/java7.installed
 source $IROOT/java7.installed
 
 
-sed -i 's|url: jdbc:mysql://.*/hello_world|url: jdbc:mysql://'"${DBHOST}"':3306/hello_world|g' hello-world.yml
+sed -i 's|url: jdbc:mysql://.*/hello_world|url: jdbc:mysql://'"${DBHOST}"':3306/hello_world|g' hello-world-mysql.yml
 
 
-mvn clean package
+mvn -P mysql clean package
 
 
-java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world.yml &
+java -jar target/hello-world-0.0.1-SNAPSHOT.jar server hello-world-mysql.yml &

Some files were not shown because too many files changed in this diff