Browse Source

merged latest changes from Techempower/master

MTD 9 years ago
parent
commit
e5c8efba21
100 changed files with 880 additions and 472 deletions
  1. 23 23
      .travis.yml
  2. 4 4
      config/create.sql
  3. 9 5
      frameworks/C++/ULib/README.md
  4. 22 1
      frameworks/C++/ULib/benchmark_config.json
  5. 12 1
      frameworks/C++/ULib/setup_json.sh
  6. 11 0
      frameworks/C++/ULib/setup_mysql.sh
  7. 11 0
      frameworks/C++/ULib/setup_plaintext.sh
  8. 9 0
      frameworks/C++/ULib/setup_postgres.sh
  9. 24 0
      frameworks/C++/ULib/setup_redis.sh
  10. 11 0
      frameworks/C++/ULib/setup_sqlite.sh
  11. 4 0
      frameworks/C++/ULib/source_code
  12. 7 7
      frameworks/C++/ULib/src/fortune.usp
  13. 12 5
      frameworks/C++/ULib/src/query.usp
  14. 74 0
      frameworks/C++/ULib/src/rdb.usp
  15. 73 0
      frameworks/C++/ULib/src/rfortune.usp
  16. 118 0
      frameworks/C++/ULib/src/rquery.usp
  17. 122 0
      frameworks/C++/ULib/src/rupdate.usp
  18. 10 3
      frameworks/C++/ULib/src/update.usp
  19. 0 21
      frameworks/C++/cpoll_cppsp/install.sh
  20. 2 3
      frameworks/C++/cpoll_cppsp/setup.sh
  21. 3 2
      frameworks/C++/silicon/CMakeLists.txt
  22. 0 20
      frameworks/C++/silicon/install.sh
  23. 8 0
      frameworks/C++/silicon/setup_epoll_mysql.sh
  24. 8 0
      frameworks/C++/silicon/setup_tpc_mysql.sh
  25. 0 3
      frameworks/C++/treefrog/install.sh
  26. 3 1
      frameworks/C++/treefrog/setup-thread.sh
  27. 3 1
      frameworks/C++/treefrog/setup.sh
  28. 0 13
      frameworks/C++/wt/install.sh
  29. 2 11
      frameworks/C++/wt/setup.sh
  30. 2 11
      frameworks/C++/wt/setup_postgres.sh
  31. 0 14
      frameworks/C/duda/install.sh
  32. 2 3
      frameworks/C/duda/setup.sh
  33. 0 5
      frameworks/C/haywire/install.sh
  34. 3 1
      frameworks/C/haywire/setup.sh
  35. 0 20
      frameworks/C/lwan/install.sh
  36. 1 6
      frameworks/C/lwan/setup-mysql.sh
  37. 1 6
      frameworks/C/lwan/setup.sh
  38. 2 2
      frameworks/C/onion/Makefile
  39. 1 1
      frameworks/C/onion/hello.c
  40. 0 3
      frameworks/C/onion/install.sh
  41. 4 2
      frameworks/C/onion/setup.sh
  42. 4 4
      frameworks/CSharp/HttpListener/benchmark_config.json
  43. 0 3
      frameworks/CSharp/aspnet/install.sh
  44. 3 8
      frameworks/CSharp/aspnet/setup_nginx.sh
  45. 0 3
      frameworks/CSharp/evhttp-sharp/install.sh
  46. 1 4
      frameworks/CSharp/evhttp-sharp/setup.sh
  47. 0 3
      frameworks/CSharp/nancy/install.sh
  48. 4 6
      frameworks/CSharp/nancy/setup_nginx.sh
  49. 0 33
      frameworks/CSharp/nancy/setup_xsp.py
  50. 0 3
      frameworks/CSharp/servicestack/install.sh
  51. 0 44
      frameworks/CSharp/servicestack/setup_nginx.py
  52. 3 6
      frameworks/CSharp/servicestack/setup_nginx.sh
  53. 0 33
      frameworks/CSharp/servicestack/setup_xsp.py
  54. 1 4
      frameworks/CSharp/servicestack/setup_xsp.sh
  55. 0 3
      frameworks/Clojure/aleph/install.sh
  56. 2 4
      frameworks/Clojure/aleph/setup.sh
  57. 0 3
      frameworks/Clojure/compojure/install.sh
  58. 2 13
      frameworks/Clojure/compojure/setup.sh
  59. 0 3
      frameworks/Clojure/http-kit/install.sh
  60. 2 4
      frameworks/Clojure/http-kit/setup.sh
  61. 0 3
      frameworks/Clojure/luminus/install.sh
  62. 2 2
      frameworks/Clojure/luminus/setup.sh
  63. 0 3
      frameworks/Clojure/pedestal/install.sh
  64. 3 3
      frameworks/Clojure/pedestal/setup.sh
  65. 1 1
      frameworks/Clojure/pedestal/src/pedestal/service.clj
  66. 0 3
      frameworks/Crystal/crystal-raw/install.sh
  67. 2 1
      frameworks/Crystal/crystal-raw/setup.sh
  68. 2 1
      frameworks/Crystal/moonshine/.gitignore
  69. 0 4
      frameworks/Crystal/moonshine/Projectfile
  70. 29 6
      frameworks/Crystal/moonshine/benchmark_config.json
  71. 0 4
      frameworks/Crystal/moonshine/install.sh
  72. 158 0
      frameworks/Crystal/moonshine/server-postgres.cr
  73. 15 10
      frameworks/Crystal/moonshine/server-redis.cr
  74. 7 0
      frameworks/Crystal/moonshine/setup-postgres.sh
  75. 7 0
      frameworks/Crystal/moonshine/setup-redis.sh
  76. 0 5
      frameworks/Crystal/moonshine/setup.sh
  77. 15 0
      frameworks/Crystal/moonshine/shard.yml
  78. 1 1
      frameworks/D/vibed/.gitignore
  79. 1 1
      frameworks/D/vibed/README.md
  80. 1 1
      frameworks/D/vibed/benchmark_config.json
  81. 1 1
      frameworks/D/vibed/dub.json
  82. 0 3
      frameworks/D/vibed/dub.selections.json
  83. 1 2
      frameworks/D/vibed/setup.sh
  84. 1 1
      frameworks/D/vibed/source/app.d
  85. 1 1
      frameworks/D/vibed/views/index.dt
  86. 0 0
      frameworks/Dart/dart-raw/.gitignore
  87. 0 0
      frameworks/Dart/dart-raw/README.md
  88. 0 0
      frameworks/Dart/dart-raw/benchmark_config.json
  89. 0 0
      frameworks/Dart/dart-raw/fortunes.mustache
  90. 0 0
      frameworks/Dart/dart-raw/postgresql.yaml
  91. 0 0
      frameworks/Dart/dart-raw/pubspec.yaml
  92. 0 0
      frameworks/Dart/dart-raw/server.dart
  93. 9 0
      frameworks/Dart/dart-raw/setup.sh
  94. 0 0
      frameworks/Dart/dart-raw/source_code
  95. 0 3
      frameworks/Dart/dart-redstone/install.sh
  96. 0 10
      frameworks/Dart/dart-redstone/setup.sh
  97. 0 3
      frameworks/Dart/dart-start/install.sh
  98. 0 3
      frameworks/Dart/dart-stream/install.sh
  99. 0 3
      frameworks/Dart/dart/install.sh
  100. 0 11
      frameworks/Dart/dart/setup.sh

+ 23 - 23
.travis.yml

@@ -1,11 +1,11 @@
 sudo: required
+dist: trusty
 language: python
 python:
   - "2.7"
 
 env:
   matrix:
-
     # Group tests by directory to logically break up travis-CI build. Otherwise
     # we end up starting ~200+ different workers. Seems that ~100 is the limit
     # before their website starts to lag heavily
@@ -29,7 +29,7 @@ env:
     - "TESTDIR=C++/cpoll_cppsp"
     - "TESTDIR=C++/silicon"
     - "TESTDIR=C++/treefrog"
-    - "TESTDIR=C++/ULib"
+    - "TESTDIR=C++/ulib"
     - "TESTDIR=C++/wt"
     - "TESTDIR=Clojure/compojure"
     - "TESTDIR=Clojure/http-kit"
@@ -39,10 +39,10 @@ env:
     - "TESTDIR=Crystal/crystal-raw"
     - "TESTDIR=Crystal/moonshine"
     - "TESTDIR=D/vibed"
