Browse Source

Merge pull request #1 from TechEmpower/master

Merging latest commits from base repository
Sanjoy Dey 9 years ago
parent
commit
b80961c900
100 changed files with 2223 additions and 1018 deletions
  1. 4 0
      .gitignore
  2. 105 50
      .travis.yml
  3. 1 1
      README.md
  4. 2 1
      benchmark.cfg.example
  5. 31 31
      config/benchmark_profile
  6. 2 0
      config/create-redis.sh
  7. 4 4
      config/create.sql
  8. 2 2
      config/php.ini
  9. 7 2
      config/postgresql.conf
  10. 4 0
      config/travis_mysql_setup.sh
  11. 151 0
      config/travis_setup.sh
  12. 24 13
      deployment/vagrant-common/bootstrap.sh
  13. 1 1
      deployment/vagrant-common/custom_motd.sh
  14. 2 2
      deployment/vagrant-development/README.md
  15. 1 0
      deployment/vagrant-development/Vagrantfile
  16. 1 1
      deployment/vagrant-production/README.md
  17. 0 107
      frameworks/C++/ULib/README.md
  18. 0 86
      frameworks/C++/ULib/benchmark_config.json
  19. 0 108
      frameworks/C++/ULib/install.sh
  20. 0 13
      frameworks/C++/ULib/setup.sh
  21. 0 16
      frameworks/C++/ULib/setup_mysql.sh
  22. 0 12
      frameworks/C++/ULib/setup_postgres.sh
  23. 0 16
      frameworks/C++/ULib/setup_sqlite.sh
  24. 0 8
      frameworks/C++/ULib/source_code
  25. 0 78
      frameworks/C++/ULib/src/fortune.usp
  26. 0 105
      frameworks/C++/ULib/src/query.usp
  27. 2 0
      frameworks/C++/cpoll_cppsp/.gitignore
  28. 0 21
      frameworks/C++/cpoll_cppsp/install.sh
  29. 2 3
      frameworks/C++/cpoll_cppsp/setup.sh
  30. 1 0
      frameworks/C++/ffead-cpp/.gitignore
  31. 29 0
      frameworks/C++/ffead-cpp/benchmark_config.json
  32. 12 0
      frameworks/C++/ffead-cpp/setup.sh
  33. 1 0
      frameworks/C++/poco/.gitignore
  34. 78 0
      frameworks/C++/poco/benchmark.cpp
  35. 24 0
      frameworks/C++/poco/benchmark_config.json
  36. 7 0
      frameworks/C++/poco/setup.sh
  37. 1 0
      frameworks/C++/silicon/.gitignore
  38. 9 5
      frameworks/C++/silicon/CMakeLists.txt
  39. 28 4
      frameworks/C++/silicon/benchmark_config.json
  40. 0 20
      frameworks/C++/silicon/install.sh
  41. 0 137
      frameworks/C++/silicon/main.cc
  42. 0 3
      frameworks/C++/silicon/setup_epoll_mysql.sh
  43. 11 0
      frameworks/C++/silicon/setup_lwan_mysql.sh
  44. 11 0
      frameworks/C++/silicon/setup_mhd_epoll_mysql.sh
  45. 11 0
      frameworks/C++/silicon/setup_mhd_tpc_mysql.sh
  46. 0 3
      frameworks/C++/silicon/setup_tpc_mysql.sh
  47. 103 0
      frameworks/C++/silicon/techempower.hh
  48. 41 0
      frameworks/C++/silicon/techempower_lwan.cc
  49. 48 0
      frameworks/C++/silicon/techempower_microhttpd.cc
  50. 0 35
      frameworks/C++/treefrog/controllers/applicationcontroller.cpp
  51. 0 2
      frameworks/C++/treefrog/controllers/applicationcontroller.h
  52. 1 1
      frameworks/C++/treefrog/controllers/controllers.pro
  53. 1 3
      frameworks/C++/treefrog/controllers/jsoncontroller.cpp
  54. 11 9
      frameworks/C++/treefrog/controllers/worldcontroller.cpp
  55. 1 0
      frameworks/C++/treefrog/controllers/worldcontroller.h
  56. 1 1
      frameworks/C++/treefrog/helpers/helpers.pro
  57. 0 3
      frameworks/C++/treefrog/install.sh
  58. 1 1
      frameworks/C++/treefrog/models/models.pro
  59. 3 1
      frameworks/C++/treefrog/setup-thread.sh
  60. 3 1
      frameworks/C++/treefrog/setup.sh
  61. 1 1
      frameworks/C++/treefrog/views/_src/_src.pro
  62. 115 0
      frameworks/C++/ulib/README.md
  63. 124 0
      frameworks/C++/ulib/benchmark_config.json
  64. 28 0
      frameworks/C++/ulib/setup_json.sh
  65. 29 0
      frameworks/C++/ulib/setup_mongodb.sh
  66. 30 0
      frameworks/C++/ulib/setup_mysql.sh
  67. 28 0
      frameworks/C++/ulib/setup_plaintext.sh
  68. 25 0
      frameworks/C++/ulib/setup_postgres.sh
  69. 29 0
      frameworks/C++/ulib/setup_redis.sh
  70. 30 0
      frameworks/C++/ulib/setup_sqlite.sh
  71. 16 0
      frameworks/C++/ulib/source_code
  72. 2 2
      frameworks/C++/ulib/src/db.usp
  73. 0 0
      frameworks/C++/ulib/src/fortune.h
  74. 80 0
      frameworks/C++/ulib/src/fortune.usp
  75. 1 1
      frameworks/C++/ulib/src/json.usp
  76. 81 0
      frameworks/C++/ulib/src/mdb.usp
  77. 89 0
      frameworks/C++/ulib/src/mfortune.usp
  78. 105 0
      frameworks/C++/ulib/src/mquery.usp
  79. 99 0
      frameworks/C++/ulib/src/mupdate.usp
  80. 0 0
      frameworks/C++/ulib/src/plaintext.usp
  81. 98 0
      frameworks/C++/ulib/src/query.usp
  82. 73 0
      frameworks/C++/ulib/src/rdb.usp
  83. 73 0
      frameworks/C++/ulib/src/rfortune.usp
  84. 105 0
      frameworks/C++/ulib/src/rquery.usp
  85. 109 0
      frameworks/C++/ulib/src/rupdate.usp
  86. 18 24
      frameworks/C++/ulib/src/update.usp
  87. 0 0
      frameworks/C++/ulib/src/world.h
  88. 2 0
      frameworks/C++/wt/.gitignore
  89. 0 13
      frameworks/C++/wt/install.sh
  90. 2 11
      frameworks/C++/wt/setup.sh
  91. 2 11
      frameworks/C++/wt/setup_postgres.sh
  92. 3 1
      frameworks/C/duda/.gitignore
  93. 0 15
      frameworks/C/duda/install.sh
  94. 2 3
      frameworks/C/duda/setup.sh
  95. 0 5
      frameworks/C/haywire/install.sh
  96. 3 1
      frameworks/C/haywire/setup.sh
  97. 8 0
      frameworks/C/libreactor/README.md
  98. 23 0
      frameworks/C/libreactor/benchmark_config.json
  99. 7 0
      frameworks/C/libreactor/setup.sh
  100. 0 20
      frameworks/C/lwan/install.sh

+ 4 - 0
.gitignore