-    - "TESTDIR=Dart/dart"
-    - "TESTDIR=Dart/dart-redstone"
-    - "TESTDIR=Dart/dart-start"
-    - "TESTDIR=Dart/dart-stream"
+    - "TESTDIR=Dart/dart-raw"
+    - "TESTDIR=Dart/redstone"
+    - "TESTDIR=Dart/start"
+    - "TESTDIR=Dart/stream"
     - "TESTDIR=Elixir/phoenix"
     - "TESTDIR=Elixir/cowboy"
     - "TESTDIR=Erlang/cowboy"
@@ -50,9 +50,9 @@ env:
     - "TESTDIR=Go/beego"
     - "TESTDIR=Go/falcore"
     - "TESTDIR=Go/gin"
-    - "TESTDIR=Go/go"
+    - "TESTDIR=Go/go-raw"
     - "TESTDIR=Go/goji"
-    - "TESTDIR=Go/go-mongodb"
+    - "TESTDIR=Go/go-raw-mongodb"
     - "TESTDIR=Go/revel"
     - "TESTDIR=Go/revel-jet"
     - "TESTDIR=Go/revel-qbs"
@@ -112,29 +112,29 @@ env:
     - "TESTDIR=PHP/cygnite-php-framework"
     - "TESTDIR=PHP/codeigniter"
     - "TESTDIR=PHP/clancats"
-    - "TESTDIR=PHP/php-fatfree"
+    - "TESTDIR=PHP/fat-free"
     - "TESTDIR=PHP/fuel"
     - "TESTDIR=PHP/kohana"
-    - "TESTDIR=PHP/php-laravel"
+    - "TESTDIR=PHP/laravel"
     - "TESTDIR=PHP/limonade"
     - "TESTDIR=PHP/lithium"
     - "TESTDIR=PHP/lumen"
-    - "TESTDIR=PHP/php-micromvc"
-    - "TESTDIR=PHP/php-phalcon"
-    - "TESTDIR=PHP/php-phalcon-micro"
-    - "TESTDIR=PHP/php-phpixie"
-    - "TESTDIR=PHP/php-pimf"
-    - "TESTDIR=PHP/php-silex"
-    - "TESTDIR=PHP/php-silex-orm"
-    - "TESTDIR=PHP/php-slim"
+    - "TESTDIR=PHP/micromvc"
+    - "TESTDIR=PHP/phalcon"
+    - "TESTDIR=PHP/phalcon-micro"
+    - "TESTDIR=PHP/phpixie"
+    - "TESTDIR=PHP/pimf"
+    - "TESTDIR=PHP/silex"
+    - "TESTDIR=PHP/silex-orm"
+    - "TESTDIR=PHP/slim"
     - "TESTDIR=PHP/symfony2"
     - "TESTDIR=PHP/symfony2-stripped"
-    - "TESTDIR=PHP/php-yaf"
-    - "TESTDIR=PHP/Yii2"
-    - "TESTDIR=PHP/php-zend-framework"
-    - "TESTDIR=PHP/php-zend-framework1"
+    - "TESTDIR=PHP/yaf"
+    - "TESTDIR=PHP/yii2"
+    - "TESTDIR=PHP/zend"
+    - "TESTDIR=PHP/zend1"
     - "TESTDIR=PHP/phreeze"
-    - "TESTDIR=Python/AsyncIO"
+    - "TESTDIR=Python/asyncio"
     - "TESTDIR=Python/bottle"
     - "TESTDIR=Python/cherrypy"
     - "TESTDIR=Python/django"

+ 4 - 4
config/create.sql

@@ -1,7 +1,3 @@
-# create benchmark user
-GRANT ALL ON *.* TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
-GRANT ALL ON *.* TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
-
 # modified from SO answer http://stackoverflow.com/questions/5125096/for-loop-in-mysql
 DROP DATABASE IF EXISTS hello_world;
 CREATE DATABASE hello_world;
@@ -14,6 +10,8 @@ CREATE TABLE  World (
   PRIMARY KEY  (id)
 )
 ENGINE=INNODB;
+GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
+GRANT ALL ON hello_world.world TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
 
 DROP PROCEDURE IF EXISTS load_data;
 
@@ -95,6 +93,8 @@ CREATE TABLE  fortune (
   PRIMARY KEY  (id)
 )
 ENGINE=INNODB;
+GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'%' IDENTIFIED BY 'benchmarkdbpass';
+GRANT SELECT ON hello_world.fortune TO 'benchmarkdbuser'@'localhost' IDENTIFIED BY 'benchmarkdbpass';
 
 INSERT INTO fortune (message) VALUES ('fortune: No such file or directory');
 INSERT INTO fortune (message) VALUES ('A computer scientist is someone who fixes things that aren''t broken.');

+ 9 - 5
frameworks/C++/ULib/README.md

@@ -1,6 +1,6 @@
 #ULib Benchmarking Test
 
-This is the ULib portion of a [benchmarking test suite](https://github.com/TechEmpower/FrameworkBenchmarks) comparing a variety of web development platforms.
+This is the [ULib](http://stefanocasazza.github.io/ULib/) portion of a [benchmarking test suite](https://github.com/TechEmpower/FrameworkBenchmarks) comparing a variety of web development platforms.
 
 ### JSON Encoding Test
 
@@ -8,19 +8,23 @@ This is the ULib portion of a [benchmarking test suite](https://github.com/TechE
 
 ### Data-Store/Database Mapping Test
 
-* [Database test source](src/db.usp)
+* [Database test source (SQL)](src/db.usp)
+* [Database test source (REDIS)](src/rdb.usp)
 
 ### Variable Query Test
 
-* [Variable Query test source](src/query.usp)
+* [Variable Query test source (SQL)](src/query.usp)
+* [Variable Query test source (REDIS)](src/rquery.usp)
 
 ### Fortune Query Test
 
-* [Fortune Query test source](src/fortune.usp)
+* [Fortune Query test source (SQL)](src/fortune.usp)
+* [Fortune Query test source (REDIS)](src/rfortune.usp)
 
 ### Variable Query (update) Test
 
-* [Variable Query (update) test source](src/update.usp)
+* [Variable Query (update) test source (SQL)](src/update.usp)
+* [Variable Query (update) test source (REDIS)](src/rupdate.usp)
 
 ### Plaintext Test
 

+ 22 - 1
frameworks/C++/ULib/benchmark_config.json

@@ -1,5 +1,5 @@
 {
-  "framework": "ULib",
+  "framework": "ulib",
   "tests": [{
     "default": {
       "setup_file": "setup_plaintext",
@@ -98,6 +98,27 @@
       "display_name": "ULib-sqlite",
       "notes": "",
       "versus": ""
+    },
+    "redis": {
+      "setup_file": "setup_redis",
+      "db_url": "/rdb",
+      "query_url": "/rquery?queries=",
+      "fortune_url": "/rfortune",
+      "update_url": "/rupdate?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "Redis",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "userver_tcp",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib-redis",
+      "notes": "",
+      "versus": ""
     }
   }]
 }

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

@@ -1,7 +1,11 @@
 #!/bin/bash
 
+fw_depends ulib
+
+let "MAX_THREADS = MAX_THREADS + MAX_THREADS / 2"
+
 # 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|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
@@ -9,4 +13,11 @@ sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" $IROOT
 # 2. Start ULib Server (userver_tcp)
 export UMEMPOOL="56,0,0,40,150,-24,-13,-20,0"
 
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 11 - 0
frameworks/C++/ULib/setup_mysql.sh

@@ -1,5 +1,9 @@
 #!/bin/bash
 
+fw_depends ulib
+
+let "MAX_THREADS = MAX_THREADS + MAX_THREADS / 2"
+
 # 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
@@ -11,4 +15,11 @@ 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"
 
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

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

@@ -1,5 +1,9 @@
 #!/bin/bash
 
+fw_depends ulib
+
+let "MAX_THREADS = MAX_THREADS + MAX_THREADS / 2"
+
 # 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
@@ -9,4 +13,11 @@ sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 8000|g" $IROO
 # 2. Start ULib Server (userver_tcp)
 export UMEMPOOL="982,0,0,36,9846,-24,-23,1727,1151"
 
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 9 - 0
frameworks/C++/ULib/setup_postgres.sh

@@ -1,5 +1,7 @@
 #!/bin/bash
 
+fw_depends ulib
+
 MAX_THREADS=$((2 * $MAX_THREADS))
 
 # 1. Change ULib Server (userver_tcp) configuration
@@ -13,4 +15,11 @@ 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"
 
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 24 - 0
frameworks/C++/ULib/setup_redis.sh

@@ -0,0 +1,24 @@
+#!/bin/bash
+
+fw_depends ulib
+
+let "MAX_THREADS = MAX_THREADS + MAX_THREADS / 2"
+
+# 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="146,0,0,90,150,-22,-12,-20,0"
+export REDIS_HOST=$DBHOST
+
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
+$IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

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

@@ -1,5 +1,9 @@
 #!/bin/bash
 
+fw_depends ulib
+
+let "MAX_THREADS = MAX_THREADS + MAX_THREADS / 2"
+
 # 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
@@ -11,4 +15,11 @@ export ORM_DRIVER="sqlite"
 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"
 
+# Never use setcap inside of TRAVIS 
+[ "$TRAVIS" != "true" ] || { \
+if [ `ulimit -r` -eq 99 ]; then
+	sudo setcap cap_sys_nice,cap_sys_resource,cap_net_bind_service,cap_net_raw+eip $IROOT/ULib/bin/userver_tcp
+fi
+}
+
 $IROOT/ULib/bin/userver_tcp -c $IROOT/ULib/benchmark.cfg &

+ 4 - 0
frameworks/C++/ULib/source_code

@@ -1,8 +1,12 @@
 ./src/db.usp
+./src/rdb.usp
 ./src/world.h
 ./src/json.usp
 ./src/fortune.h
 ./src/query.usp
+./src/rquery.usp
 ./src/update.usp
+./src/rupdate.usp
 ./src/fortune.usp
+./src/rfortune.usp
 ./src/plaintext.usp

+ 7 - 7
frameworks/C++/ULib/src/fortune.usp

@@ -6,7 +6,7 @@ TechEmpower Web Framework Benchmarks
 #include "fortune.h"
 
 static Fortune*           pfortune;
-static UString*           pmessage;
+static Fortune*           pfortune2add;
 static UString*           pencoded;
 static UOrmSession*       psql_fortune;
 static UOrmStatement*     pstmt_fortune;
@@ -30,9 +30,9 @@ static void usp_fork_fortune()
 
       pstmt_fortune->into(*pfortune);
 
-      pencoded  = U_NEW(UString(100U));
-      pmessage  = U_NEW(U_STRING_FROM_CONSTANT("Additional fortune added at request time."));
-      pvfortune = U_NEW(UVector<Fortune*>);
+      pencoded     = U_NEW(UString(100U));
+      pvfortune    = U_NEW(UVector<Fortune*>);
+      pfortune2add = U_NEW(Fortune(0, U_STRING_FROM_CONSTANT("Additional fortune added at request time.")));
       }
 }
 
@@ -45,11 +45,11 @@ static void usp_end_fortune()
       {
       delete pstmt_fortune;
 
+      delete pencoded;
       delete psql_fortune;
       delete pvfortune;
       delete pfortune;
-      delete pmessage;
-      delete pencoded;
+      delete pfortune2add;
       }
 }
 #endif
@@ -57,7 +57,7 @@ static void usp_end_fortune()
 <!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
 pstmt_fortune->execute();
 
-     pvfortune->push_back(U_NEW(Fortune(0, *pmessage)));
+     pvfortune->push_back(U_NEW(Fortune(*pfortune2add)));
 do { pvfortune->push_back(U_NEW(Fortune(*pfortune))); } while (pstmt_fortune->nextRow());
 
 pvfortune->sort(Fortune::cmp_obj);

+ 12 - 5
frameworks/C++/ULib/src/query.usp

@@ -53,9 +53,9 @@ static void usp_end_query()
       delete pvworld_query;
       delete  pworld_query;
 
-#   ifndef AS_cpoll_cppsp_DO
+#  ifndef AS_cpoll_cppsp_DO
       delete pvalue;
-#   endif
+#  endif
       }
 }
 #endif
@@ -67,10 +67,17 @@ queries;
 Content-Type: application/json; charset=UTF-8
 -->
 <!--#code
-int i = 0, num_queries = queries.strtol();
+int i = 0, num_queries;
+const char* ptr = queries.data();
 
-     if (num_queries <   1) num_queries = 1;
-else if (num_queries > 500) num_queries = 500;
+if (u__isdigit(*ptr) == false) num_queries = 1;
+else
+   {
+   num_queries = u_strtoul(ptr, queries.end());
+
+        if (num_queries <   1) num_queries = 1;
+   else if (num_queries > 500) num_queries = 500;
+   }
 
 #ifdef AS_cpoll_cppsp_DO
 USP_PUTS_CHAR('[');

+ 74 - 0
frameworks/C++/ULib/src/rdb.usp