@@ -79,3 +79,7 @@ frameworks/Ur/urweb/*.exe
 
 # nim
 nimcache
+
+# crystal
+.crystal
+*.out

+ 105 - 50
.travis.yml

@@ -1,52 +1,68 @@
+sudo: required
+dist: trusty
 language: python
-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
+    #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
+    #Here's the bash if you need to update this. Be sure to maintain the
+    #lines that are currently commented out (these cannot run in Travis)
+    #  cd frameworks
+    #  find . -type d -depth 2 | sed 's|./|    - "TESTDIR=|' | sed 's/$/"/g'
     #
-    # Here's the bash if you need to update this. Be sure to maintain the 
-    # lines that are currently commented out (these cannot run in Travis)
-    #   cd frameworks 
-    #   find . -type d -depth 2 | sed 's|./|    - "TESTDIR=|' | sed 's/$/"/g'
     #
-    #  
+    - "TESTDIR=C/libreactor"
     - "TESTDIR=C/lwan"
     - "TESTDIR=C/duda"
     - "TESTDIR=C/haywire"
     - "TESTDIR=C/onion"
     - "TESTDIR=CSharp/aspnet"
-    # - "TESTDIR=CSharp/aspnet-stripped"
+    ## - "TESTDIR=CSharp/aspnet-stripped"
     - "TESTDIR=CSharp/evhttp-sharp"
-    # - "TESTDIR=CSharp/HttpListener"
+    ## - "TESTDIR=CSharp/HttpListener"
     - "TESTDIR=CSharp/nancy"
+    - "TESTDIR=CSharp/revenj"
     - "TESTDIR=CSharp/servicestack"
     - "TESTDIR=C++/cpoll_cppsp"
     - "TESTDIR=C++/silicon"
     - "TESTDIR=C++/treefrog"
-    - "TESTDIR=C++/ULib"
+    - "TESTDIR=C++/ulib"
     - "TESTDIR=C++/wt"
+    - "TESTDIR=C++/ffead-cpp"
+    - "TESTDIR=C++/poco"
     - "TESTDIR=Clojure/compojure"
     - "TESTDIR=Clojure/http-kit"
     - "TESTDIR=Clojure/luminus"
     - "TESTDIR=Clojure/pedestal"
-    - "TESTDIR=Dart/dart"
-    - "TESTDIR=Dart/dart-redstone"
-    - "TESTDIR=Dart/dart-start"
-    - "TESTDIR=Dart/dart-stream"
+    - "TESTDIR=Clojure/aleph"
+    - "TESTDIR=Crystal/crystal-raw"
+    - "TESTDIR=Crystal/moonshine"
+    - "TESTDIR=Crystal/kemal"
+    - "TESTDIR=D/vibed"
+    - "TESTDIR=Dart/dart-raw"
+    - "TESTDIR=Dart/redstone"
+    - "TESTDIR=Dart/start"
+    - "TESTDIR=Dart/stream"
     - "TESTDIR=Elixir/phoenix"
+    - "TESTDIR=Elixir/cowboy"
+    - "TESTDIR=Erlang/chicagoboss"
     - "TESTDIR=Erlang/cowboy"
     - "TESTDIR=Erlang/elli"
+    - "TESTDIR=Erlang/mochiweb"
+    - "TESTDIR=Erlang/misultin"
     - "TESTDIR=Go/beego"
     - "TESTDIR=Go/falcore"
+    - "TESTDIR=Go/fasthttp-mysql"
+    - "TESTDIR=Go/fasthttp-postgresql"
     - "TESTDIR=Go/gin"
-    - "TESTDIR=Go/go"
     - "TESTDIR=Go/goji"
-    - "TESTDIR=Go/go-mongodb"
+    - "TESTDIR=Go/go-std-mongodb"
+    - "TESTDIR=Go/go-std-mysql"
+    - "TESTDIR=Go/go-std-postgresql"
     - "TESTDIR=Go/revel"
     - "TESTDIR=Go/revel-jet"
     - "TESTDIR=Go/revel-qbs"
@@ -55,20 +71,31 @@ env:
     - "TESTDIR=Haskell/snap"
     - "TESTDIR=Haskell/wai"
     - "TESTDIR=Haskell/yesod"
+    - "TESTDIR=Haskell/spock"
     - "TESTDIR=Java/activeweb"
+    - "TESTDIR=Java/baratine"
+    - "TESTDIR=Java/bayou"
+    - "TESTDIR=Java/comsat-servlet"
+    - "TESTDIR=Java/comsat-webactors"
     - "TESTDIR=Java/curacao"
     - "TESTDIR=Java/dropwizard"
-    - "TESTDIR=Java/dropwizard-mongodb"
     - "TESTDIR=Java/gemini"
     - "TESTDIR=Java/grizzly-bm"
     - "TESTDIR=Java/grizzly-jersey"
+    - "TESTDIR=Java/jawn"
     - "TESTDIR=Java/jetty-servlet"
+    - "TESTDIR=Java/jetty"
+    - "TESTDIR=Java/jooby"
     - "TESTDIR=Java/netty"
     - "TESTDIR=Java/ninja-standalone"
+    - "TESTDIR=Java/officefloor"
+    - "TESTDIR=Java/permeagility"
     - "TESTDIR=Java/play1"
     - "TESTDIR=Java/play1siena"
     - "TESTDIR=Java/play2-java"
+    - "TESTDIR=Java/rapidoid"
     - "TESTDIR=Java/restexpress"
+    - "TESTDIR=Java/revenj"
     - "TESTDIR=Java/servlet"
     - "TESTDIR=Java/servlet3-cass"
     - "TESTDIR=Java/spark"
@@ -77,8 +104,12 @@ env:
     - "TESTDIR=Java/tapestry"
     - "TESTDIR=Java/undertow"
     - "TESTDIR=Java/undertow-edge"
+    - "TESTDIR=Java/undertow-jersey-c3p0"
+    - "TESTDIR=Java/undertow-jersey-hikaricp"
     - "TESTDIR=Java/vertx"
+    - "TESTDIR=Java/vertx-web"
     - "TESTDIR=Java/wicket"
+    - "TESTDIR=Java/beyondj"
     - "TESTDIR=Java/wildfly-ee7"
     - "TESTDIR=JavaScript/express"
     - "TESTDIR=JavaScript/hapi"
@@ -86,6 +117,7 @@ env:
     - "TESTDIR=JavaScript/nodejs"
     - "TESTDIR=JavaScript/ringojs"
     - "TESTDIR=JavaScript/ringojs-convenient"
+    - "TESTDIR=JavaScript/sailsjs"
     - "TESTDIR=Lua/lapis"
     - "TESTDIR=Lua/openresty"
     - "TESTDIR=Nim/jester"
@@ -100,33 +132,36 @@ env:
     - "TESTDIR=PHP/php"
     - "TESTDIR=PHP/cygnite-php-framework"
     - "TESTDIR=PHP/codeigniter"
-    - "TESTDIR=PHP/php-fatfree"
+    - "TESTDIR=PHP/clancats"
+    - "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/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/lumen"
+    - "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/API-Hour"
+    - "TESTDIR=Python/asyncio"
     - "TESTDIR=Python/bottle"
     - "TESTDIR=Python/cherrypy"
     - "TESTDIR=Python/django"
     - "TESTDIR=Python/falcon"
     - "TESTDIR=Python/flask"
+    - "TESTDIR=Python/historical"
     - "TESTDIR=Python/klein"
     - "TESTDIR=Python/pyramid"
     - "TESTDIR=Python/tornado"
@@ -143,7 +178,14 @@ env:
     - "TESTDIR=Ruby/rails"
     - "TESTDIR=Ruby/rails-stripped"
     - "TESTDIR=Ruby/sinatra"
+    - "TESTDIR=Ruby/sinatra-sequel"
+    - "TESTDIR=Rust/iron"
+    - "TESTDIR=Rust/nickel"
+    - "TESTDIR=Rust/hyper"
+    - "TESTDIR=Scala/akka-http"
+    - "TESTDIR=Scala/colossus"
     - "TESTDIR=Scala/finagle"
+    - "TESTDIR=Scala/fintrospect"
     - "TESTDIR=Scala/lift-stateless"
     - "TESTDIR=Scala/plain"
     - "TESTDIR=Scala/play2-scala"
@@ -153,27 +195,40 @@ env:
     - "TESTDIR=Scala/spray-es"
     - "TESTDIR=Scala/unfiltered"
     - "TESTDIR=Scala/http4s"
+    - "TESTDIR=Scala/finch"
     - "TESTDIR=Ur/urweb"
 
 before_install:
-  # Need to install python modules before using 
-  # python
-  - pip install -r requirements.txt
+  - pip install colorama==0.3.1
+  # Version 2.3 has a nice Counter() and other features
+  # but it requires —-allow-external and -—allow-unverified
+  - pip install progressbar==2.2
+  - pip install requests
+  - echo "127.0.0.1 " `hostname` | sudo tee /etc/hosts
+  - echo "127.0.0.1 localhost" | sudo tee /etc/hosts
 
-  # Configure Travis-CI build environment for TFB
-  #   e.g. setup databases, users, etc
-  - ./toolset/run-ci.py cisetup "$TESTDIR"
+services:
+  - postgresql
+  - redis-server
 
 addons:
-  postgresql: "9.3" 
+  postgresql: "9.3"
+  apt:
+    packages:
+      - mysql-server
+      - redis-server
+
+before_script:
+  - sudo sysctl -w net.core.somaxconn=65535
+  - sudo ./config/travis_mysql_setup.sh
+  - mysql -uroot < config/create.sql
+  - sudo ./config/create-redis.sh
 
-install:
-  # Install prerequisites
-  - ./toolset/run-ci.py prereq "$TESTDIR"
-  
-  # Install software for this framework  
-  - ./toolset/run-ci.py install "$TESTDIR"
-   
-script: 
+script:
   # Pick one test in this directory and verify
   - time ./toolset/run-ci.py verify "$TESTDIR"
+
+cache:
+  directories:
+    - $HOME/.m2/repository
+    - $HOME/.cache/pip

+ 1 - 1
README.md

@@ -74,4 +74,4 @@ can be found in the [TFB documentation](http://frameworkbenchmarks.readthedocs.o
 
 Join in the conversation at our 
 [Google Group](https://groups.google.com/forum/?fromgroups=#!forum/framework-benchmarks), 
-or chat with us on [Freenode](https://freenode.net/faq.shtml#whatwhy) at `#techempower-fwbm`. 
+or chat with us on [Freenode](https://webchat.freenode.net/) at `#techempower-fwbm`. 

+ 2 - 1
benchmark.cfg.example

@@ -20,7 +20,6 @@ concurrency_levels=[8, 16, 32, 64, 128, 256]
 query_levels=[1, 5,10,15,20]
 threads=8
 mode=benchmark
-name=ec2
 os=linux
 password_prompt=False
 server_host=127.0.0.1
@@ -28,3 +27,5 @@ sleep=60
 test=None
 type=all
 verbose=True
+clean=False
+clean_all=False

+ 31 - 31
config/benchmark_profile

@@ -17,34 +17,34 @@ export TFB_DISTRIB_RELEASE=$DISTRIB_RELEASE
 export TFB_DISTRIB_CODENAME=$DISTRIB_CODENAME
 export TFB_DISTRIB_DESCRIPTION=$DISTRIB_DESCRIPTION
 
-
-export RESIN_HOME=${IROOT}/resin-4.0.41
-export GRAILS_HOME=${IROOT}/grails-2.4.4
-export VERTX_HOME=${IROOT}/vert.x-2.1.1
-export TOMCAT_HOME=${IROOT}/apache-tomcat-7.0.35
-export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
-export PLAY_HOME=${IROOT}/play-2.2.0
-export PLAY1_HOME=${IROOT}/play-1.2.5
-export MAVEN_HOME=${IROOT}/apache-maven-3.0.5
-export SBT_HOME=${IROOT}/sbt
-export PERL_HOME=${IROOT}/perl-5.18
-export DART_HOME=${IROOT}/dart-sdk
-export RACKET_HOME=${IROOT}/racket-5.3.6
-export NIMROD_HOME=${IROOT}/nimrod
-export NGINX_HOME=/usr/local/nginx
-export ELIXIR_HOME=${IROOT}/elixir-0.13.3
-
-export PATH="$JAVA_HOME/bin:$GRAILS_HOME/bin:$PLAY_HOME:$PLAY1_HOME:$VERTX_HOME/bin:$GOROOT/bin:$NODE_HOME/bin:$HOME/FrameworkBenchmarks/installs/bin:$MAVEN_HOME/bin:$SBT_HOME/bin:$PERL_HOME/bin:$DART_HOME/bin:$RACKET_HOME/bin:$NIMROD_HOME/bin:$NGINX_HOME/sbin:$ELIXIR_HOME/bin:$PATH"
-
-export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
-
-export TFB_SERVER_HOST='127.0.0.1'
-export TFB_CLIENT_HOST='127.0.0.1'
-export TFB_CLIENT_USER='tfb'
-export TFB_CLIENT_IDENTITY_FILE='/home/tfb/.ssh/id_rsa'
-export TFB_DATABASE_HOST='127.0.0.1'
-
-[ -e ~/.rvm ] && . ~/.rvm/scripts/'rvm'
-export LC_ALL='en_US.UTF-8'
-export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
-export MAKEFLAGS="-j $NUMCPUS -l $NUMCPUS"
+#
+#export RESIN_HOME=${IROOT}/resin-4.0.41
+#export GRAILS_HOME=${IROOT}/grails-2.4.4
+#export VERTX_HOME=${IROOT}/vert.x-2.1.1
+#export TOMCAT_HOME=${IROOT}/apache-tomcat-7.0.35
+#export NODE_HOME=${IROOT}/node-v0.10.8-linux-x64
+#export PLAY_HOME=${IROOT}/play-2.2.0
+#export PLAY1_HOME=${IROOT}/play-1.2.5
+#export MAVEN_HOME=${IROOT}/apache-maven-3.0.5
+#export SBT_HOME=${IROOT}/sbt
+#export PERL_HOME=${IROOT}/perl-5.18
+#export DART_HOME=${IROOT}/dart-sdk
+#export RACKET_HOME=${IROOT}/racket-5.3.6
+#export NIMROD_HOME=${IROOT}/nimrod
+#export NGINX_HOME=/usr/local/nginx
+#export ELIXIR_HOME=${IROOT}/elixir-0.13.3
+#
+#export PATH="$JAVA_HOME/bin:$GRAILS_HOME/bin:$PLAY_HOME:$PLAY1_HOME:$VERTX_HOME/bin:$GOROOT/bin:$NODE_HOME/bin:$HOME/FrameworkBenchmarks/installs/bin:$MAVEN_HOME/bin:$SBT_HOME/bin:$PERL_HOME/bin:$DART_HOME/bin:$RACKET_HOME/bin:$NIMROD_HOME/bin:$NGINX_HOME/sbin:$ELIXIR_HOME/bin:$PATH"
+#
+#export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
+#
+#export TFB_SERVER_HOST='127.0.0.1'
+#export TFB_CLIENT_HOST='127.0.0.1'
+#export TFB_CLIENT_USER='tfb'
+#export TFB_CLIENT_IDENTITY_FILE='/home/tfb/.ssh/id_rsa'
+#export TFB_DATABASE_HOST='127.0.0.1'
+#
+#[ -e ~/.rvm ] && . ~/.rvm/scripts/'rvm'
+#export LC_ALL='en_US.UTF-8'
+#export NUMCPUS=`grep -c '^processor' /proc/cpuinfo`
+#export MAKEFLAGS="-j $NUMCPUS -l $NUMCPUS"

+ 2 - 0
config/create-redis.sh

@@ -1,3 +1,5 @@
+#!/bin/bash
+
 RANGE=10000
 for i in {1..10000}
 do

+ 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.');

+ 2 - 2
config/php.ini

@@ -869,8 +869,8 @@ default_socket_timeout = 60
 zend_extension=opcache.so
 extension=redis.so
 extension=phalcon.so
-extension=yaf.so
-extension=mongo.so
+;extension=yaf.so
+extension=mongodb.so
 ;extension=php_bz2.dll
 ;extension=php_curl.dll
 ;extension=php_fileinfo.dll

+ 7 - 2
config/postgresql.conf

@@ -109,7 +109,7 @@ ssl = false                             # (change requires restart)
 # details: http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html
 # http://www.postgresql.org/docs/9.4/static/runtime-config-wal.html
 # http://www.postgresql.org/docs/9.4/static/runtime-config-query.html
-shared_buffers = 2GB                    # min 128kB
+shared_buffers = 256MB                    # min 128kB
 work_mem = 64MB                                # min 64kB
 maintenance_work_mem = 512MB            # min 1MB
 checkpoint_segments = 64
@@ -166,7 +166,12 @@ random_page_cost = 2
 #wal_level = minimal			# minimal, archive, or hot_standby
 					# (change requires restart)
 #fsync = on				# turns forced synchronization on or off
-#synchronous_commit = on		# synchronization level; on, off, or local
+
+# WARNING: disabling synchronous commit may be dangerous in certain cases.
+# See http://www.postgresql.org/docs/current/static/runtime-config-wal.html
+# for details.
+synchronous_commit = off
+
 #wal_sync_method = fsync		# the default is the first option
 					# supported by the operating system:
 					#   open_datasync

+ 4 - 0
config/travis_mysql_setup.sh

@@ -0,0 +1,4 @@
+sed -i 's|\[mysqld\]|\[mysqld\]\
+lower_case_table_names = 1\
+character-set-server=utf8\
+collation-server=utf8_general_ci|g' /etc/mysql/my.cnf

+ 151 - 0
config/travis_setup.sh

@@ -0,0 +1,151 @@
+export DEBIAN_FRONTEND=noninteractive
+
+# Turn on command tracing
+set -x 
+
+# Setup Apt For MongoDB
+#   Due to TechEmpower/FrameworkBenchmarks#989 and travis-ci/travis-ci#2655, 
+#   we put this into a loop
+until timeout 15s sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10; do echo 'Waiting for apt-key' ; done
+echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
+
+# Setup apt for Apache Cassandra
+until timeout 15s sudo apt-key adv --keyserver pgp.mit.edu --recv 4BD736A82B5C1B00; do echo 'Waiting for apt-key' ; done
+sudo apt-add-repository  'deb http://www.apache.org/dist/cassandra/debian 20x main'
+
+# Run installation 
+# DO NOT COPY --force-yes TO ANY NON-TRAVIS-CI SCRIPTS! Seriously, it can cause some 
+# major damage and should only be used inside a VM or Linux Container
+sudo apt-get -q update
+sudo apt-get -q -y --force-yes install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
+  mongodb-org \
+  cassandra \
+  openssh-server \
+  mysql-server
+
+# Run as travis user (who already has passwordless sudo)
+ssh-keygen -f /home/travis/.ssh/id_rsa -N '' -t rsa
+cat /home/travis/.ssh/id_rsa.pub > /home/travis/.ssh/authorized_keys
+chmod 600 /home/travis/.ssh/authorized_keys
+
+# Set up the benchmark.cfg for travis user
+# NOTE: Please don't just copy the example config - it causes unexpected
+#       issues when those example variables change
+echo "[Defaults]"                                       > benchmark.cfg
+echo "client_identity_file=/home/travis/.ssh/id_rsa"   >> benchmark.cfg
+echo "database_identity_file=/home/travis/.ssh/id_rsa" >> benchmark.cfg
+echo "client_host=127.0.0.1"                           >> benchmark.cfg
+echo "database_host=127.0.0.1"                         >> benchmark.cfg
+echo "server_host=127.0.0.1"                           >> benchmark.cfg
+echo "client_user=travis"                              >> benchmark.cfg
+echo "database_user=travis"                            >> benchmark.cfg
+echo "runner_user=testrunner"                          >> benchmark.cfg
+
+# Create the new testrunner user
+sudo useradd testrunner
+# Give him a home dir
+sudo mkdir /home/testrunner
+# Make testrunner the owner of his home dir
+sudo chown testrunner:testrunner /home/testrunner
+# Add the testrunner user to every group that the travis user is in
+sudo sed -i 's|:travis|:travis,testrunner,benchmarkdbuser|g' /etc/group
+# Maybe unneeded - add the travis user to the testrunner group
+sudo sed -i 's|testrunner:x:\(.*\):|testrunner:x:\1:travis|g' /etc/group
+# Need to add testrunner to the sudoers group AND default him to a sudoers
+# because the travis user isn't in the sudo group - he's a sudoer.
+echo "testrunner ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
+# Set the default shell for testrunner to /bin/bash
+sudo sed -i 's|/home/testrunner:/bin/sh|/home/testrunner:/bin/bash|g' /etc/passwd
+
+mkdir installs
+sudo chown testrunner:testrunner installs
+
+# =============Setup Databases===========================
+# NOTE: Do not run `--install database` in travis-ci! 
+#       It changes DB configuration files and will break everything
+# =======================================================
+
+# Setup MySQL
+echo "Populating MySQL database"
+#sudo mysqladmin -u root password secret
+#sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.orig
+#sudo mv config/my.cnf /etc/mysql/my.cnf
+sudo sed -i 's|#max_connections        = 100|max_connections        = 500|g' /etc/mysql/my.cnf
+sudo restart mysql
+#mysql -uroot -psecret < config/create.sql
+
+# Setup Postgres
+echo "Removing Postgres 9.1 from Travis-CI"
+sudo apt-get remove -qy postgresql postgresql-9.1 postgresql-client-9.1
+sudo apt-get install -qy postgresql-9.3 postgresql-client-9.3
+
+echo "Populating Postgres database"
+psql --version
+sudo useradd benchmarkdbuser -p benchmarkdbpass
+sudo -u postgres psql template1 < config/create-postgres-database.sql
+sudo -u benchmarkdbuser psql hello_world < config/create-postgres.sql
+sudo sed -i "s|#listen_addresses = 'localhost'|listen_addresses = '*'|g" /etc/postgresql/9.3/main/postgresql.conf
+sudo sed -i 's|max_connections = 255|max_connections = 500|g' /etc/postgresql/9.3/main/postgresql.conf
+sudo service postgresql stop
+sudo service postgresql start 9.3
+
+# Setup Apache Cassandra
+echo "Populating Apache Cassandra database"
+for i in {1..15}; do
+nc -z localhost 9160 && break || sleep 1;
+echo "Waiting for Cassandra ($i/15}"
+done
+nc -z localhost 9160
+if [ $? -eq 0 ]; then
+cat config/cassandra/cleanup-keyspace.cql | sudo cqlsh
+python config/cassandra/db-data-gen.py > config/cassandra/tfb-data.cql
+sudo cqlsh -f config/cassandra/create-keyspace.cql
+sudo cqlsh -f config/cassandra/tfb-data.cql
+else
+>&2 echo "Cassandra did not start, skipping"
+fi
+
+# Setup Elasticsearch
+curl -O https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.5.0.deb
+sudo dpkg -i --force-confnew elasticsearch-1.5.0.deb
+sudo update-rc.d elasticsearch defaults 95 10
+sudo service elasticsearch restart
+
+echo "Populating Elasticsearch database"
+for i in {1..15}; do
+nc -z localhost 9200 && break || sleep 1;
+echo "Waiting for Elasticsearch ($i/15}"
+done
+nc -z localhost 9200
+if [ $? -eq 0 ]; then
+curl localhost:9200
+sh config/elasticsearch/es-create-index.sh
+python config/elasticsearch/es-db-data-gen.py > config/elasticsearch/tfb-data.json
+curl -sS -D - -o /dev/null -XPOST localhost:9200/tfb/world/_bulk --data-binary @config/elasticsearch/tfb-data.json
+echo "Elasticsearch DB populated"
+else
+>&2 echo "Elasticsearch did not start, skipping"
+fi
+
+# Setup MongoDB
+echo "Populating MongoDB database"
+for i in {1..15}; do
+nc -z localhost 27017 && break || sleep 1;
+echo "Waiting for MongoDB ($i/15}"
+done
+nc -z localhost 27017
+if [ $? -eq 0 ]; then
+mongo < config/create.js
+mongod --version
+else
+>&2 echo "MongoDB did not start, skipping"
+fi
+
+# =============Modify Configurations===========================
+# It can be useful to enable debug features for verification 
+# inside Travis-CI
+# =======================================================
+
+sed -i 's|display_errors\] = off|display_errors\] = on|' config/php-fpm.conf
+
+#exit $?

+ 24 - 13
deployment/vagrant-common/bootstrap.sh

@@ -99,30 +99,31 @@ if [ ! -e "~/.firstboot" ]; then
   echo "Installing prerequisites"
   sudo apt-get update
   sudo apt-get install -y git
-  sudo apt-get install -y python-pip
+
 
   # Make project available
   # If they synced it to /FwBm, just expose it at ~/FwBm
   # If they didn't sync, we need to clone it
-  if [ -d "/FrameworkBenchmarks" ]; then
-    ln -s /FrameworkBenchmarks $FWROOT
-    echo "Removing your current results folder to avoid interference"
-    rm -rf $FWROOT/installs $FWROOT/results
+  #if [ -d "/FrameworkBenchmarks" ]; then
+    #ln -s /FrameworkBenchmarks $FWROOT
+    #echo "Removing your current results folder to avoid interference"
+    #rm -rf $FWROOT/installs $FWROOT/results
 
     # vboxfs does not support chown or chmod, which we need. 
     # We therefore bind-mount a normal linux directory so we can
     # use these operations. This enables us to 
     # use `chown -R testrunner:testrunner $FWROOT/installs` later
-    echo "Mounting over your installs folder"
-    mkdir -p /tmp/TFB_installs
-    mkdir -p /FrameworkBenchmarks/installs
-    sudo mount -o bind /tmp/TFB_installs $FWROOT/installs
-  else
+    #echo "Mounting over your installs folder"
+    #mkdir -p /tmp/TFB_installs
+    #mkdir -p /FrameworkBenchmarks/installs
+    #sudo mount -o bind /tmp/TFB_installs $FWROOT/installs
+  #else
     # If there is no synced folder, clone the project
     echo "Cloning project from $GH_REPO $GH_BRANCH"
+    git config --global core.autocrlf input
     git clone -b ${GH_BRANCH} https://github.com/${GH_REPO}.git $FWROOT
-  fi
-  sudo pip install -r $FWROOT/requirements.txt
+    source ~/FrameworkBenchmarks/toolset/setup/linux/prerequisites.sh
+  #fi
 
   # Everyone gets SSH access to localhost
   echo "Setting up SSH access to localhost"
@@ -134,8 +135,18 @@ if [ ! -e "~/.firstboot" ]; then
   sudo -u testrunner bash -c "cat /home/vagrant/.ssh/authorized_keys >> /home/testrunner/.ssh/authorized_keys"
   chmod 600 ~/.ssh/authorized_keys
   sudo -u testrunner chmod 600 /home/testrunner/.ssh/authorized_keys
+  
+  export RUNNER=testrunner
+  export ME=$(id -u -n)
+  sudo chown $RUNNER:$RUNNER /home/$RUNNER
+  sudo sed -i 's|:'"$ME"'|:'"$ME"','"$RUNNER"'|g' /etc/group
+  sudo sed -i 's|'"$ME"':x:\(.*\):|'"$ME"':x:\1:'"$RUNNER"'|g' /etc/group
+  sudo sed -i 's|'"$RUNNER"':x:\(.*\):|'"$RUNNER"':x:\1:'"$ME"'|g' /etc/group
+  echo "$RUNNER ALL=(ALL:ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
+  sudo sed -i 's|/home/'"$RUNNER"':.*|/home/'"$RUNNER"':/bin/bash|g' /etc/passwd
+
   # Enable remote SSH access if we are running production environment
-  # Note : this are always copied from the local working copy using a
+  # Note : this is always copied from the local working copy using a
   #        file provisioner. While they exist in the git clone we just 
   #        created (so we could use those), we want to let the user
   #        have the option of replacing the keys in their working copy

+ 1 - 1
deployment/vagrant-common/custom_motd.sh

@@ -6,7 +6,7 @@ echo ""
 echo "  To get started, perhaps try this:"
 echo "    \$ cd FrameworkBenchmarks"
 echo "    \$ toolset/run-tests.py --install server --test go"
-echo "    \$ cat results/ec2/latest/logs/go/out.txt"
+echo "    \$ cat results/latest/logs/go/out.txt"
 echo ""
 echo "  You can get lots of help:"
 echo "    \$ toolset/run-tests.py --help"

+ 2 - 2
deployment/vagrant-development/README.md

@@ -51,7 +51,7 @@ Welcome to the FrameworkBenchmarks project!
 To get started, perhaps try this:
    $ cd FrameworkBenchmarks
    $ toolset/run-tests.py --install server --test go
-   $ cat results/ec2/latest/logs/go/out.txt
+   $ cat results/latest/logs/go/out.txt
 
 You can get lots of help:
    $ toolset/run-tests.py --help
@@ -71,7 +71,7 @@ usernames, or private key files, as so:
     <log for installing software needed for go test>
     <log for launching go framework>
     <log for verifying go framework meets requirements>
-    $ cat results/ec2/latest/logs/go/out.txt
+    $ cat results/latest/logs/go/out.txt
     <log with stdout from framework go>
 
 # Using Amazon-powered Virtual Machine

+ 1 - 0
deployment/vagrant-development/Vagrantfile

@@ -25,3 +25,4 @@ Vagrant.configure("2") do |config|
   provider_aws(config, 'integrated')
   
 end
+

+ 1 - 1
deployment/vagrant-production/README.md

@@ -46,7 +46,7 @@ Welcome to the FrameworkBenchmarks project!
 To get started, perhaps try this:
    $ cd FrameworkBenchmarks
    $ toolset/run-tests.py --install server --test go
-   $ cat results/ec2/latest/logs/go/out.txt
+   $ cat results/latest/logs/go/out.txt
 
 You can get lots of help:
    $ toolset/run-tests.py --help

+ 0 - 107
frameworks/C++/ULib/README.md

@@ -1,107 +0,0 @@
-#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.
-
-### JSON Encoding Test
-
-* [JSON test source](src/json.usp)
-
-### Data-Store/Database Mapping Test
-
-* [Database test source](src/db.usp)
-
-### Variable Query Test
-
-* [Variable Query test source](src/query.usp)
-
-### Fortune Query Test
-
-* [Fortune Query test source](src/fortune.usp)
-
-### Variable Query (update) Test
-
-* [Variable Query (update) test source](src/update.usp)
-
-### Plaintext Test
-
-* [Plaintext test source](src/plaintext.usp)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [ULib Version 1.4.2](https://github.com/stefanocasazza/ULib/archive/v1.4.2.tar.gz)
-
-Output
-======
-
-[/json](http://www.techempower.com/benchmarks/#section=json)
------
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:11:10 GMT
-Server: ULib 
-Content-Length: 27
-Content-Type: application/json; charset=UTF-8
-
-{"message":"Hello, World!"}
-```
-
-[/db](http://www.techempower.com/benchmarks/#section=db)
----
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:14:51 GMT
-Server: ULib 
-Content-Length: 31
-Content-Type: application/json; charset=UTF-8
-
-{"id":6227,"randomNumber":8489}
-```
-
-[/query?queries=10](http://www.techempower.com/benchmarks/#section=query)
--------------------
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:14:51 GMT
-Server: ULib 
-Content-Length: 320
-Content-Type: application/json; charset=UTF-8
-
-[{"id":6851,"randomNumber":7598},{"id":3968,"randomNumber":7325},{"id":8159,"randomNumber":348},{"id":9560,"randomNumber":7333},{"id":9938,"randomNumber":9080},{"id":1598,"randomNumber":1623},{"id":3280,"randomNumber":8707},{"id":4521,"randomNumber":6063},{"id":8173,"randomNumber":3690},{"id":3648,"randomNumber":8803}]
-```
-
-[/fortune](http://www.techempower.com/benchmarks/#section=fortune)
----------
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:14:51 GMT
-Server: ULib 
-Content-Type: text/html; charset=UTF-8
-Content-Length: 1227
-
-<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><tr><td>11</td><td>&lt;script&gt;alert(&quot;This should not be displayed in a browser alert box.&quot;);&lt;/script&gt;</td></tr><tr><td>4</td><td>A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1</td></tr><tr><td>5</td><td>A computer program does what you tell it to do, not what you want it to do.</td></tr><tr><td>2</td><td>A computer scientist is someone who fixes things that aren&apos;t broken.</td></tr><tr><td>8</td><td>A list is only as strong as its weakest link. — Donald Knuth</td></tr><tr><td>0</td><td>Additional fortune added at request time.</td></tr><tr><td>3</td><td>After enough decimal places, nobody gives a damn.</td></tr><tr><td>7</td><td>Any program that runs right is obsolete.</td></tr><tr><td>10</td><td>Computers make very fast, very accurate mistakes.</td></tr><tr><td>6</td><td>Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen</td></tr><tr><td>9</td><td>Feature: A bug with seniority.</td></tr><tr><td>1</td><td>fortune: No such file or directory</td></tr><tr><td>12</td><td>フレームワークのベンチマーク</td></tr></table></body></html>
-```
-
-[/update?queries=10](http://www.techempower.com/benchmarks/#section=update)
--------------------
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:14:51 GMT
-Server: ULib 
-Content-Length: 319
-Content-Type: application/json; charset=UTF-8
-
-[{"id":7171,"randomNumber":351},{"id":6019,"randomNumber":9725},{"id":8118,"randomNumber":4023},{"id":7965,"randomNumber":1388},{"id":7797,"randomNumber":2249},{"id":112,"randomNumber":1108},{"id":6127,"randomNumber":4323},{"id":2597,"randomNumber":7509},{"id":2978,"randomNumber":7883},{"id":1111,"randomNumber":2228}]
-```
-
-[/plaintext](http://www.techempower.com/benchmarks/#section=plaintext)
-----------
-```
-HTTP/1.1 200 OK
-Date: Thu, 03 Jul 2014 10:14:51 GMT
-Server: ULib 
-Content-Type: text/plain; charset=UTF-8
-Content-Length: 13
-
-Hello, World!
-```

+ 0 - 86
frameworks/C++/ULib/benchmark_config.json

@@ -1,86 +0,0 @@
-{
-  "framework": "ULib",
-  "tests": [{
-    "default": {
-      "setup_file": "setup",
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "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": {
-      "setup_file": "setup_mysql",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "MySQL",
-      "framework": "ULib",
-      "language": "C++",
-      "orm": "Micro",
-      "platform": "ULib",
-      "webserver": "userver_tcp",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ULib-mysql",
-      "notes": "",
-      "versus": ""
-    },
-    "sqlite": {
-      "setup_file": "setup_sqlite",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "SQLite",
-      "framework": "ULib",
-      "language": "C++",
-      "orm": "Micro",
-      "platform": "ULib",
-      "webserver": "userver_tcp",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ULib-sqlite",
-      "notes": "",
-      "versus": ""
-    },
-    "postgres": {
-      "setup_file": "setup_postgres",
-      "db_url": "/db",
-      "query_url": "/query?queries=",
-      "fortune_url": "/fortune",
-      "update_url": "/update?queries=",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "Postgres",
-      "framework": "ULib",
-      "language": "C++",
-      "orm": "Micro",
-      "platform": "ULib",
-      "webserver": "userver_tcp",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "ULib-postgres",
-      "notes": "",
-      "versus": ""
-    }
-  }]
-}

+ 0 - 108
frameworks/C++/ULib/install.sh

@@ -1,108 +0,0 @@
-#!/bin/bash
-
-# install.sh
-# --------------------------------------------------------------------------------------------------------
-# toolset/run-tests.py --install server --test ULib-mysql  --type all --verbose
-# toolset/run-tests.py --install server --test ULib-sqlite --type all --verbose
-# --------------------------------------------------------------------------------------------------------
-# TROOT - Path of this test's directory
-# IROOT - Path of this test's install directory ($FWROOT/installs or $FWROOT/installs/pertest/<test-name>)
-# --------------------------------------------------------------------------------------------------------
-# INFO:root:Running installation for ULib
-# INSTALL: 
-#    export TROOT=$FWROOT/ULib && 
-#    export IROOT=$FWROOT/installs && 
-#    . $FWROOT/toolset/setup/linux/bash_functions.sh && 
-#    . $FWROOT/ULib/install.sh (cwd=$FWROOT//installs)
-# --------------------------------------------------------------------------------------------------------
-
-ULIB_VERSION=1.4.2
-ULIB_ROOT=$IROOT/ULib
-ULIB_DOCUMENT_ROOT=${ULIB_ROOT}/ULIB_DOCUMENT_ROOT
-
-# Check if ULib is already installed
-ULIB_INSTALLED_FILE="${IROOT}/ULib-${ULIB_VERSION}.installed"
-RETCODE=$(fw_exists ${ULIB_INSTALLED_FILE})
-[ ! "$RETCODE" == 0 ] || { return 0; }
-
-# Create a run directory for ULIB
-[ ! -e ${ULIB_INSTALLED_FILE} -a -d ${IROOT}/ULib ] && rm -rf ${IROOT}/ULib*
-
-if [ ! -d "$ULIB_ROOT" ]; then
-  mkdir -p $ULIB_ROOT
-fi
-
-# AVOID "fatal error: postgres_fe.h: No such file or directory"
-sudo apt-get install -y postgresql-server-dev-all
-
-# Add a simple configuration file to it
-cd $ULIB_ROOT
-if [ ! -f "benchmark.cfg" ]; then
-  cat <<EOF >benchmark.cfg
-userver {
- PORT 8080
- PREFORK_CHILD 4
- MAX_KEEP_ALIVE 1023
- LISTEN_BACKLOG 16384
- CLIENT_FOR_PARALLELIZATION 256
- ORM_DRIVER "mysql pgsql sqlite"
- DOCUMENT_ROOT $ULIB_DOCUMENT_ROOT
-}
-EOF
-fi
-
-# 1. Download ULib
-cd $IROOT
-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
-
-# 2. Compile application (userver_tcp)
-cd ULib-$ULIB_VERSION
-
-# Check for the compiler support (We want at least g++ 4.8)
-CC=gcc  # C   compiler command
-CXX=g++ # C++ compiler command
-
-gcc_version=`g++ -dumpversion`
-
-case "$gcc_version" in
-  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'
-  ;;
-esac
-
-export CC CXX
-
-# AVOID "configure: error: newly created file is older than distributed files! Check your system clock"
-find . -exec touch {} \;
-
-USP_FLAGS="-DAS_cpoll_cppsp_DO" \
-./configure --prefix=$ULIB_ROOT \
-   --disable-static --disable-examples \
-   --with-mysql --with-pgsql --with-sqlite3 \
-   --without-ssl --without-pcre --without-expat \
-   --without-libz --without-libuuid --without-magic --without-libares \
-   --enable-static-orm-driver='mysql pgsql sqlite' --enable-static-server-plugin=http
-#  --enable-debug \
-#USP_LIBS="-ljson" \
-
-make install
-cp -r tests/examples/benchmark/FrameworkBenchmarks/ULib/db ${ULIB_ROOT}
-
-cd examples/userver
-make install
-
-# 3. Compile usp pages for benchmark
-cd ../../src/ulib/net/server/plugin/usp
-make db.la fortune.la json.la plaintext.la query.la update.la
-
-# Check that compilation worked
-if [ ! -e .libs/db.so ]; then
-   exit 1
-fi
-
-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
-
-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 &

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

@@ -1,16 +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 ORM_DRIVER="mysql"
-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 &

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

@@ -1,12 +0,0 @@
-#!/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"
-
-# 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 &

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

@@ -1,16 +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 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"
-
-# 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 &

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

@@ -1,8 +0,0 @@
-./src/db.usp
-./src/world.h
-./src/json.usp
-./src/fortune.h
-./src/query.usp
-./src/update.usp
-./src/fortune.usp
-./src/plaintext.usp

+ 0 - 78
frameworks/C++/ULib/src/fortune.usp

@@ -1,78 +0,0 @@
-<!--#
-Test type 4: Fortunes
-TechEmpower Web Framework Benchmarks
--->
-<!--#declaration
-#include "fortune.h"
-
-static Fortune*           pfortune;
-static UString*           pmessage;
-static UOrmSession*       psql_fortune;
-static UOrmStatement*     pstmt_fortune;
-static UVector<Fortune*>* pvfortune;
-
-static void usp_fork_fortune()
-{
-   U_TRACE(5, "::usp_fork_fortune()")
-
-   psql_fortune = U_NEW(UOrmSession(U_CONSTANT_TO_PARAM("fortune")));
-
-   if (psql_fortune->isReady())
-      {
-      pstmt_fortune = U_NEW(UOrmStatement(*psql_fortune, U_CONSTANT_TO_PARAM("SELECT id, message FROM Fortune")));
-
-      if (pstmt_fortune == 0) U_ERROR("usp_fork_fortune(): we cound't connect to db");
-
-      if (UOrmDriver::isPGSQL()) *psql_fortune << "BEGIN ISOLATION LEVEL SERIALIZABLE; COMMIT";
-
-      pfortune = U_NEW(Fortune);
-
-      pstmt_fortune->into(*pfortune);
-
-      pmessage  = U_NEW(U_STRING_FROM_CONSTANT("Additional fortune added at request time."));
-      pvfortune = U_NEW(UVector<Fortune*>);
-      }
-}
-
-#ifdef DEBUG
-static void usp_end_fortune()
-{
-   U_TRACE(5, "::usp_end_fortune()")
-
-   if (pstmt_fortune)
-   {
-   delete pstmt_fortune;
-
-   delete psql_fortune;
-   delete pvfortune;
-   delete pfortune;
-   delete pmessage;
-   }
-}
-#endif
--->
-<!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();
-
-     pvfortune->push_back(U_NEW(Fortune(0, *pmessage)));
-do { pvfortune->push_back(U_NEW(Fortune(*pfortune))); } while (pstmt_fortune->nextRow());
-
-pvfortune->sort(Fortune::cmp_obj);
-
-for (uint32_t i = 0, n = pvfortune->size(); i < n; ++i)
-   {
-   elem = (*pvfortune)[i];
-
-   USP_PRINTF_ADD(
-      "<tr>"
-      "<td>%u</td>"
-      "<td>%.*s</td>"
-      "</tr>",
-      elem->id, u_xml_encode((const unsigned char*)U_STRING_TO_PARAM(elem->message), encoded), encoded);
-   }
-
-pvfortune->clear();
---></table></body></html>

+ 0 - 105
frameworks/C++/ULib/src/query.usp

@@ -1,105 +0,0 @@
-<!--#
-Test type 3: Multiple database queries
-TechEmpower Web Framework Benchmarks
--->
-<!--#declaration
-#include "world.h"
-
-static World*           pworld_query;
-static UOrmSession*     psql_query;
-static UOrmStatement*   pstmt_query;
-static UVector<World*>* pvworld_query;
-
-#ifndef AS_cpoll_cppsp_DO
-static UValue* pvalue;
-#endif
-
-static void usp_fork_query()
-{
-   U_TRACE(5, "::usp_fork_query()")
-
-   psql_query = U_NEW(UOrmSession(U_CONSTANT_TO_PARAM("hello_world")));
-
-   if (psql_query->isReady())
-      {
-      pstmt_query = U_NEW(UOrmStatement(*psql_query, U_CONSTANT_TO_PARAM("SELECT randomNumber FROM World WHERE id = ?")));
-
-      if (pstmt_query == 0) U_ERROR("usp_fork_query(): we cound't connect to db");
-
-      if (UOrmDriver::isPGSQL()) *psql_query << "BEGIN TRANSACTION";
-
-      pworld_query = U_NEW(World);
-
-      pstmt_query->use( pworld_query->id);
-      pstmt_query->into(pworld_query->randomNumber);
-
-      pvworld_query = U_NEW(UVector<World*>(500));
-
-#  ifndef AS_cpoll_cppsp_DO
-      pvalue = U_NEW(UValue(ARRAY_VALUE));
-#  endif
-      }
-}
-
-#ifdef DEBUG
-static void usp_end_query()
-{
-   U_TRACE(5, "::usp_end_query()")
-
-   if (pstmt_query)
-      {
-      delete   pstmt_query;
-      delete    psql_query;
-      delete pvworld_query;
-      delete  pworld_query;
-
-#   ifndef AS_cpoll_cppsp_DO
-      delete pvalue;
-#   endif
-      }
-}
-#endif
--->
-<!--#args
-queries;
--->
-<!--#header
-Content-Type: application/json; charset=UTF-8
--->
-<!--#code
-int i = 0, num_queries = queries.strtol();
-
-     if (num_queries <   1) num_queries = 1;
-else if (num_queries > 500) num_queries = 500;
-
-#ifdef AS_cpoll_cppsp_DO
-USP_PUTS_CHAR('[');
-#endif
-
-while (true)
-   {
-   pworld_query->id = u_get_num_random(10000);
-
-   pstmt_query->execute();
-
-#ifdef AS_cpoll_cppsp_DO
-   USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld_query->id, pworld_query->randomNumber);
-#endif
-
-   pvworld_query->push_back(U_NEW(World(*pworld_query)));
-
-   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_query);
-pvalue->clear();
-#endif
-pvworld_query->clear();
--->

+ 2 - 0
frameworks/C++/cpoll_cppsp/.gitignore

@@ -0,0 +1,2 @@
+/www/*.so
+/www/*.txt

+ 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 &

+ 1 - 0
frameworks/C++/ffead-cpp/.gitignore

@@ -0,0 +1 @@
+/ffead-cpp-2.0/

+ 29 - 0
frameworks/C++/ffead-cpp/benchmark_config.json

@@ -0,0 +1,29 @@
+{
+  "framework": "ffead-cpp",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "json_url": "/te-benchmark/json",
+      "plaintext_url": "/te-benchmark/plaintext",
+      "db_url": "/te-benchmark/db",
+      "query_url": "/te-benchmark/queries?queries=",
+      "fortune_url": "/te-benchmark/fortunes",
+      "update_url": "/te-benchmark/updates?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Fullstack",
+      "database": "MongoDB",
+      "framework": "ffead-cpp",
+      "language": "C++",
+      "orm": "Full",
+      "platform": "ffead-cpp",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ffead-cpp",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}
+

+ 12 - 0
frameworks/C++/ffead-cpp/setup.sh

@@ -0,0 +1,12 @@
+#!/bin/bash
+
+fw_depends ffead-cpp
+
+export FFEAD_CPP_PATH=$TROOT/ffead-cpp-2.0
+export LD_LIBRARY_PATH=$IROOT:$FFEAD_CPP_PATH/lib:$LD_LIBRARY_PATH
+echo $FFEAD_CPP_PATH
+echo $LD_LIBRARY_PATH
+rm -f $FFEAD_CPP_PATH/*.cntrl
+rm -f $FFEAD_CPP_PATH/tmp/*.sess
+$TROOT/ffead-cpp-2.0/CHS $FFEAD_CPP_PATH > ffead.log 2>&1
+

+ 1 - 0
frameworks/C++/poco/.gitignore

@@ -0,0 +1 @@
+/poco

+ 78 - 0
frameworks/C++/poco/benchmark.cpp

@@ -0,0 +1,78 @@
+#include <Poco/Net/ServerSocket.h>
+#include <Poco/Net/HTTPServer.h>
+#include <Poco/Net/HTTPRequestHandler.h>
+#include <Poco/Net/HTTPRequestHandlerFactory.h>
+#include <Poco/Net/HTTPResponse.h>
+#include <Poco/Net/HTTPServerRequest.h>
+#include <Poco/Net/HTTPServerResponse.h>
+#include <Poco/Util/ServerApplication.h>
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+#define PLAIN_URL_PATH       "/plaintext"
+#define PLAIN_CONTENT_TYPE   "text/plain"
+#define RES_BODY             "Hello, World!"
+#define SERVER_NAME          "poco"
+
+using namespace Poco::Net;
+using namespace Poco::Util;
+using namespace std;
+
+class MyRequestHandler : public HTTPRequestHandler {
+public:
+    virtual void handleRequest(HTTPServerRequest &req, HTTPServerResponse &resp) {
+        resp.setStatusAndReason(HTTPResponse::HTTP_OK, "OK");
+        resp.setContentType(PLAIN_CONTENT_TYPE);
+        resp.add("Server", SERVER_NAME);
+        resp.sendBuffer(RES_BODY, sizeof(RES_BODY)-1);
+        return;
+    }
+};
+
+class NotFoundRequestHandler : public HTTPRequestHandler {
+public:
+    virtual void handleRequest(HTTPServerRequest &req, HTTPServerResponse &resp) {
+        resp.setStatusAndReason(HTTPResponse::HTTP_NOT_FOUND, "NOT_FOUND");
+        resp.setContentType(PLAIN_CONTENT_TYPE);
+        resp.add("Server", SERVER_NAME);
+        resp.sendBuffer("", 0);
+        return;
+    }
+};
+
+class MyRequestHandlerFactory : public HTTPRequestHandlerFactory {
+public:
+    virtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest &req) {
+        if (req.getMethod() == "GET" && req.getURI() == PLAIN_URL_PATH)
+            return new MyRequestHandler;
+        else
+            return new NotFoundRequestHandler;
+    }
+};
+
+class MyServerApp : public ServerApplication {
+protected:
+    int main(const vector<string> &args) {
+        HTTPServerParams* hsp = new HTTPServerParams;
+        hsp->setMaxThreads(stoi(args[1]));
+        hsp->setKeepAlive(true);
+        HTTPServer s(new MyRequestHandlerFactory, ServerSocket(stoi(args[0]), 4000), hsp);
+        s.start();
+        waitForTerminationRequest();
+        s.stop();
+        return Application::EXIT_OK;
+    }
+};
+
+int main(int argc, char** argv) {
+    if (argc != 3) {
+        std::cerr << "Usage: " << argv[0] << " port nthreads" << std::endl;
+        return 1;
+    }
+    
+    MyServerApp app;
+    return app.run(argc, argv);
+}
+

+ 24 - 0
frameworks/C++/poco/benchmark_config.json

@@ -0,0 +1,24 @@
+{
+  "framework": "poco",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "none",
+      "framework": "POCO",
+      "language": "C++",
+      "orm": "Raw",
+      "platform": "POCO",
+      "webserver": "poco",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "POCO",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}
+

+ 7 - 0
frameworks/C++/poco/setup.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+fw_depends poco
+
+g++-4.8 -O3 -DNDEBUG -std=c++0x -o poco benchmark.cpp -I$POCO_HOME/Foundation/include -I$POCO_HOME/Util/include -I$POCO_HOME/Net/include -L$POCO_HOME/lib/Linux/x86_64 -lPocoNet -lPocoUtil -lPocoFoundation -lPocoXML -lPocoJSON
+./poco 8080 $MAX_THREADS
+

+ 1 - 0
frameworks/C++/silicon/.gitignore

@@ -0,0 +1 @@
+/build/

+ 9 - 5
frameworks/C++/silicon/CMakeLists.txt

@@ -2,14 +2,18 @@ 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)
-add_definitions(-std=c++14  -ftemplate-depth=512 -DNDEBUG -O3)
+link_directories($ENV{IROOT}/lib $ENV{MICROHTTPD_HOME}/lib)
 
-add_executable(silicon_tpc_mysql main.cc)
+add_definitions(-std=c++14 -ftemplate-depth=1024 -DNDEBUG -O3)
+
+add_executable(silicon_tpc_mysql techempower_microhttpd.cc)
 target_link_libraries(silicon_tpc_mysql microhttpd mysqlclient)
 
-add_executable(silicon_epoll_mysql main.cc)
+add_executable(silicon_epoll_mysql techempower_microhttpd.cc)
 set_target_properties(silicon_epoll_mysql PROPERTIES COMPILE_FLAGS "-DTFB_USE_EPOLL")
 target_link_libraries(silicon_epoll_mysql microhttpd mysqlclient)
+
+add_executable(silicon_lwan_mysql techempower_lwan.cc)
+target_link_libraries(silicon_lwan_mysql mysqlclient lwan-common curl z pthread dl)

+ 28 - 4
frameworks/C++/silicon/benchmark_config.json

@@ -2,7 +2,7 @@
   "framework": "silicon",
   "tests": [{
     "default": {
-      "setup_file": "setup_tpc_mysql",
+      "setup_file": "setup_mhd_tpc_mysql",
       "json_url"       : "/json",
       "db_url"         : "/db",
       "query_url"      : "/queries?queries=",
@@ -17,7 +17,7 @@
       "language": "C++",
       "orm": "Full",
       "platform": "Silicon",
-      "webserver": "None",
+      "webserver": "microhttpd",
       "os": "Linux",
       "database_os": "Linux",
       "display_name": "silicon-tpc-mysql",
@@ -25,7 +25,7 @@
       "versus": ""
     },
     "epoll-mysql": {
-      "setup_file": "setup_epoll_mysql",
+      "setup_file": "setup_mhd_epoll_mysql",
       "json_url"       : "/json",
       "db_url"         : "/db",
       "query_url"      : "/queries?queries=",
@@ -40,12 +40,36 @@
       "language": "C++",
       "orm": "Full",
       "platform": "Silicon",
-      "webserver": "None",
+      "webserver": "microhttpd",
       "os": "Linux",
       "database_os": "Linux",
       "display_name": "silicon-epoll-mysql",
       "notes": "",
       "versus": ""
+    },
+    "lwan-mysql": {
+      "setup_file": "setup_lwan_mysql",
+      "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": "Micro",
+      "database": "MySQL",
+      "framework": "silicon",
+      "language": "C++",
+      "orm": "Full",
+      "platform": "Silicon",
+      "webserver": "Lwan",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "silicon-lwan-mysql",
+      "notes": "",
+      "versus": ""
     }
+    
   }]
 }

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

+ 0 - 137
frameworks/C++/silicon/main.cc

@@ -1,137 +0,0 @@
-#include <algorithm>
-#include <unistd.h>
-#include <iostream>
-#include <silicon/backends/mhd.hh>
-#include <silicon/api.hh>
-#include <silicon/middlewares/mysql_connection.hh>
-#include <silicon/middlewares/mysql_orm.hh>
-#include "symbols.hh"
-
-using namespace s;
-using namespace sl;
-
-typedef decltype(D(_id(_auto_increment, _primary_key) = int(),
-                   _randomNumber = int())) random_number;
-
-typedef decltype(D(_id(_auto_increment, _primary_key) = int(),
-                   _message = std::string())) fortune;
-
-typedef mysql_orm_factory<random_number> rn_orm_factory;
-typedef mysql_orm<random_number> rn_orm;
-
-typedef mysql_orm_factory<fortune> fortune_orm_factory;
-typedef mysql_orm<fortune> fortune_orm;
-
-std::string escape_html_entities(const std::string& data)
-{
-    std::string buffer;
-    buffer.reserve(data.size());
-    for(size_t pos = 0; pos != data.size(); ++pos) {
-        switch(data[pos]) {
-            case '&':  buffer.append("&amp;");       break;
-            case '\"': buffer.append("&quot;");      break;
-            case '\'': buffer.append("&apos;");      break;
-            case '<':  buffer.append("&lt;");        break;
-            case '>':  buffer.append("&gt;");        break;
-            default:   buffer.append(&data[pos], 1); break;
-        }
-    }
-    return std::move(buffer);
-}
-
-int main(int argc, char* argv[])
-{
-
-  if (argc != 3)
-  {
-    std::cerr << "Usage: " << argv[0] << " mysql_host port" << std::endl;
-    return 1;
-  }
-  
-  auto hello_api = make_api(
-
-    _plaintext = [] () { return response(_content_type = "text/plain",
-                                         _body = "Hello, World!"); },
-
-    _json = [] () { return response(_content_type = "application/json",
-                                    _body = D(_message = "Hello, World!")); },
-                        
-    _db = [] (rn_orm& orm) {
-      random_number r;
-      orm.find_by_id(1245, r);
-      return response(_content_type = "application/json",
-                      _body = r);
-    },
-
-    _queries = [] (rn_orm& orm, get_parameters& get_params) {
-      int N = atoi(get_params["queries"].c_str());
-      N = std::max(1, std::min(N, 500));
-
-      std::vector<random_number> qs(N);
-      for (int i = 0; i < N; i++)
-        orm.find_by_id(1 + rand() % 9999, qs[i]);
-      return response(_content_type = "application/json",
-                      _body = std::move(qs));
-    },
-
-    _updates = [] (rn_orm& orm, get_parameters& get_params) {
-      int N = atoi(get_params["queries"].c_str());
-      N = std::max(1, std::min(N, 500));
-
-      std::vector<random_number> qs(N);
-      for (int i = 0; i < N; i++)
-      {
-        orm.find_by_id(1 + rand() % 9999, qs[i]);
-        qs[i].randomNumber = 1 + rand() % 9999;
-        orm.update(qs[i]);
-      }
-      return response(_content_type = "application/json",
-                      _body = std::move(qs));
-    },
-  
-    _fortunes = [] (fortune_orm& orm) {
-      std::vector<fortune> table;
-      orm.forall([&] (fortune& f) { table.push_back(f); });
-      table.push_back(fortune(0, "Additional fortune added at request time."));
-
-      std::sort(table.begin(), table.end(),
-                [] (const fortune& a, const fortune& b) { return a.message < b.message; });
-
-      std::stringstream ss;
-
-      ss << "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
-      for(auto& f : table)
-        ss << "<tr><td>" << f.id << "</td><td>" << escape_html_entities(f.message) << "</td></tr>";
-      ss << "</table></body></html>";
-
-      return response(_content_type = "text/html",
-                      _body = ss.str());
-    }
-  
-    ).bind_factories(
-      mysql_connection_factory(argv[1], "benchmarkdbuser", "benchmarkdbpass", "hello_world"),
-      fortune_orm_factory("Fortune"),
-      rn_orm_factory("World")
-      );
-  
-  try
-  {
-
-    // Start the server.
-    sl::mhd_json_serve(hello_api, atoi(argv[2])
-#ifdef TFB_USE_EPOLL
-                       , _linux_epoll, _nthreads = 1000
-#else
-                       , _one_thread_per_connection
-#endif
-      );
-  }
-  catch (std::exception& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-  catch (sl::error::error& e)
-  {
-    std::cerr << e.what() << std::endl;
-  }
-}

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

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

+ 11 - 0
frameworks/C++/silicon/setup_lwan_mysql.sh

@@ -0,0 +1,11 @@
+#! /bin/bash
+
+fw_depends silicon lwan
+
+rm -rf build
+mkdir build
+cd build
+cmake .. -DCMAKE_CXX_COMPILER=clang++-3.5
+make silicon_lwan_mysql
+
+$TROOT/build/silicon_lwan_mysql ${DBHOST} 8080 &

+ 11 - 0
frameworks/C++/silicon/setup_mhd_epoll_mysql.sh

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

+ 11 - 0
frameworks/C++/silicon/setup_mhd_tpc_mysql.sh

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

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

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

+ 103 - 0
frameworks/C++/silicon/techempower.hh

@@ -0,0 +1,103 @@
+#include <unistd.h>
+#include <iostream>
+#include <silicon/api.hh>
+#include <silicon/middleware_factories.hh>
+#include <silicon/middlewares/mysql_connection.hh>
+#include <silicon/middlewares/mysql_orm.hh>
+#include "symbols.hh"
+
+using namespace s;
+using namespace sl;
+
+typedef decltype(D(_id(_auto_increment, _primary_key) = int(),
+                   _randomNumber = int())) random_number;
+
+typedef decltype(D(_id(_auto_increment, _primary_key) = int(),
+                   _message = std::string())) fortune;
+
+typedef mysql_orm_factory<random_number> rn_orm_factory;
+typedef mysql_orm<random_number> rn_orm;
+
+typedef mysql_orm_factory<fortune> fortune_orm_factory;
+typedef mysql_orm<fortune> fortune_orm;
+
+
+std::string escape_html_entities(std::string& data)
+{
+    std::string buffer;
+    buffer.reserve(data.size());
+    for(size_t pos = 0; pos != data.size(); ++pos) {
+        switch(data[pos]) {
+            case '&':  buffer.append("&amp;");       break;
+            case '\"': buffer.append("&quot;");      break;
+            case '\'': buffer.append("&apos;");      break;
+            case '<':  buffer.append("&lt;");        break;
+            case '>':  buffer.append("&gt;");        break;
+            default:   buffer.append(&data[pos], 1); break;
+        }
+    }
+    return std::move(buffer);
+}
+
+auto techempower_api = http_api(
+
+
+  GET / _plaintext = [] () { return response(_content_type = string_ref("text/plain"),
+                                       _body = string_ref("Hello, World!")); },
+
+  GET / _json = [] () { return response(_content_type = string_ref("application/json"),
+                                  _body = D(_message = string_ref("Hello, World!"))); },
+                        
+  GET / _db = [] (rn_orm& orm) {
+    random_number r;
+    orm.find_by_id(1245, r);
+    return response(_content_type = "application/json",
+                    _body = r);
+  },
+
+  GET / _queries * get_parameters(_queries = optional(std::string("1"))) = [] (auto param, rn_orm& orm) {
+    int N = atoi(param.queries.c_str());
+    N = std::max(1, std::min(N, 500));
+
+    std::vector<random_number> qs(N);
+    for (int i = 0; i < N; i++)
+      orm.find_by_id(1 + rand() % 9999, qs[i]);
+    return response(_content_type = "application/json",
+                    _body = std::move(qs));
+  },
+
+  GET / _updates * get_parameters(_queries = optional(std::string("1"))) = [] (auto param, rn_orm& orm) {
+    int N = atoi(param.queries.c_str());
+    N = std::max(1, std::min(N, 500));
+
+    std::vector<random_number> qs(N);
+    for (int i = 0; i < N; i++)
+    {
+      orm.find_by_id(1 + rand() % 9999, qs[i]);
+      qs[i].randomNumber = 1 + rand() % 9999;
+      orm.update(qs[i]);
+    }
+    return response(_content_type = "application/json",
+                    _body = std::move(qs));
+  },
+  
+  GET / _fortunes = [] (fortune_orm& orm) {
+    std::vector<fortune> table;
+    orm.forall([&] (fortune& f) { table.push_back(f); });
+    table.push_back(fortune(0, "Additional fortune added at request time."));
+
+    std::sort(table.begin(), table.end(),
+              [] (const fortune& a, const fortune& b) { return a.message < b.message; });
+
+    std::stringstream ss;
+
+    ss << "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
+    for(auto& f : table)
+      ss << "<tr><td>" << f.id << "</td><td>" << escape_html_entities(f.message) << "</td></tr>";
+    ss << "</table></body></html>";
+
+    return response(_content_type = "text/html; charset=utf-8",
+                    _body = ss.str());
+  }
+  
+  );

+ 41 - 0
frameworks/C++/silicon/techempower_lwan.cc

@@ -0,0 +1,41 @@
+#include <silicon/backends/lwan.hh>
+
+#include "techempower.hh"
+
+using namespace s;
+using namespace sl;
+
+int main(int argc, char* argv[])
+{
+  if (argc != 3)
+  {
+    std::cerr << "Usage: " << argv[0] << " mysql_host port" << std::endl;
+    return 1;
+  }
+
+  auto techempower_middlewares = middleware_factories(
+    mysql_connection_factory(argv[1], "benchmarkdbuser", "benchmarkdbpass", "hello_world"),
+    fortune_orm_factory("Fortune"),
+    rn_orm_factory("World")
+    );
+  
+  try
+  {
+
+    // Write the pid.
+    std::ofstream pidfile(argv[3]);
+    pidfile << getpid() << std::endl;
+    pidfile.close();
+
+    // Start the server.
+    sl::lwan_json_serve(techempower_api, techempower_middlewares, atoi(argv[2]));
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+  catch (sl::error::error& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+}

+ 48 - 0
frameworks/C++/silicon/techempower_microhttpd.cc

@@ -0,0 +1,48 @@
+#include <silicon/backends/mhd.hh>
+
+#include "techempower.hh"
+
+using namespace s;
+using namespace sl;
+
+int main(int argc, char* argv[])
+{
+
+  if (argc != 4)
+  {
+    std::cerr << "Usage: " << argv[0] << " mysql_host port nthreads" << std::endl;
+    return 1;
+  }
+
+  auto techempower_middlewares = middleware_factories(
+    mysql_connection_factory(argv[1], "benchmarkdbuser", "benchmarkdbpass", "hello_world"),
+    fortune_orm_factory("Fortune"),
+    rn_orm_factory("World")
+    );
+  
+  try
+  {
+    // Write the pid.
+    std::ofstream pidfile(argv[3]);
+    pidfile << getpid() << std::endl;
+    pidfile.close();
+
+    // Start the server.
+    sl::mhd_json_serve(techempower_api, techempower_middlewares, atoi(argv[2]), _blocking
+#ifdef TFB_USE_EPOLL
+                       , _linux_epoll, _nthreads = atoi(argv[3])
+#else
+                       , _one_thread_per_connection
+#endif
+      );
+    
+  }
+  catch (std::exception& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+  catch (sl::error::error& e)
+  {
+    std::cerr << e.what() << std::endl;
+  }
+}

+ 0 - 35
frameworks/C++/treefrog/controllers/applicationcontroller.cpp

@@ -20,40 +20,5 @@ bool ApplicationController::preFilter()
     return true;
 }
 
-QString ApplicationController::jsonEncode(const QVariantMap &obj)
-{
-    const QString JSON_OBJ_INT("\"%1\":%2, ");
-    const QString JSON_OBJ_STR("\"%1\":\"%2\", ");
-    QString ret("{");
-
-    for (QMap<QString, QVariant>::const_iterator i = obj.begin(); i != obj.end(); ++i) {
-        switch (i.value().type()) {
-        case QVariant::UInt:
-        case QVariant::Int:
-            ret += JSON_OBJ_INT.arg(i.key()).arg(i.value().toInt());
-            break;
-        default:
-            ret += JSON_OBJ_STR.arg(i.key()).arg(i.value().toString());
-            break;
-        }
-    }
-    ret.chop(2);
-    ret += QLatin1Char('}');
-    return ret;
-}
-
-QString ApplicationController::jsonEncode(const QList<QVariantMap> &lst)
-{
-    QString ret("[");
-
-    for (QListIterator<QVariantMap> it(lst); it.hasNext(); ) {
-        ret += jsonEncode(it.next());
-        ret += QLatin1String(", ");
-    }
-    ret.chop(2);
-    ret += QLatin1Char(']');
-    return ret;
-}
-
 // Don't remove below this line
 T_REGISTER_CONTROLLER(applicationcontroller)

+ 0 - 2
frameworks/C++/treefrog/controllers/applicationcontroller.h

@@ -14,8 +14,6 @@ public:
     ApplicationController();
     ApplicationController(const ApplicationController &other);
     virtual ~ApplicationController();
-    static QString jsonEncode(const QVariantMap &obj);
-    static QString jsonEncode(const QList<QVariantMap> &list);
 
 public slots:
     void staticInitialize();

+ 1 - 1
frameworks/C++/treefrog/controllers/controllers.pro

@@ -1,6 +1,6 @@
 TARGET = controller
 TEMPLATE = lib
-CONFIG += shared x86_64
+CONFIG += shared x86_64 c++11
 QT += network sql xml
 QT -= gui
 DEFINES += TF_DLL

+ 1 - 3
frameworks/C++/treefrog/controllers/jsoncontroller.cpp

@@ -13,9 +13,7 @@ void JsonController::json()
 {
     QVariantMap obj;
     obj["message"] = "Hello, World!";
-
-    setContentType("application/json; charset=UTF-8");
-    renderText(jsonEncode(obj), false);
+    renderJson(obj);
 }
 
 // Don't remove below this line

+ 11 - 9
frameworks/C++/treefrog/controllers/worldcontroller.cpp

@@ -32,23 +32,21 @@ void WorldController::queries()
 
 void WorldController::queries(const QString &num)
 {
-    QList<QVariantMap> worlds;
+    QVariantList worlds;
     int d = qMin(qMax(num.toInt(), 1), 500);
 
     for (int i = 0; i < d; ++i) {
         int id = Tf::random(9999) + 1;
         worlds << World::get(id).toVariantMap();
     }
-    setContentType("application/json; charset=UTF-8");
-    renderText(jsonEncode(worlds), false);
+    renderJson(worlds);
 }
 
 void WorldController::random()
 {
     int id = Tf::random(9999) + 1;
     World world = World::get(id);
-    setContentType("application/json; charset=UTF-8");
-    renderText(jsonEncode(world.toVariantMap()), false);
+    renderJson(world.toVariantMap());
 }
 
 void WorldController::entry()
@@ -125,10 +123,15 @@ void WorldController::renderEdit(const QVariantMap &world)
     render("edit");
 }
 
+void WorldController::updates()
+{
+    updates("1");
+}
+
 void WorldController::updates(const QString &num)
 {
-    QList<QVariantMap> worlds;
-    int d = num.toInt();
+    QVariantList worlds;
+    int d = qMin(qMax(num.toInt(), 1), 500);
     World world;
 
     for (int i = 0; i < d; ++i) {
@@ -138,8 +141,7 @@ void WorldController::updates(const QString &num)
         world.update();
 	worlds << world.toVariantMap();
     }
-    setContentType("application/json; charset=UTF-8");
-    renderText(jsonEncode(worlds), false);
+    renderJson(worlds);
 }
 
 void WorldController::remove(const QString &pk)

+ 1 - 0
frameworks/C++/treefrog/controllers/worldcontroller.h

@@ -25,6 +25,7 @@ public slots:
     void edit(const QString &pk);
     void save(const QString &pk);
     void updates(const QString &num);
+    void updates();
     void remove(const QString &pk);
 
 private:

+ 1 - 1
frameworks/C++/treefrog/helpers/helpers.pro

@@ -1,6 +1,6 @@
 TARGET = helper
 TEMPLATE = lib
-CONFIG += shared x86_64
+CONFIG += shared x86_64 c++11
 QT  -= gui
 QT  += 
 DEFINES += TF_DLL

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

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

+ 1 - 1
frameworks/C++/treefrog/models/models.pro

@@ -1,6 +1,6 @@
 TARGET = model
 TEMPLATE = lib
-CONFIG += shared x86_64
+CONFIG += shared x86_64 c++11
 QT += sql
 QT -= gui
 DEFINES += TF_DLL

+ 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

+ 1 - 1
frameworks/C++/treefrog/views/_src/_src.pro

@@ -1,6 +1,6 @@
 TARGET = view
 TEMPLATE = lib
-CONFIG += shared x86_64
+CONFIG += shared x86_64 c++11
 QT += network xml
 QT -= gui
 DEFINES += TF_DLL

+ 115 - 0
frameworks/C++/ulib/README.md

@@ -0,0 +1,115 @@
+#ULib Benchmarking Test
+
+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
+
+* [JSON test source](src/json.usp)
+
+### Data-Store/Database Mapping Test
+
+* [Database test source (SQL)](src/db.usp)
+* [Database test source (REDIS)](src/rdb.usp)
+* [Database test source (MONGODB)](src/mdb.usp)
+
+### Variable Query Test
+
+* [Variable Query test source (SQL)](src/query.usp)
+* [Variable Query test source (REDIS)](src/rquery.usp)
+* [Variable Query test source (MONGODB)](src/mquery.usp)
+
+### Fortune Query Test
+
+* [Fortune Query test source (SQL)](src/fortune.usp)
+* [Fortune Query test source (REDIS)](src/rfortune.usp)
+* [Fortune Query test source (MONGODB)](src/mfortune.usp)
+
+### Variable Query (update) Test
+
+* [Variable Query (update) test source (SQL)](src/update.usp)
+* [Variable Query (update) test source (REDIS)](src/rupdate.usp)
+* [Variable Query (update) test source (MONGODB)](src/mupdate.usp)
+
+### Plaintext Test
+
+* [Plaintext test source](src/plaintext.usp)
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [ULib Version 1.4.2](https://github.com/stefanocasazza/ULib/archive/v1.4.2.tar.gz)
+
+Output
+======
+
+[/json](http://www.techempower.com/benchmarks/#section=json)
+-----
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:11:10 GMT
+Server: ULib 
+Content-Length: 27
+Content-Type: application/json
+
+{"message":"Hello, World!"}
+```
+
+[/db](http://www.techempower.com/benchmarks/#section=db)
+---
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:14:51 GMT
+Server: ULib 
+Content-Length: 31
+Content-Type: application/json
+
+{"id":6227,"randomNumber":8489}
+```
+
+[/query?queries=10](http://www.techempower.com/benchmarks/#section=query)
+-------------------
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:14:51 GMT
+Server: ULib 
+Content-Length: 320
+Content-Type: application/json
+
+[{"id":6851,"randomNumber":7598},{"id":3968,"randomNumber":7325},{"id":8159,"randomNumber":348},{"id":9560,"randomNumber":7333},{"id":9938,"randomNumber":9080},{"id":1598,"randomNumber":1623},{"id":3280,"randomNumber":8707},{"id":4521,"randomNumber":6063},{"id":8173,"randomNumber":3690},{"id":3648,"randomNumber":8803}]
+```
+
+[/fortune](http://www.techempower.com/benchmarks/#section=fortune)
+---------
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:14:51 GMT
+Server: ULib 
+Content-Type: text/html; charset=UTF-8
+Content-Length: 1227
+
+<!doctype html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr><tr><td>11</td><td>&lt;script&gt;alert(&quot;This should not be displayed in a browser alert box.&quot;);&lt;/script&gt;</td></tr><tr><td>4</td><td>A bad random number generator: 1, 1, 1, 1, 1, 4.33e+67, 1, 1, 1</td></tr><tr><td>5</td><td>A computer program does what you tell it to do, not what you want it to do.</td></tr><tr><td>2</td><td>A computer scientist is someone who fixes things that aren&apos;t broken.</td></tr><tr><td>8</td><td>A list is only as strong as its weakest link. — Donald Knuth</td></tr><tr><td>0</td><td>Additional fortune added at request time.</td></tr><tr><td>3</td><td>After enough decimal places, nobody gives a damn.</td></tr><tr><td>7</td><td>Any program that runs right is obsolete.</td></tr><tr><td>10</td><td>Computers make very fast, very accurate mistakes.</td></tr><tr><td>6</td><td>Emacs is a nice operating system, but I prefer UNIX. — Tom Christaensen</td></tr><tr><td>9</td><td>Feature: A bug with seniority.</td></tr><tr><td>1</td><td>fortune: No such file or directory</td></tr><tr><td>12</td><td>フレームワークのベンチマーク</td></tr></table></body></html>
+```
+
+[/update?queries=10](http://www.techempower.com/benchmarks/#section=update)
+-------------------
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:14:51 GMT
+Server: ULib 
+Content-Length: 319
+Content-Type: application/json
+
+[{"id":7171,"randomNumber":351},{"id":6019,"randomNumber":9725},{"id":8118,"randomNumber":4023},{"id":7965,"randomNumber":1388},{"id":7797,"randomNumber":2249},{"id":112,"randomNumber":1108},{"id":6127,"randomNumber":4323},{"id":2597,"randomNumber":7509},{"id":2978,"randomNumber":7883},{"id":1111,"randomNumber":2228}]
+```
+
+[/plaintext](http://www.techempower.com/benchmarks/#section=plaintext)
+----------
+```
+HTTP/1.1 200 OK
+Date: Thu, 03 Jul 2014 10:14:51 GMT
+Server: ULib 
+Content-Type: text/plain
+Content-Length: 13
+
+Hello, World!
+```

+ 124 - 0
frameworks/C++/ulib/benchmark_config.json

@@ -0,0 +1,124 @@
+{
+  "framework": "ulib",
+  "tests": [{
+    "default": {
+      "setup_file": "setup_plaintext",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib",
+      "notes": "",
+      "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": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib",
+      "notes": "",
+      "versus": ""
+    },
+    "mysql": {
+      "setup_file": "setup_mysql",
+      "db_url": "/db",
+      "query_url": "/query?queries=",
+      "fortune_url": "/fortune",
+      "update_url": "/update?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MySQL",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib-mysql",
+      "notes": "",
+      "versus": ""
+    },
+    "postgres": {
+      "setup_file": "setup_postgres",
+      "db_url": "/db",
+      "query_url": "/query?queries=",
+      "fortune_url": "/fortune",
+      "update_url": "/update?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "Postgres",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib-postgres",
+      "notes": "",
+      "versus": ""
+    },
+    "sqlite": {
+      "setup_file": "setup_sqlite",
+      "db_url": "/db",
+      "query_url": "/query?queries=",
+      "fortune_url": "/fortune",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "SQLite",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib-sqlite",
+      "notes": "",
+      "versus": ""
+    },
+    "mongodb": {
+      "setup_file": "setup_mongodb",
+      "db_url": "/mdb",
+      "query_url": "/mquery?queries=",
+      "fortune_url": "/mfortune",
+      "update_url": "/mupdate?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MongoDB",
+      "framework": "ULib",
+      "language": "C++",
+      "orm": "Micro",
+      "platform": "ULib",
+      "webserver": "ULib",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "ULib-mongodb",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 28 - 0
frameworks/C++/ulib/setup_json.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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="58,0,0,41,273,-15,-14,-20,36"
+
+# 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 &

+ 29 - 0
frameworks/C++/ulib/setup_mongodb.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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 MONGODB_HOST=$DBHOST
+export UMEMPOOL="1057,0,0,49,274,-14,-15,-24,40"
+
+# 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 &

+ 30 - 0
frameworks/C++/ulib/setup_mysql.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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 UMEMPOOL="545,0,0,49,275,-14,-13,-25,41"
+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 &

+ 28 - 0
frameworks/C++/ulib/setup_plaintext.sh

@@ -0,0 +1,28 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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="58,0,0,41,16401,-14,-15,11,25"
+
+# 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 &

+ 25 - 0
frameworks/C++/ulib/setup_postgres.sh

@@ -0,0 +1,25 @@
+#!/bin/bash
+
+fw_depends ulib
+
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+
+# 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="pgsql"
+export UMEMPOOL="545,0,0,41,275,-14,-13,-25,41"
+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 &

+ 29 - 0
frameworks/C++/ulib/setup_redis.sh

@@ -0,0 +1,29 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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 REDIS_HOST=$DBHOST
+export UMEMPOOL="1261,0,0,49,274,-14,-15,-24,40"
+
+# 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 &

+ 30 - 0
frameworks/C++/ulib/setup_sqlite.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+
+fw_depends ulib
+
+# Travis is broken
+if [ "$TRAVIS" != "true" ]; then
+MAX_THREADS=$(( 3 * $MAX_THREADS / 2 ))
+else
+MAX_THREADS=$(( 2 * $MAX_THREADS ))
+fi
+
+# 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 UMEMPOOL="545,0,0,49,275,-14,-13,-25,41"
+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 &

+ 16 - 0
frameworks/C++/ulib/source_code

@@ -0,0 +1,16 @@
+./src/db.usp
+./src/rdb.usp
+./src/mdb.usp
+./src/world.h
+./src/json.usp
+./src/fortune.h
+./src/query.usp
+./src/rquery.usp
+./src/mquery.usp
+./src/update.usp
+./src/rupdate.usp
+./src/mupdate.usp
+./src/fortune.usp
+./src/rfortune.usp
+./src/mfortune.usp
+./src/plaintext.usp

+ 2 - 2
frameworks/C++/ULib/src/db.usp → frameworks/C++/ulib/src/db.usp

@@ -23,7 +23,7 @@ static void usp_fork_db()
       {
       pstmt_db = U_NEW(UOrmStatement(*psql_db, U_CONSTANT_TO_PARAM("SELECT randomNumber FROM World WHERE id = ?")));
 
-      if (pstmt_db == 0) U_ERROR("usp_fork_db(): we cound't connect to db");
+      if (pstmt_db == 0) U_WARNING("usp_fork_db(): we cound't connect to db");
 
       pworld_db = U_NEW(World);
 
@@ -55,7 +55,7 @@ static void usp_end_db()
 #endif
 -->
 <!--#header
-Content-Type: application/json; charset=UTF-8
+Content-Type: application/json
 -->
 <!--#code
 pworld_db->id = u_get_num_random(10000);

+ 0 - 0
frameworks/C++/ULib/src/fortune.h → frameworks/C++/ulib/src/fortune.h


+ 80 - 0
frameworks/C++/ulib/src/fortune.usp

@@ -0,0 +1,80 @@
+<!--#
+Test type 4: Fortunes
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "fortune.h"
+
+static Fortune*           pfortune;
+static Fortune*           pfortune2add;
+static UString*           pencoded;
+static UOrmSession*       psql_fortune;
+static UOrmStatement*     pstmt_fortune;
+static UVector<Fortune*>* pvfortune;
+
+static void usp_fork_fortune()
+{
+   U_TRACE(5, "::usp_fork_fortune()")
+
+   psql_fortune = U_NEW(UOrmSession(U_CONSTANT_TO_PARAM("fortune")));
+
+   if (psql_fortune->isReady())
+      {
+      pstmt_fortune = U_NEW(UOrmStatement(*psql_fortune, U_CONSTANT_TO_PARAM("SELECT id, message FROM Fortune")));
+
+      if (pstmt_fortune == 0) U_WARNING("usp_fork_fortune(): we cound't connect to db");
+
+      if (UOrmDriver::isPGSQL()) *psql_fortune << "BEGIN ISOLATION LEVEL SERIALIZABLE; COMMIT";
+
+      pfortune = U_NEW(Fortune);
+
+      pstmt_fortune->into(*pfortune);
+
+      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_fortune()
+{
+   U_TRACE(5, "::usp_end_fortune()")
+
+   if (pstmt_fortune)
+      {
+      delete pstmt_fortune;
+
+      delete pencoded;
+      delete psql_fortune;
+      delete pvfortune;
+      delete pfortune;
+      delete pfortune2add;
+      }
+}
+#endif
+-->
+<!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(*pfortune2add)));
+do { pvfortune->push_back(U_NEW(Fortune(*pfortune))); } while (pstmt_fortune->nextRow());
+
+pvfortune->sort(Fortune::cmp_obj);
+
+for (uint32_t i = 0, n = pvfortune->size(); 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>

+ 1 - 1
frameworks/C++/ULib/src/json.usp → frameworks/C++/ulib/src/json.usp

@@ -36,7 +36,7 @@ static void usp_end_json()
 #endif
 -->
 <!--#header
-Content-Type: application/json; charset=UTF-8
+Content-Type: application/json
 -->
 <!--#code
 #ifndef AS_cpoll_cppsp_DO

+ 81 - 0
frameworks/C++/ulib/src/mdb.usp

@@ -0,0 +1,81 @@
+<!--#
+Test type 2: Single database query
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static World* pworld;
+static UString* jquery;
+static UMongoDBClient* mc;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+#endif
+
+static void usp_fork_mdb()
+{
+   U_TRACE(5, "::usp_fork_mdb()")
+
+   mc = U_NEW(UMongoDBClient);
+
+   if (mc->connect() == false)
+      {
+      U_WARNING("usp_fork_mdb(): connection failed");
+
+      return;
+      }
+
+   if (mc->selectCollection("hello_world", "World") == false)
+      {
+      U_WARNING("usp_fork_mdb(): selectCollection() failed");
+
+      return;
+      }
+
+   pworld = U_NEW(World);
+   jquery = U_NEW(U_STRING_FROM_CONSTANT("{'randomNumber'"));
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue = U_NEW(UValue(OBJECT_VALUE));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_mdb()
+{
+   U_TRACE(5, "::usp_end_mdb()")
+
+   delete mc;
+
+   if (pworld)
+      {
+      delete pworld;
+      delete jquery;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+UString result;
+
+(void) mc->findOne(pworld->id = u_get_num_random(10000));
+
+(void) UValue::jread(mc->vitem[0], *jquery, result); // { "_id" : 8980.000000, "id" : 8980.000000, "randomNumber" : 2131.000000 }
+
+pworld->randomNumber = u_strtoul(result.data(), result.end());
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PRINTF_ADD("{\"id\":%u,\"randomNumber\":%v}", pworld->id, result.rep);
+#else
+USP_JSON_stringify(*pvalue, World, *pworld);
+pvalue->clear();
+#endif
+-->

+ 89 - 0
frameworks/C++/ulib/src/mfortune.usp

@@ -0,0 +1,89 @@
+<!--#
+Test type 4: Fortunes
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "fortune.h"
+
+static UString* jquery;
+static UString* pencoded;
+static UMongoDBClient* mc;
+static Fortune* pfortune2add;
+static UVector<Fortune*>* pvfortune;
+
+static void usp_fork_mfortune()
+{
+   U_TRACE(5, "::usp_fork_mfortune()")
+
+   mc = U_NEW(UMongoDBClient);
+
+   if (mc->connect() == false)
+      {
+      U_WARNING("usp_fork_mfortune(): connection failed");
+
+      return;
+      }
+
+   if (mc->selectCollection("hello_world", "Fortune") == false)
+      {
+      U_WARNING("usp_fork_mfortune(): selectCollection() failed");
+
+      return;
+      }
+
+   jquery       = U_NEW(U_STRING_FROM_CONSTANT("{'message'"));
+   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_mfortune()
+{
+   U_TRACE(5, "::usp_end_mfortune()")
+
+   delete mc;
+
+   if (jquery)
+      {
+      delete jquery;
+      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;
+UString result;
+
+(void) mc->findAll();
+
+pvfortune->push_back(U_NEW(Fortune(*pfortune2add)));
+
+for (i = 0, n = mc->vitem.size(); i < n; ++i)
+   {
+   (void) UValue::jread(mc->vitem[i], *jquery, result); // { "_id" : 5.000000, "id" : 5.000000, "message" : "A computer program does what you tell it to do, not what you want it to do." }
+
+   pvfortune->push_back(U_NEW(Fortune(i+1, result)));
+   }
+
+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>

+ 105 - 0
frameworks/C++/ulib/src/mquery.usp

@@ -0,0 +1,105 @@
+<!--#
+Test type 3: Multiple database queries
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static UString* jquery;
+static UMongoDBClient* mc;
+static World* pworld_query;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+static UVector<World*>* pvworld_query;
+#endif
+
+static void usp_fork_mquery()
+{
+   U_TRACE(5, "::usp_fork_mquery()")
+
+   mc = U_NEW(UMongoDBClient);
+
+   if (mc->connect() == false)
+      {
+      U_WARNING("usp_fork_mquery(): connection disabled or failed");
+
+      return;
+      }
+
+   if (mc->selectCollection("hello_world", "World") == false)
+      {
+      U_WARNING("usp_fork_mquery(): selectCollection() failed");
+
+      return;
+      }
+
+   jquery       = U_NEW(U_STRING_FROM_CONSTANT("{'randomNumber'"));
+   pworld_query = U_NEW(World);
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue        = U_NEW(UValue(ARRAY_VALUE));
+   pvworld_query = U_NEW(UVector<World*>(500));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_mquery()
+{
+   U_TRACE(5, "::usp_end_mquery()")
+
+   delete mc;
+
+   if (jquery)
+      {
+      delete jquery;
+      delete pworld_query;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+      delete pvworld_query;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+UString rnumber;
+int i = 0, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+while (true)
+   {
+   (void) mc->findOne(pworld_query->id = u_get_num_random(10000));
+
+   (void) UValue::jread(mc->vitem[0], *jquery, rnumber); // { "_id" : 8980.000000, "id" : 8980.000000, "randomNumber" : 2131.000000 }
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PRINTF("{\"id\":%u,\"randomNumber\":%v}", pworld_query->id, rnumber.rep);
+#else
+   pworld_query->randomNumber = u_strtoul(rnumber.data(), rnumber.end());
+
+   pvworld_query->push_back(U_NEW(World(*pworld_query)));
+#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_query);
+pvalue->clear();
+pvworld_query->clear();
+#endif
+-->

+ 99 - 0
frameworks/C++/ulib/src/mupdate.usp

@@ -0,0 +1,99 @@
+<!--#
+Test type 5: Database updates
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static UMongoDBClient* mc;
+static World* pworld_update;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+static UVector<World*>* pvworld_update;
+#endif
+
+static void usp_fork_mupdate()
+{
+   U_TRACE(5, "::usp_fork_mupdate()")
+
+   mc = U_NEW(UMongoDBClient);
+
+   if (mc->connect() == false)
+      {
+      U_WARNING("usp_fork_mupdate(): connection disabled or failed");
+
+      return;
+      }
+
+   if (mc->selectCollection("hello_world", "World") == false)
+      {
+      U_WARNING("usp_fork_mupdate(): selectCollection() failed");
+
+      return;
+      }
+
+   pworld_update = U_NEW(World);
+
+#ifndef AS_cpoll_cppsp_DO
+   pvalue         = U_NEW(UValue(ARRAY_VALUE));
+   pvworld_update = U_NEW(UVector<World*>(500));
+#endif
+}
+
+#ifdef DEBUG
+static void usp_end_mupdate()
+{
+   U_TRACE(5, "::usp_end_mupdate()")
+
+   delete mc;
+
+   if (pworld_update)
+      {
+      delete pworld_update;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+      delete pvworld_update;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+int i = 0, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+while (true)
+   {
+   (void) mc->findOne(pworld_update->id = u_get_num_random(10000));
+
+   (void) mc->update(pworld_update->id, "randomNumber", pworld_update->randomNumber = u_get_num_random(10000));
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld_update->id, pworld_update->randomNumber);
+#else
+   pvworld_update->push_back(U_NEW(World(*pworld_update)));
+#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_update);
+pvalue->clear();
+pvworld_update->clear();
+#endif
+-->

+ 0 - 0
frameworks/C++/ULib/src/plaintext.usp → frameworks/C++/ulib/src/plaintext.usp


+ 98 - 0
frameworks/C++/ulib/src/query.usp

@@ -0,0 +1,98 @@
+<!--#
+Test type 3: Multiple database queries
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static World*         pworld_query;
+static UOrmSession*   psql_query;
+static UOrmStatement* pstmt_query;
+
+#ifndef AS_cpoll_cppsp_DO
+static UValue* pvalue;
+static UVector<World*>* pvworld_query;
+#endif
+
+static void usp_fork_query()
+{
+   U_TRACE(5, "::usp_fork_query()")
+
+   psql_query = U_NEW(UOrmSession(U_CONSTANT_TO_PARAM("hello_world")));
+
+   if (psql_query->isReady())
+      {
+      pstmt_query = U_NEW(UOrmStatement(*psql_query, U_CONSTANT_TO_PARAM("SELECT randomNumber FROM World WHERE id = ?")));
+
+      if (pstmt_query == 0) U_WARNING("usp_fork_query(): we cound't connect to db");
+
+      if (UOrmDriver::isPGSQL()) *psql_query << "BEGIN TRANSACTION";
+
+      pworld_query = U_NEW(World);
+
+      pstmt_query->use( pworld_query->id);
+      pstmt_query->into(pworld_query->randomNumber);
+
+#  ifndef AS_cpoll_cppsp_DO
+      pvalue        = U_NEW(UValue(ARRAY_VALUE));
+      pvworld_query = U_NEW(UVector<World*>(500));
+#  endif
+      }
+}
+
+#ifdef DEBUG
+static void usp_end_query()
+{
+   U_TRACE(5, "::usp_end_query()")
+
+   if (pstmt_query)
+      {
+      delete pstmt_query;
+      delete psql_query;
+      delete pworld_query;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+      delete pvworld_query;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+int i = 0, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+while (true)
+   {
+   pworld_query->id = u_get_num_random(10000);
+
+   pstmt_query->execute();
+
+#ifdef AS_cpoll_cppsp_DO
+   USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld_query->id, pworld_query->randomNumber);
+#else
+   pvworld_query->push_back(U_NEW(World(*pworld_query)));
+#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_query);
+pvalue->clear();
+pvworld_query->clear();
+#endif
+-->

+ 73 - 0
frameworks/C++/ulib/src/rdb.usp

@@ -0,0 +1,73 @@
+<!--#
+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
+
+   u__memcpy(u_buffer, "world:", U_CONSTANT_SIZE("world:"), __PRETTY_FUNCTION__);
+}
+
+#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
+-->
+<!--#code
+UStringRep* rep;
+
+(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>

+ 105 - 0
frameworks/C++/ulib/src/rquery.usp

@@ -0,0 +1,105 @@
+<!--#
+Test type 3: Multiple database queries
+TechEmpower Web Framework Benchmarks
+-->
+<!--#declaration
+#include "world.h"
+
+static UREDISClient_Base* rc;
+static UVector<World*>* pvworld_query;
+
+#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_query = 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_query)
+      {
+      delete pvworld_query;
+
+#  ifndef AS_cpoll_cppsp_DO
+      delete pvalue;
+#  endif
+      }
+}
+#endif
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+World* pworld;
+UStringRep* rep;
+char* pbuffer = u_buffer;
+int i, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
+
+#ifdef AS_cpoll_cppsp_DO
+USP_PUTS_CHAR('[');
+#endif
+
+for (i = 0; i < num_queries; ++i)
+   {
+   pvworld_query->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_query->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_query);
+pvalue->clear();
+#endif
+pvworld_query->clear();
+-->

+ 109 - 0
frameworks/C++/ulib/src/rupdate.usp

@@ -0,0 +1,109 @@
+<!--#
+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
+-->
+<!--#header
+Content-Type: application/json
+-->
+<!--#code
+World* pworld;
+char* pbuffer = u_buffer;
+int i, num_queries = UHTTP::getFormFirstNumericValue(1, 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();
+-->

+ 18 - 24
frameworks/C++/ULib/src/update.usp → frameworks/C++/ulib/src/update.usp

@@ -5,14 +5,14 @@ TechEmpower Web Framework Benchmarks
 <!--#declaration
 #include "world.h"
 
-static World*           pworld_update;
-static UOrmSession*     psql_update;
-static UOrmStatement*   pstmt1;
-static UOrmStatement*   pstmt2;
-static UVector<World*>* pvworld_update;
+static World*         pworld_update;
+static UOrmSession*   psql_update;
+static UOrmStatement* pstmt1;
+static UOrmStatement* pstmt2;
 
 #ifndef AS_cpoll_cppsp_DO
 static UValue* pvalue;
+static UVector<World*>* pvworld_update;
 #endif
 
 static void usp_fork_update()
@@ -29,19 +29,20 @@ static void usp_fork_update()
       if (pstmt1 == 0 ||
           pstmt2 == 0)
          {
-         U_ERROR("usp_fork_update(): we cound't connect to db");
+         U_WARNING("usp_fork_update(): we cound't connect to db");
          }
 
+		if (UOrmDriver::isPGSQL()) *psql_update << "SET synchronous_commit TO OFF";
+
       pworld_update = U_NEW(World);
 
       pstmt1->use( pworld_update->id);
       pstmt1->into(pworld_update->randomNumber);
       pstmt2->use( pworld_update->randomNumber, pworld_update->id);
 
-      pvworld_update = U_NEW(UVector<World*>(500));
-
 #  ifndef AS_cpoll_cppsp_DO
-      pvalue = U_NEW(UValue(ARRAY_VALUE));
+      pvalue         = U_NEW(UValue(ARRAY_VALUE));
+      pvworld_update = U_NEW(UVector<World*>(500));
 #  endif
       }
 }
@@ -56,29 +57,22 @@ static void usp_end_update()
       {
       delete pstmt1;
       delete pstmt2;
-
-      delete    psql_update;
-      delete pvworld_update;
-      delete  pworld_update;
+      delete psql_update;
+      delete pworld_update;
 
 #  ifndef AS_cpoll_cppsp_DO
       delete pvalue;
+      delete pvworld_update;
 #  endif
       }
 }
 #endif
 -->
-<!--#args
-queries;
--->
 <!--#header
-Content-Type: application/json; charset=UTF-8
+Content-Type: application/json
 -->
 <!--#code
-int i = 0, num_queries = queries.strtol();
-
-     if (num_queries <   1) num_queries = 1;
-else if (num_queries > 500) num_queries = 500;
+int i = 0, num_queries = UHTTP::getFormFirstNumericValue(1, 500);
 
 #ifdef AS_cpoll_cppsp_DO
 USP_PUTS_CHAR('[');
@@ -96,9 +90,9 @@ while (true)
 
 #ifdef AS_cpoll_cppsp_DO
    USP_PRINTF("{\"id\":%u,\"randomNumber\":%u}", pworld_update->id, pworld_update->randomNumber);
-#endif
-
+#else
    pvworld_update->push_back(U_NEW(World(*pworld_update)));
+#endif
 
    if (++i == num_queries) break;
 
@@ -112,6 +106,6 @@ USP_PUTS_CHAR(']');
 #else
 USP_JSON_stringify(*pvalue, UVector<World*>, *pvworld_update);
 pvalue->clear();
-#endif
 pvworld_update->clear();
+#endif
 -->

+ 0 - 0
frameworks/C++/ULib/src/world.h → frameworks/C++/ulib/src/world.h


+ 2 - 0
frameworks/C++/wt/.gitignore

@@ -0,0 +1,2 @@
+/benchmark.wt
+/benchmark_postgres.wt

+ 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 &

+ 3 - 1
frameworks/C/duda/.gitignore

@@ -1,3 +1,5 @@
 *.o
 *~
-
+/Makefile
+/main.d
+/ws.duda

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

@@ -1,15 +0,0 @@
-#!/bin/bash
-
-RETCODE=$(fw_exists ${IROOT}/duda-0.23.installed)
-[ ! "$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
-
-cd dudac-0.23
-
-./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-0.23
-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 &
+fw_depends haywire
+
+techempower_benchmark 8000 48 &

+ 8 - 0
frameworks/C/libreactor/README.md

@@ -0,0 +1,8 @@
+# libreactor_techempower
+
+Techempower benchmark of libreactor
+
+## Requirements
+
+GCC, Git, Automake
+

+ 23 - 0
frameworks/C/libreactor/benchmark_config.json

@@ -0,0 +1,23 @@
+{
+  "framework": "libreactor",
+  "tests": [{
+    "default": {
+      "setup_file": "setup",
+      "plaintext_url": "/plaintext",
+      "json_url": "/json",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "libreactor",
+      "language": "C",
+      "orm": "Raw",
+      "platform": "libreactor",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "notes": "",
+      "versus": ""
+    }
+  }]
+}

+ 7 - 0
frameworks/C/libreactor/setup.sh

@@ -0,0 +1,7 @@
+#!/bin/bash
+
+fw_depends libreactor
+
+[ "$TRAVIS" == "true" ] || sudo setcap cap_sys_nice,cap_sys_resource+eip $IROOT/libreactor_techempower/rest_server
+
+rest_server &

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

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