@@ -0,0 +1,74 @@
+<!--#
+Test type 2: Single database query
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static World* pworld;
+static UREDISClient_Base* rc;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+#endif
+
+static void usp_fork_rdb()
+{
+   U_TRACE(5, "::usp_fork_rdb()")
+
+   rc = U_NEW(UREDISClient<UTCPSocket>);
+
+   if (rc->connect() == false)
+      {
+      U_WARNING("usp_fork_rdb(): %V", rc->UClient_Base::getResponse().rep);
+
+      return;
+      }
+
+   pworld = U_NEW(World);
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue = U_NEW(UValue(OBJECT_VALUE));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_rdb()
+{
+   U_TRACE(5, "::usp_end_rdb()")
+
+   delete rc;
+
+   if (pworld)
+      {
+      delete pworld;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json; charset=UTF-8
+-->
+<!--#code
+UStringRep* rep;
+
+u_put_unalignedp32(u_buffer,   U_MULTICHAR_CONSTANT32('w','o','r','l'));
+u_put_unalignedp16(u_buffer+4, U_MULTICHAR_CONSTANT16('d',':'));
+
+(void) rc->get(u_buffer, 6+u_num2str32(u_buffer+6, pworld->id = u_get_num_random(10000)));
+
+rep = rc->vitem[0].rep;
+
+pworld->randomNumber = u_strtoul(rep->data(), rep->end());
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PRINTF_ADD("{\"id\":%u,\"randomNumber\":%v}", pworld->id, rep);
+#else
+USP_JSON_stringify(*pvalue, World, *pworld);
+pvalue->clear();
+#endif
+-->

+ 73 - 0
frameworks/C++/ULib/src/rfortune.usp

@@ -0,0 +1,73 @@
+<!--#
+Test type 4: Fortunes
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "fortune.h"
+
+static UString* pencoded;
+static UREDISClient_Base* rc;
+static Fortune* pfortune2add;
+static UVector<Fortune*>* pvfortune;
+
+static void usp_fork_rfortune()
+{
+   U_TRACE(5, "::usp_fork_rfortune()")
+
+   rc = U_NEW(UREDISClient<UTCPSocket>);
+
+   if (rc->connect() == false)
+      {
+      U_WARNING("usp_fork_rfortune(): %V", rc->UClient_Base::getResponse().rep);
+
+      return;
+      }
+
+   pencoded     = U_NEW(UString(100U));
+   pvfortune    = U_NEW(UVector<Fortune*>);
+   pfortune2add = U_NEW(Fortune(0, U_STRING_FROM_CONSTANT("Additional fortune added at request time.")));
+}
+
+#ifdef DEBUG
+static void usp_end_rfortune()
+{
+   U_TRACE(5, "::usp_end_rfortune()")
+
+   delete rc;
+
+   if (pencoded)
+      {
+      delete pencoded;
+      delete pvfortune;
+      delete pfortune2add;
+      }
+}
+#endif
+-->
+<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><!--#code
+uint32_t i, n;
+
+(void) rc->lrange(U_CONSTANT_TO_PARAM("fortunes 0 -1"));
+
+pvfortune->push_back(U_NEW(Fortune(*pfortune2add)));
+
+for (i = 0, n = rc->vitem.size(); i < n; ++i) pvfortune->push_back(U_NEW(Fortune(i+1, rc->vitem[i])));
+
+pvfortune->sort(Fortune::cmp_obj);
+
+for (i = 0, ++n; i < n; ++i)
+   {
+   Fortune* elem = (*pvfortune)[i];
+
+   UXMLEscape::encode(elem->message, *pencoded);
+
+   USP_PRINTF_ADD(
+      "<tr>"
+      "<td>%u</td>"
+      "<td>%v</td>"
+      "</tr>",
+      elem->id, pencoded->rep);
+   }
+
+pvfortune->clear();
+--></table></body></html>

+ 118 - 0
frameworks/C++/ULib/src/rquery.usp

@@ -0,0 +1,118 @@
+<!--#
+Test type 3: Multiple database queries
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static UREDISClient_Base* rc;
+static UVector<World*>* pvworld;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+#endif
+
+static void usp_fork_rquery()
+{
+   U_TRACE(5, "::usp_fork_rquery()")
+
+   rc = U_NEW(UREDISClient<UTCPSocket>);
+
+   if (rc->connect() == false)
+      {
+      U_WARNING("usp_fork_rquery(): %V", rc->UClient_Base::getResponse().rep);
+
+      return;
+      }
+
+   pvworld = U_NEW(UVector<World*>(500));
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue = U_NEW(UValue(ARRAY_VALUE));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_rquery()
+{
+   U_TRACE(5, "::usp_end_rquery()")
+
+   delete rc;
+
+   if (pvworld)
+      {
+      delete pvworld;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+#  endif
+      }
+}
+#endif
+-->
+<!--#args
+queries;
+-->
+<!--#header
+Content-Type: application/json; charset=UTF-8
+-->
+<!--#code
+World* pworld;
+UStringRep* rep;
+int i, num_queries;
+char* pbuffer = u_buffer;
+const char* ptr = queries.data();
+
+if (u__isdigit(*ptr) == false) num_queries = 1;
+else
+   {
+   num_queries = u_strtoul(ptr, queries.end());
+
+        if (num_queries <   1) num_queries = 1;
+   else if (num_queries > 500) num_queries = 500;
+   }
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+for (i = 0; i < num_queries; ++i)
+   {
+   pvworld->push_back(pworld = U_NEW(World));
+
+   u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
+
+   pbuffer += 7+u_num2str32(pbuffer+7, pworld->id = u_get_num_random(10000));
+   }
+
+(void) rc->mget(u_buffer, pbuffer-u_buffer);
+
+i = 0;
+
+while (true)
+   {
+   pworld = pvworld->at(i);
+
+   rep = rc->vitem[i].rep;
+
+   pworld->randomNumber = u_strtoul(rep->data(), rep->end());
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PRINTF("{\"id\":%u,\"randomNumber\":%v}", pworld->id, rep);
+#endif
+
+   if (++i == num_queries) break;
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PUTS_CHAR(',');
+#endif
+   }
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR(']');
+#else
+USP_JSON_stringify(*pvalue, UVector<World*>, *pvworld);
+pvalue->clear();
+#endif
+pvworld->clear();
+-->

+ 122 - 0
frameworks/C++/ULib/src/rupdate.usp

@@ -0,0 +1,122 @@
+<!--#
+Test type 5: Database updates
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static UREDISClient_Base* rc;
+static UVector<World*>* pvworld;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+#endif
+
+static void usp_fork_rupdate()
+{
+   U_TRACE(5, "::usp_fork_rupdate()")
+
+   rc = U_NEW(UREDISClient<UTCPSocket>);
+
+   if (rc->connect() == false)
+      {
+      U_WARNING("usp_fork_rupdate(): %V", rc->UClient_Base::getResponse().rep);
+
+      return;
+      }
+
+   pvworld = U_NEW(UVector<World*>(500));
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue = U_NEW(UValue(ARRAY_VALUE));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_rupdate()
+{
+   U_TRACE(5, "::usp_end_rupdate()")
+
+   delete rc;
+
+   if (pvworld)
+      {
+      delete pvworld;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+#  endif
+      }
+}
+#endif
+-->
+<!--#args
+queries;
+-->
+<!--#header
+Content-Type: application/json; charset=UTF-8
+-->
+<!--#code
+World* pworld;
+int i, num_queries;
+char* pbuffer = u_buffer;
+const char* ptr = queries.data();
+
+if (u__isdigit(*ptr) == false) num_queries = 1;
+else
+   {
+   num_queries = u_strtoul(ptr, queries.end());
+
+        if (num_queries <   1) num_queries = 1;
+   else if (num_queries > 500) num_queries = 500;
+   }
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+for (i = 0; i < num_queries; ++i)
+   {
+   pvworld->push_back(pworld = U_NEW(World));
+
+   u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
+
+   pbuffer += 7+u_num2str32(pbuffer+7, pworld->id = u_get_num_random(10000));
+   }
+
+(void) rc->mget(u_buffer, pbuffer-u_buffer);
+
+i = 0;
+pbuffer = u_buffer;
+
+while (true)
+   {
+   pworld = pvworld->at(i);
+
+   u_put_unalignedp64(pbuffer, U_MULTICHAR_CONSTANT64(' ','w','o','r','l','d',':','\0'));
+
+   pbuffer += 7+u_num2str32(pbuffer+7, pworld->id);
+  *pbuffer  = ' ';
+   pbuffer += 1+u_num2str32(pbuffer+1, pworld->randomNumber = u_get_num_random(10000));
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld->id, pworld->randomNumber);
+#endif
+
+   if (++i == num_queries) break;
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PUTS_CHAR(',');
+#endif
+   }
+
+(void) rc->mset(u_buffer, pbuffer-u_buffer);
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR(']');
+#else
+USP_JSON_stringify(*pvalue, UVector<World*>, *pvworld);
+pvalue->clear();
+#endif
+pvworld->clear();
+-->

+ 10 - 3
frameworks/C++/ULib/src/update.usp

@@ -75,10 +75,17 @@ queries;
 Content-Type: application/json; charset=UTF-8
 -->
 <!--#code
-int i = 0, num_queries = queries.strtol();
+int i = 0, num_queries;
+const char* ptr = queries.data();
 
-     if (num_queries <   1) num_queries = 1;
-else if (num_queries > 500) num_queries = 500;
+if (u__isdigit(*ptr) == false) num_queries = 1;
+else
+   {
+   num_queries = u_strtoul(ptr, queries.end());
+
+        if (num_queries <   1) num_queries = 1;
+   else if (num_queries > 500) num_queries = 500;
+   }
 
 #ifdef AS_cpoll_cppsp_DO
 USP_PUTS_CHAR('[');

+ 0 - 21
frameworks/C++/cpoll_cppsp/install.sh

@@ -1,21 +0,0 @@
-#!/bin/bash
-
-RETCODE=$(fw_exists ${IROOT}/cppsp.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-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_untar cppsp_0.2.3.tar.xz
-
-# Using cp+rm over mv intentionally, because apparently this download
-# causes oddball issues when mv'ed around inside a folder mounted 
-# inside of VirtualBox (may have something to do with case-sensitive 
-# filesystems)
-cp -R cppsp_rel0.2.3/ ${IROOT}/cppsp_0.2.3
-rm -rf cppsp_rel0.2.3/
-
-sed -i 's|CXX := .*|CXX := g++-4.8|g' ${IROOT}/cppsp_0.2.3/makefile
-sed -i 's|-Wall|-w|g' ${IROOT}/cppsp_0.2.3/makefile
-
-touch ${IROOT}/cppsp.installed

+ 2 - 3
frameworks/C++/cpoll_cppsp/setup.sh

@@ -1,11 +1,10 @@
 #!/bin/bash
-export CPPSP_HOME=$IROOT/cppsp_0.2.3
 
 sed -i 's|#define BENCHMARK_DB_HOST ".*"|#define BENCHMARK_DB_HOST "'"$DBHOST"'"|g' www/connectioninfo.H
 
-export CPLUS_INCLUDE_PATH=/usr/include/postgresql:/usr/include/postgresql/9.3/server:$CPLUS_INCLUDE_PATH
+fw_depends cppsp
 
 make clean
 make
 cd $CPPSP_HOME
-./run_application $TROOT/www -g g++-4.8 -m /forcedynamic.cppsm &
+./run_application $TROOT/www -g g++-4.8 -m /forcedynamic.cppsm &

+ 3 - 2
frameworks/C++/silicon/CMakeLists.txt

@@ -2,9 +2,10 @@ cmake_minimum_required(VERSION 2.8)
 
 project(silicon)
 
-include_directories($ENV{IROOT}/include)
+include_directories($ENV{IROOT}/include $ENV{MICROHTTPD_HOME}/include)
+
+link_directories($ENV{IROOT}/lib $ENV{MICROHTTPD_HOME}/lib)
 
-link_directories($ENV{IROOT}/lib)
 add_definitions(-std=c++14  -ftemplate-depth=512 -DNDEBUG -O3)
 
 add_executable(silicon_tpc_mysql main.cc)

+ 0 - 20
frameworks/C++/silicon/install.sh

@@ -1,20 +0,0 @@
-#!/bin/bash
-
-# Install silicon
-DIR=`pwd`
-rm -fr silicon;
-git clone https://github.com/matt-42/silicon.git
-cd silicon;
-CXX=/usr/bin/g++-4.9 ./install.sh $IROOT
-
-# Install microhttpd
-cd $DIR
-fw_get -O http://mirror.ibcp.fr/pub/gnu/libmicrohttpd/libmicrohttpd-0.9.39.tar.gz
-fw_untar libmicrohttpd-0.9.39.tar.gz
-cd libmicrohttpd-0.9.39
-./configure --prefix=$IROOT
-make install
-
-cd $TROOT
-mkdir -p build
-cd build; cmake .. -DCMAKE_CXX_COMPILER=g++-4.9; make silicon_tpc_mysql; make silicon_epoll_mysql

+ 8 - 0
frameworks/C++/silicon/setup_epoll_mysql.sh

@@ -1,3 +1,11 @@
 #! /bin/bash
 
+fw_depends silicon microhttpd
+
+rm -rf build
+mkdir build
+cd build
+cmake .. -DCMAKE_CXX_COMPILER=g++-4.9
+make silicon_epoll_mysql
+
 $TROOT/build/silicon_epoll_mysql ${DBHOST} 8080 ${MAX_THREADS} &

+ 8 - 0
frameworks/C++/silicon/setup_tpc_mysql.sh

@@ -1,3 +1,11 @@
 #! /bin/bash
 
+fw_depends silicon microhttpd
+
+rm -rf build
+mkdir build
+cd build
+cmake .. -DCMAKE_CXX_COMPILER=g++-4.9
+make silicon_tpc_mysql
+
 $TROOT/build/silicon_tpc_mysql ${DBHOST} 8080 ${MAX_THREADS} &

+ 0 - 3
frameworks/C++/treefrog/install.sh

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

+ 3 - 1
frameworks/C++/treefrog/setup-thread.sh

@@ -3,6 +3,8 @@
 sed -i 's|HostName=.*|HostName='"$DBHOST"'|g' config/database.ini
 sed -i "s|MultiProcessingModule=.*|MultiProcessingModule=thread|g" config/application.ini
 
+fw_depends treefrog
+
 # 1. Generate Makefile
 qmake -r CONFIG+=release
 
@@ -14,4 +16,4 @@ make -j8
 rm -f log/*.log
 
 # 4. Start TreeFrog
-treefrog -d $TROOT &
+treefrog -d $TROOT &

+ 3 - 1
frameworks/C++/treefrog/setup.sh

@@ -3,6 +3,8 @@
 sed -i 's|HostName=.*|HostName='"$DBHOST"'|g' config/database.ini
 sed -i "s|MultiProcessingModule=.*|MultiProcessingModule=hybrid|g" config/application.ini
 
+fw_depends treefrog
+
 # 1. Generate Makefile
 qmake -r CONFIG+=release
 
@@ -14,4 +16,4 @@ make -j8
 rm -f log/*.log
 
 # 4. Start TreeFrog
-treefrog -d $TROOT &
+treefrog -d $TROOT &

+ 0 - 13
frameworks/C++/wt/install.sh

@@ -1,13 +0,0 @@
-#!/bin/bash
-
-export BOOST_ROOT=/usr/local
-export BOOST_INC=${BOOST_ROOT}/include
-export BOOST_LIB=${BOOST_ROOT}/lib
-
-export WT_ROOT=${IROOT}/wt
-export WT_LIB=${WT_ROOT}/lib
-export WT_INC=${WT_ROOT}/include
-
-export LD_LIBRARY_PATH="${BOOST_LIB}:${WT_LIB}:${LD_LIBRARY_PATH}"
-
-fw_depends apache wt

+ 2 - 11
frameworks/C++/wt/setup.sh

@@ -1,18 +1,9 @@
 #!/bin/bash
-export BOOST_ROOT=/usr/local
-export BOOST_INC=${BOOST_ROOT}/include
-export BOOST_LIB=${BOOST_ROOT}/lib
 
-export WT_ROOT=${IROOT}/wt
-export WT_LIB=${WT_ROOT}/lib
-export WT_INC=${WT_ROOT}/include
-
-# This has to be included here since it is one of the vars NOT copied from the original environment
-export LD_LIBRARY_PATH="${BOOST_LIB}:${WT_LIB}:${LD_LIBRARY_PATH}"
-export CPLUS_INCLUDE_PATH=/usr/include/postgresql:/usr/include/postgresql/9.3/server:$CPLUS_INCLUDE_PATH
+fw_depends apache wt
 
 sed -i 's|INSERT_DB_HOST_HERE|'"${DBHOST}"'|g' benchmark.cpp
 
 g++-4.8 -O3 -DNDEBUG -std=c++0x -L${BOOST_LIB} -I${BOOST_INC} -L${WT_LIB} -I${WT_INC} -o benchmark.wt benchmark.cpp -lwt -lwthttp -lwtdbo -lwtdbomysql -lboost_thread
 
-./benchmark.wt -c wt_config.xml -t ${MAX_THREADS} --docroot . --http-address 0.0.0.0 --http-port 8080 --accesslog=- --no-compression &
+./benchmark.wt -c wt_config.xml -t ${MAX_THREADS} --docroot . --http-address 0.0.0.0 --http-port 8080 --accesslog=- --no-compression &

+ 2 - 11
frameworks/C++/wt/setup_postgres.sh

@@ -1,18 +1,9 @@
 #!/bin/bash
-export BOOST_ROOT=/usr/local
-export BOOST_INC=${BOOST_ROOT}/include
-export BOOST_LIB=${BOOST_ROOT}/lib
 
-export WT_ROOT=${IROOT}/wt
-export WT_LIB=${WT_ROOT}/lib
-export WT_INC=${WT_ROOT}/include
-
-# This has to be included here since it is one of the vars NOT copied from the original environment
-export LD_LIBRARY_PATH="${BOOST_LIB}:${WT_LIB}:${LD_LIBRARY_PATH}"
-export CPLUS_INCLUDE_PATH=/usr/include/postgresql:/usr/include/postgresql/9.3/server:$CPLUS_INCLUDE_PATH
+fw_depends apache wt
 
 sed -i 's|INSERT_DB_HOST_HERE|'"${DBHOST}"'|g' benchmark.cpp
 
 g++-4.8 -O3 -DNDEBUG -DBENCHMARK_USE_POSTGRES -std=c++0x -L${BOOST_LIB} -I${BOOST_INC} -L${WT_LIB} -I${WT_INC} -o benchmark_postgres.wt benchmark.cpp -lwt -lwthttp -lwtdbo -lwtdbopostgres -lboost_thread
 
-./benchmark_postgres.wt -c wt_config.xml -t ${MAX_THREADS} --docroot . --http-address 0.0.0.0 --http-port 8080 --accesslog=- --no-compression &
+./benchmark_postgres.wt -c wt_config.xml -t ${MAX_THREADS} --docroot . --http-address 0.0.0.0 --http-port 8080 --accesslog=- --no-compression &

+ 0 - 14
frameworks/C/duda/install.sh

@@ -1,14 +0,0 @@
-#!/bin/bash
-
-RETCODE=$(fw_exists ${IROOT}/duda-0.23.installed)
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-git clone https://github.com/monkey/dudac.git
-
-cd dudac/
-
-./dudac -r
-./dudac -s
-
-cd ..
-touch ${IROOT}/duda-0.23.installed

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

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

+ 0 - 5
frameworks/C/haywire/install.sh

@@ -1,5 +0,0 @@
-#!/bin/bash
- 
-git clone https://github.com/kellabyte/Haywire.git
-cd $IROOT/Haywire
-./build.sh -c release

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

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

+ 0 - 20
frameworks/C/lwan/install.sh

@@ -1,20 +0,0 @@
-#!/bin/bash
-
-REV='49607addb31879e2aa2b701317773674662315aa'
-
-INSTALLED_FILE="${IROOT}/lwan-${REV}.installed"
-RETCODE=$(fw_exists ${INSTALLED_FILE})
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-[ ! -e ${INSTALLED_FILE} -a -d ${IROOT}/lwan ] && rm -rf ${IROOT}/lwan
-
-# Lwan is only built during installation as a dependency sanity check.
-git clone git://github.com/lpereira/lwan.git
-cd lwan
-git checkout ${REV}
-mkdir build
-cd build
-cmake .. -DCMAKE_BUILD_TYPE=Release
-make techempower
-
-touch ${INSTALLED_FILE}

+ 1 - 6
frameworks/C/lwan/setup-mysql.sh

@@ -6,12 +6,7 @@ export MYSQL_PASS=benchmarkdbpass
 export MYSQL_HOST=$DBHOST
 export MYSQL_DB=hello_world
 
-export LWAN_ROOT=${IROOT}/lwan
-export LWAN_BUILD=${LWAN_ROOT}/build
+fw_depends lwan
 
-rm -rf ${LWAN_BUILD}
-mkdir -p ${LWAN_BUILD}
-cd ${LWAN_BUILD}
-cmake ${LWAN_ROOT} -DCMAKE_BUILD_TYPE=Release && make techempower
 cd $LWAN_ROOT/techempower
 $LWAN_BUILD/techempower/techempower &

+ 1 - 6
frameworks/C/lwan/setup.sh

@@ -1,11 +1,6 @@
 #!/bin/bash
 
-export LWAN_ROOT=${IROOT}/lwan
-export LWAN_BUILD=${LWAN_ROOT}/build
+fw_depends lwan
 
-rm -rf ${LWAN_BUILD}
-mkdir -p ${LWAN_BUILD}
-cd ${LWAN_BUILD}
-cmake ${LWAN_ROOT} -DCMAKE_BUILD_TYPE=Release && make techempower
 cd $LWAN_ROOT/techempower
 $LWAN_BUILD/techempower/techempower &

+ 2 - 2
frameworks/C/onion/Makefile

@@ -13,14 +13,14 @@ clean:
 
 
 libonion_static.a: onion
-	(cd onion && mkdir -p build && cd build && cmake .. && cd src && make -j4)
+	(cd onion && mkdir -p build && cd build && cmake .. -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && make VERBOSE=1)
 	cp onion/build/src/onion/libonion_static.a .
 
 onion:
 	git clone --depth 1 https://github.com/davidmoreno/onion.git
 
 otemplate:
-	(cd onion/build/tools/otemplate/; make)
+	(cd onion/build/tools/otemplate/)
 
 base_html.c: otemplate base.html 
 	onion/build/tools/otemplate/otemplate base.html base_html.c

+ 1 - 1
frameworks/C/onion/hello.c

@@ -334,7 +334,7 @@ int main(void){
 			ONION_ERROR("Cant create db connection: %s", mysql_error(data.db[i]));
 			return 1;
 		}
-		if (mysql_real_connect(data.db[i], "localhost", 
+		if (mysql_real_connect(data.db[i], "127.0.0.1", 
                         "benchmarkdbuser", "benchmarkdbpass", "hello_world", 0, NULL, 0) == NULL) {
 			ONION_ERROR("Error %u: %s\n", mysql_errno(data.db[i]), mysql_error(data.db[i]));
 			return 1;

+ 0 - 3
frameworks/C/onion/install.sh

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

+ 4 - 2
frameworks/C/onion/setup.sh

@@ -1,9 +1,11 @@
 #!/bin/bash
 
-export ONION_LOG=noinfo
+fw_depends onion
+
+sed -i 's|127.0.0.1|'${DBHOST}'|g' hello.c
 
 make clean
 ln -s $IROOT/onion onion
 rm -f onion/build/CMakeCache.txt
 make
-./hello &
+./hello &

+ 4 - 4
frameworks/CSharp/HttpListener/benchmark_config.json

@@ -39,7 +39,7 @@
       "database_os": "Linux",
       "display_name": "http-listener",
       "notes": "",
-      "versus": "http-listener"
+      "versus": "httplistener"
     },
     "postgresql-raw": {
       "setup_file": "setup",
@@ -60,7 +60,7 @@
       "database_os": "Linux",
       "display_name": "http-listener",
       "notes": "",
-      "versus": "http-listener"
+      "versus": "httplistener"
     },
     "mongodb-raw": {
       "setup_file": "setup",
@@ -81,7 +81,7 @@
       "database_os": "Linux",
       "display_name": "http-listener",
       "notes": "",
-      "versus": "http-listener"
+      "versus": "httplistener"
     },
     "sqlserver-raw": {
       "setup_file": "setup",
@@ -102,7 +102,7 @@
       "database_os": "Windows",
       "display_name": "http-listener",
       "notes": "",
-      "versus": "http-listener"
+      "versus": "httplistener"
     }
   }]
 }

+ 0 - 3
frameworks/CSharp/aspnet/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends nginx mono xsp

+ 3 - 8
frameworks/CSharp/aspnet/setup_nginx.sh

@@ -1,11 +1,6 @@
 #!/bin/bash
 
-set -e
-
-# mono environment variables
-. ${IROOT}/mono.installed
-
-export NGINX_HOME=${IROOT}/nginx
+fw_depends nginx mono xsp
 
 sed -i 's|localhost|'"$DBHOST"'|g' src/Web.config
 
@@ -29,9 +24,9 @@ done
 conf+="}"
 echo -e $conf > $TROOT/nginx.upstream.conf
 
-$NGINX_HOME/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes ${MAX_THREADS};"
+nginx -c $TROOT/nginx.conf -g "worker_processes ${MAX_THREADS};"
 
 # To debug, use --printlog --verbose --loglevels=All
 for port in $(seq $port_start $port_end); do
-  fastcgi-mono-server4 --applications=/:${TROOT}/src --socket=tcp:127.0.0.1:$port &
+  fastcgi-mono-server4 --applications=/:$TROOT/src --socket=tcp:127.0.0.1:$port &
 done

+ 0 - 3
frameworks/CSharp/evhttp-sharp/install.sh

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

+ 1 - 4
frameworks/CSharp/evhttp-sharp/setup.sh

@@ -1,9 +1,6 @@
 #!/bin/bash
 
-set -e
-
-#mono environment variables
-. ${IROOT}/mono.installed
+fw_depends mono
 
 #extra cleaning
 rm -rf src/bin src/obj

+ 0 - 3
frameworks/CSharp/nancy/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends nginx xsp mono

+ 4 - 6
frameworks/CSharp/nancy/setup_nginx.sh

@@ -1,8 +1,6 @@
 #!/bin/bash
 
-export NGINX_HOME=${IROOT}/nginx
-
-. ${IROOT}/mono.installed
+fw_depends nginx xsp mono
 
 sed -i 's|localhost|'"${DBHOST}"'|g' src/Web.config
 sed -i 's|include /usr/local/nginx/conf/fastcgi_params;|include '"${NGINX_HOME}"'/conf/fastcgi_params;|g' nginx.conf
@@ -21,11 +19,11 @@ for port in $(seq ${port_start} $port_end); do
 done
 conf+="}"
 
-echo -e $conf > ${TROOT}/nginx.upstream.conf
-${NGINX_HOME}/sbin/nginx -c ${TROOT}/nginx.conf -g "worker_processes '"${MAX_THREADS}"';"
+echo -e $conf > $TROOT/nginx.upstream.conf
+${NGINX_HOME}/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes '"${MAX_THREADS}"';"
 
 # Start fastcgi for each thread
 # To debug, use --printlog --verbose --loglevels=All
 for port in $(seq ${port_start} $port_end); do
-  MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:${TROOT}/src --socket=tcp:127.0.0.1:$port &
+  MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:$TROOT/src --socket=tcp:127.0.0.1:$port &
 done

+ 0 - 33
frameworks/CSharp/nancy/setup_xsp.py

@@ -1,33 +0,0 @@
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  if os.name == 'nt':
-    return 1
-  
-  setup_util.replace_text("nancy/src/Web.config", "localhost", args.database_host)
-
-  try:
-    subprocess.check_call("rm -rf bin obj", shell=True, cwd="nancy/src", stderr=errfile, stdout=logfile)
-    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="nancy/src", stderr=errfile, stdout=logfile)
-    subprocess.Popen("MONO_OPTIONS=--gc=sgen xsp4 --nonstop", shell=True, cwd="nancy/src", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-
-def stop(logfile, errfile):
-  if os.name == 'nt':
-    return 0
-  
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'xsp4' in line:
-      pid = int(line.split(None, 2)[1])
-      try:
-        os.kill(pid, 15)
-      except OSError:
-        pass
-  return 0

+ 0 - 3
frameworks/CSharp/servicestack/install.sh

@@ -1,3 +0,0 @@
-#!/bin/bash
-
-fw_depends nginx xsp mono

+ 0 - 44
frameworks/CSharp/servicestack/setup_nginx.py

@@ -1,44 +0,0 @@
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  if os.name == 'nt':
-    return 1
-  
-  setup_util.replace_text("servicestack/src/Web.config", "localhost", args.database_host)
-
-  # build
-  subprocess.check_call("rm -rf bin obj", shell=True, cwd="servicestack", stderr=errfile, stdout=logfile)
-  subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="servicestack/src", stderr=errfile, stdout=logfile)
-  subprocess.check_call("sudo chown -R $USER:$USER $MONO_ROOT", shell=True, stderr=errfile, stdout=logfile)
-  
-  # nginx
-  workers = 'worker_processes ' + str(args.max_threads) + ';'
-  subprocess.check_call('echo "upstream mono {\n' + ';\n'.join('\tserver 127.0.0.1:' + str(port) for port in range(9001, 9001 + args.max_threads)) + ';\n}" > $TROOT/nginx.upstream.conf', shell=True, stderr=errfile, stdout=logfile);
-  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -g "' + workers + '"', shell=True, stderr=errfile, stdout=logfile)
-  
-  # Start fastcgi for each thread
-  # To debug, use --printlog --verbose --loglevels=All
-  for port in range(9001, 9001 + args.max_threads):
-    # subprocess.Popen("MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 /applications=/:. /socket=tcp:127.0.0.1:" + str(port) + " &", shell=True, cwd=app, stderr=errfile, stdout=logfile)
-    subprocess.Popen("MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:%s/src --socket=tcp:127.0.0.1:%s " % (args.directory, port), shell=True, cwd="servicestack", stderr=errfile, stdout=logfile)
-
-def stop(logfile, errfile):
-  if os.name == 'nt':
-    return 0
-  
-  # stop nginx
-  subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop", shell=True, stderr=errfile, stdout=logfile)
-
-  # stop mono
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'mono-server' in line and not 'run-ci' in line and not 'run-tests' in line:
-      pid = int(line.split(None, 2)[1])
-      os.kill(pid, 15)
-
-  return 0
-

+ 3 - 6
frameworks/CSharp/servicestack/setup_nginx.sh

@@ -1,10 +1,7 @@
 #!/bin/bash
 
-export NGINX_HOME=${IROOT}/nginx
+fw_depends nginx xsp mono
 
-set -e
-# mono environment variables
-. ${IROOT}/mono.installed
 sed -i 's|localhost|'"$DBHOST"'|g' src/Web.config
 sed -i 's|/usr/local/nginx/|'"${IROOT}"'/nginx/|g' nginx.conf
 
@@ -23,8 +20,8 @@ conf+="\tserver 127.0.0.1:${port};\n"
 done
 conf+="}"
 echo -e $conf > $TROOT/nginx.upstream.conf
-$NGINX_HOME/sbin/nginx -c $TROOT/nginx.conf -g "worker_processes ${MAX_THREADS};"
+nginx -c $TROOT/nginx.conf -g "worker_processes ${MAX_THREADS};"
 # To debug, use --printlog --verbose --loglevels=All
 for port in $(seq $port_start $port_end); do
-	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:${TROOT}/src --socket=tcp:127.0.0.1:$port &
+	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:$TROOT/src --socket=tcp:127.0.0.1:$port &
 done

+ 0 - 33
frameworks/CSharp/servicestack/setup_xsp.py

@@ -1,33 +0,0 @@
-import subprocess
-import sys
-import setup_util
-import os
-
-def start(args, logfile, errfile):
-  if os.name == 'nt':
-    return 1
-  
-  setup_util.replace_text("servicestack/src/Web.config", "localhost", args.database_host)
-
-  try:
-    subprocess.check_call("rm -rf bin obj", shell=True, cwd="servicestack/src", stderr=errfile, stdout=logfile)
-    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="servicestack/src", stderr=errfile, stdout=logfile)
-    subprocess.Popen("MONO_OPTIONS=--gc=sgen xsp4 --nonstop", shell=True, cwd="servicestack/src", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
-
-def stop(logfile, errfile):
-  if os.name == 'nt':
-    return 0
-  
-  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
-  out, err = p.communicate()
-  for line in out.splitlines():
-    if 'xsp4' in line:
-      pid = int(line.split(None, 2)[1])
-      try:
-        os.kill(pid, 15)
-      except OSError:
-        pass
-  return 0

+ 1 - 4
frameworks/CSharp/servicestack/setup_xsp.sh

@@ -1,10 +1,7 @@
 #!/bin/bash
 
-export NGINX_HOME=${IROOT}/nginx
+fw_depends nginx xsp mono
 
-set -e
-# mono environment variables
-. ${IROOT}/mono.installed
 sed -i 's|localhost|'"$DBHOST"'|g' src/Web.config
 # extra cleaning
 rm -rf src/bin src/obj

+ 0 - 3
frameworks/Clojure/aleph/install.sh

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

+ 2 - 4
frameworks/Clojure/aleph/setup.sh

@@ -1,10 +1,8 @@
 #!/bin/bash
 
-source $IROOT/java7.installed
-
-source $IROOT/lein.installed
+fw_depends java7 leiningen
 
 cd hello
 lein clean
 lein uberjar
-java -server -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -jar target/*-standalone.jar &
+java -server -Xmx2g -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -jar target/*-standalone.jar &

+ 0 - 3
frameworks/Clojure/compojure/install.sh

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

+ 2 - 13
frameworks/Clojure/compojure/setup.sh

@@ -1,10 +1,6 @@
 #!/bin/bash
 
-source $IROOT/java7.installed
-
-source $IROOT/lein.installed
-
-export RESIN_HOME=${IROOT}/resin-4.0.41
+fw_depends java7 resin leiningen
 
 sed -i 's|:subname "//.*:3306|:subname "//'"${DBHOST}"':3306|g' hello/src/hello/handler.clj
 
@@ -13,11 +9,4 @@ lein clean
 lein ring uberwar
 rm -rf $RESIN_HOME/webapps/*
 cp target/hello-compojure-standalone.war $RESIN_HOME/webapps/compojure.war
-
-$RESIN_HOME/bin/resinctl start
-
-# preform an initial request to warm up the server
-# initial requests were taking >15 seconds, causing fails in the tests
-echo "Sleeping, then executing an initial request to ensure server is in a responsive state"
-sleep 30
-curl -m 60 http://localhost:8080/compojure/ > /dev/null 2>&1
+resinctl start

+ 0 - 3
frameworks/Clojure/http-kit/install.sh

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

+ 2 - 4
frameworks/Clojure/http-kit/setup.sh

@@ -1,9 +1,7 @@
 #!/bin/bash
-source $IROOT/java7.installed
-source $IROOT/lein.installed
 
+fw_depends leiningen java7
 
-# Update db host in the source file
 sed -i 's|:subname "//.*:3306|:subname "//'"${DBHOST}"':3306|g' hello/src/hello/handler.clj
 
 cd hello
@@ -14,4 +12,4 @@ rm -rf target
 lein uberjar
 # -server is much faster
 # 'lein run' passes '-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' which make it starts fast, but runs slow
-java -server -jar target/http-kit-standalone.jar  &
+java -server -jar target/http-kit-standalone.jar  &

+ 0 - 3
frameworks/Clojure/luminus/install.sh

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

+ 2 - 2
frameworks/Clojure/luminus/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
-source $IROOT/java7.installed
-source $IROOT/lein.installed
+
+fw_depends java7 resin leiningen 
 
 # Update db host in the source file
 sed -i 's|:subname "//.*:3306|:subname "//'"${DBHOST}"':3306|g' hello/src/hello/db/core.clj

+ 0 - 3
frameworks/Clojure/pedestal/install.sh

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

+ 3 - 3
frameworks/Clojure/pedestal/setup.sh

@@ -1,8 +1,8 @@
 #!/bin/bash
 
-source $IROOT/java7.installed
+fw_depends java7 leiningen
 
-source $IROOT/lein.installed
+sed -i 's|127.0.0.1:3306|'${DBHOST}':3306|g' src/pedestal/service.clj
 
 lein clean
 
@@ -11,4 +11,4 @@ rm -rf target
 lein uberjar
 # -server is much faster
 # 'lein run' passes '-client -XX:+TieredCompilation -XX:TieredStopAtLevel=1' which make it starts fast, but runs slow
-java -server -jar target/pedestal-standalone.jar &
+java -server -jar target/pedestal-standalone.jar &

+ 1 - 1
frameworks/Clojure/pedestal/src/pedestal/service.clj

@@ -25,7 +25,7 @@
   (mysql {
     :classname "com.mysql.jdbc.Driver"
     :subprotocol "mysql"
-    :subname "//localhost:3306/hello_world"
+    :subname "//127.0.0.1:3306/hello_world"
     :user "benchmarkdbuser"
     :password "benchmarkdbpass"
     ;;OPTIONAL KEYS

+ 0 - 3
frameworks/Crystal/crystal-raw/install.sh

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

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

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

+ 2 - 1
frameworks/Crystal/moonshine/.gitignore

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

+ 0 - 4
frameworks/Crystal/moonshine/Projectfile

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

+ 29 - 6
frameworks/Crystal/moonshine/benchmark_config.json

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

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

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

+ 158 - 0
frameworks/Crystal/moonshine/server-postgres.cr

@@ -0,0 +1,158 @@
+require "moonshine"
+require "pg"
+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"
+
+DB = PG.connect("postgres://benchmarkdbuser:benchmarkdbpass@#{ENV["DBHOST"]? || "127.0.0.1"}/hello_world")
+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)
+  result = DB.exec({Int32, Int32}, "SELECT id, randomNumber FROM world WHERE id = $1", [id]).rows.first
+  {:id => result[0], :randomNumber => result[1]}
+end
+
+private def setWorld(world)
+  DB.exec("UPDATE world set randomNumber = $1 where id = $2", [world[:randomNumber], world[:id]])
+  world
+end
+
+private def fortunes
+  data = [] of  Hash(Symbol, (String | Int32))
+
+  DB.exec({Int32, String}, "select id, message from Fortune").rows.each do |row|
+    data.push({:id => row[0], :message => row[1]})
+  end
+  data
+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
+
+#
+# Postgres DatabaseTests
+#
+
+# Postgres Test 2: Single database query
+app.get "/db", do |request|
+  res = ok(randomWorld.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+# Postgres Test 3: Multiple database query
+app.get "/queries", do |request|
+  results = (1..sanitizedQueryCount(request)).map do
+    randomWorld
+  end
+
+  res = ok(results.to_json)
+  res.headers["Content-type"] = CONTENT::JSON
+  res
+end
+
+# Postgres Test 4: Fortunes
+app.get "/fortunes", do |request|
+  data = fortunes
+  
+  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
+
+# Postgres Test 5: Database Updates
+app.get "/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)

+ 15 - 10
frameworks/Crystal/moonshine/server.cr → frameworks/Crystal/moonshine/server-redis.cr

@@ -39,6 +39,15 @@ private def setWorld(world)
   world
 end
 
+private def fortunes
+  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
+  data
+end
+
 private def sanitizedQueryCount(request)
   begin
     queries = request.get["queries"].to_i
@@ -73,14 +82,14 @@ end
 #
 
 # Redis Test 2: Single database query
-app.get "/redis/db", do |request|
+app.get "/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|
+app.get "/queries", do |request|
   results = (1..sanitizedQueryCount(request)).map do
     randomWorld
   end
@@ -91,15 +100,11 @@ app.get "/redis/queries", do |request|
 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
+app.get "/fortunes", do |request|
+  data = fortunes
   
   additional_fortune = {
-    :id => 0
+    :id => 0,
     :message => "Additional fortune added at request time."
   }
   data.push(additional_fortune)
@@ -139,7 +144,7 @@ app.get "/redis/fortunes", do |request|
 end
 
 # Redis Test 5: Database Updates
-app.get "/redis/updates", do |request|
+app.get "/updates", do |request|
   updated = (1..sanitizedQueryCount(request)).map do
     world = randomWorld
     world[:randomNumber] = rand(1..ID_MAXIMUM)

+ 7 - 0
frameworks/Crystal/moonshine/setup-postgres.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+fw_depends crystal
+
+crystal deps install
+
+crystal server-postgres.cr &

+ 7 - 0
frameworks/Crystal/moonshine/setup-redis.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+fw_depends crystal
+
+crystal deps install
+
+crystal server-redis.cr &

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

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

+ 15 - 0
frameworks/Crystal/moonshine/shard.yml

@@ -0,0 +1,15 @@
+name: "moonshine"
+version: "0.0.1"
+
+dependencies:
+  pg:
+    github: "will/crystal-pg"
+    version: ">= 0.4.2"
+  moonshine:
+    github: "dhruvrajvanshi/Moonshine"
+    branch: master
+  redis:
+    github: "stefanwille/crystal-redis"
+    version: "~> 1.1.0"
+
+license: MIT

+ 1 - 1
frameworks/D/vibed/.gitignore

@@ -4,4 +4,4 @@ __dummy.html
 *.o
 *.obj
 *.dll
-*.exe
+*.exe

+ 1 - 1
frameworks/D/vibed/README.md

@@ -31,4 +31,4 @@ http://localhost:8080/db
 ### Variable Query Test
 
 MongoDB Raw:
-http://localhost:8080/queries?queries=5
+http://localhost:8080/queries?queries=5

+ 1 - 1
frameworks/D/vibed/benchmark_config.json

@@ -23,4 +23,4 @@
       "versus": "vibed"
     }
   }]
-}
+}

+ 1 - 1
frameworks/D/vibed/dub.json

@@ -7,4 +7,4 @@
     "vibe-d": "~>0.7.19"
   },
   "versions": ["VibeDefaultMain"]
-}
+}

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

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

+ 1 - 2
frameworks/D/vibed/setup.sh

@@ -1,7 +1,6 @@
 #!/bin/bash
 
-source $IROOT/dlang.installed
-source $IROOT/dub.installed
+fw_depends dlang dub
 
 sed -i 's|127.0.0.1|'"${DBHOST}"'|g' source/app.d
 

+ 1 - 1
frameworks/D/vibed/source/app.d

@@ -99,4 +99,4 @@ void queries(HTTPServerRequest req, HTTPServerResponse res)
 void plaintext(HTTPServerRequest req, HTTPServerResponse res)
 {
   res.writeBody("Hello, World!");
-}
+}

+ 1 - 1
frameworks/D/vibed/views/index.dt

@@ -16,4 +16,4 @@ html
       li
         a(href="/queries?queries=5") multiple queries
       li
-        a(href="/plaintext") plain text
+        a(href="/plaintext") plain text

+ 0 - 0
frameworks/Dart/dart-start/.gitignore → frameworks/Dart/dart-raw/.gitignore


+ 0 - 0
frameworks/Dart/dart/README.md → frameworks/Dart/dart-raw/README.md


+ 0 - 0
frameworks/Dart/dart/benchmark_config.json → frameworks/Dart/dart-raw/benchmark_config.json


+ 0 - 0
frameworks/Dart/dart-redstone/fortunes.mustache → frameworks/Dart/dart-raw/fortunes.mustache


+ 0 - 0
frameworks/Dart/dart-redstone/postgresql.yaml → frameworks/Dart/dart-raw/postgresql.yaml


+ 0 - 0
frameworks/Dart/dart/pubspec.yaml → frameworks/Dart/dart-raw/pubspec.yaml


+ 0 - 0
frameworks/Dart/dart/server.dart → frameworks/Dart/dart-raw/server.dart


+ 9 - 0
frameworks/Dart/dart-raw/setup.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+sed -i 's|host: .*|host: '"${DBHOST}"'|g' postgresql.yaml
+
+fw_depends dart
+
+pub upgrade
+
+dart server.dart -a 0.0.0.0 -p 8080 -d ${MAX_CONCURRENCY} -i ${MAX_THREADS} &

+ 0 - 0
frameworks/Dart/dart/source_code → frameworks/Dart/dart-raw/source_code


+ 0 - 3
frameworks/Dart/dart-redstone/install.sh

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

+ 0 - 10
frameworks/Dart/dart-redstone/setup.sh

@@ -1,10 +0,0 @@
-#!/bin/bash
-export DART_HOME=$IROOT/dart-sdk
-export PUB_CACHE=$IROOT/.pubcache
-
-sed -i 's|host: .*|host: '"${DBHOST}"'|g' postgresql.yaml
-sed -i 's|host: .*|host: '"${DBHOST}"'|g' mongodb.yaml
-
-$DART_HOME/bin/pub upgrade
-
-$DART_HOME/bin/dart server.dart -a 0.0.0.0 -p 8080 -d ${MAX_THREADS} -i ${MAX_THREADS} &

+ 0 - 3
frameworks/Dart/dart-start/install.sh

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

+ 0 - 3
frameworks/Dart/dart-stream/install.sh

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

+ 0 - 3
frameworks/Dart/dart/install.sh

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

+ 0 - 11
frameworks/Dart/dart/setup.sh

@@ -1,11 +0,0 @@
-#!/bin/bash
-
-sed -i 's|host: .*|host: '"${DBHOST}"'|g' postgresql.yaml
-
-export DART_HOME=$IROOT/dart-sdk
-
-export PUB_CACHE=$IROOT/.pubcache
-
-$DART_HOME/bin/pub upgrade
-
-$DART_HOME/bin/dart server.dart -a 0.0.0.0 -p 8080 -d ${MAX_THREADS} -i ${MAX_THREADS} &

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