Browse Source

Merge pull request #1 from TechEmpower/master

UPDATE
luyikk 6 years ago
parent
commit
3f6214396b
100 changed files with 1080 additions and 1230 deletions
  1. 4 0
      .gitignore
  2. 3 2
      .travis.yml
  3. 8 6
      Dockerfile
  4. 1 1
      README.md
  5. 12 5
      deployment/vagrant/core.rb
  6. 2 2
      frameworks/C++/drogon/benchmark_config.json
  7. 22 7
      frameworks/C++/drogon/drogon-core.dockerfile
  8. 21 7
      frameworks/C++/drogon/drogon.dockerfile
  9. 45 105
      frameworks/C++/drogon/drogon_benchmark/CMakeLists.txt
  10. 0 63
      frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindJsoncpp.cmake
  11. 0 114
      frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindMySQL.cmake
  12. 0 37
      frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindSQLite3.cmake
  13. 0 119
      frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindUUID.cmake
  14. 2 2
      frameworks/C++/drogon/drogon_benchmark/config-core.json
  15. 20 22
      frameworks/C++/drogon/drogon_benchmark/config.json
  16. 21 18
      frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrl.cc
  17. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrl.h
  18. 8 4
      frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrlRaw.cc
  19. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrlRaw.h
  20. 32 26
      frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrl.cc
  21. 6 4
      frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrl.h
  22. 33 27
      frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrlRaw.cc
  23. 6 4
      frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrlRaw.h
  24. 5 3
      frameworks/C++/drogon/drogon_benchmark/controllers/JsonCtrl.cc
  25. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/JsonCtrl.h
  26. 3 2
      frameworks/C++/drogon/drogon_benchmark/controllers/PlaintextCtrl.cc
  27. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/PlaintextCtrl.h
  28. 24 21
      frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrl.cc
  29. 5 3
      frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrl.h
  30. 27 14
      frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrlRaw.cc
  31. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrlRaw.h
  32. 40 32
      frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrl.cc
  33. 5 3
      frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrl.h
  34. 44 35
      frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrlRaw.cc
  35. 7 5
      frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrlRaw.h
  36. 2 3
      frameworks/C++/drogon/drogon_benchmark/main.cc
  37. 37 38
      frameworks/C++/drogon/drogon_benchmark/models/Fortune.cc
  38. 27 21
      frameworks/C++/drogon/drogon_benchmark/models/Fortune.h
  39. 37 38
      frameworks/C++/drogon/drogon_benchmark/models/World.cc
  40. 27 21
      frameworks/C++/drogon/drogon_benchmark/models/World.h
  41. 51 0
      frameworks/C++/drogon/drogon_benchmark/plugins/SyncPlugin.cc
  42. 24 0
      frameworks/C++/drogon/drogon_benchmark/plugins/SyncPlugin.h
  43. 7 11
      frameworks/C++/drogon/drogon_benchmark/views/fortune.csp
  44. 8 12
      frameworks/C++/drogon/drogon_benchmark/views/fortune_raw.csp
  45. 2 2
      frameworks/C/h2o/h2o.dockerfile
  46. 3 17
      frameworks/C/h2o/h2o.sh
  47. 4 11
      frameworks/C/h2o/src/database.c
  48. 2 4
      frameworks/C/h2o/src/event_loop.c
  49. 24 28
      frameworks/C/h2o/src/handlers/fortune.c
  50. 111 122
      frameworks/C/h2o/src/handlers/world.c
  51. 2 4
      frameworks/C/h2o/src/main.c
  52. 5 1
      frameworks/C/h2o/src/thread.c
  53. 5 2
      frameworks/C/h2o/src/tls.c
  54. 6 8
      frameworks/C/h2o/src/utility.c
  55. 37 0
      frameworks/CSharp/.gitignore
  56. 2 2
      frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-jn.dockerfile
  57. 2 2
      frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my-ef.dockerfile
  58. 2 2
      frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my.dockerfile
  59. 2 2
      frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-ss.dockerfile
  60. 2 2
      frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx.dockerfile
  61. 1 1
      frameworks/CSharp/aspnet-mono-ngx/nginx.conf
  62. 8 7
      frameworks/CSharp/aspnet-mono-ngx/run.sh
  63. 2 2
      frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.build.proj
  64. 36 25
      frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.csproj
  65. 5 2
      frameworks/CSharp/aspnet-mono-ngx/src/Controllers/AdoController.cs
  66. 5 2
      frameworks/CSharp/aspnet-mono-ngx/src/Controllers/EntityFrameworkController.cs
  67. 21 19
      frameworks/CSharp/aspnet-mono-ngx/src/Web.config
  68. 0 0
      frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csproj.CoreCompileInputs.cache
  69. BIN
      frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csprojAssemblyReference.cache
  70. 0 0
      frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
  71. 0 0
      frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
  72. 0 0
      frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
  73. 15 12
      frameworks/CSharp/aspnet-mono-ngx/src/packages.config
  74. 1 2
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/AsciiString.cs
  75. 24 9
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs
  76. 31 3
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs
  77. 1 1
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferExtensions.cs
  78. 1 0
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferWriter.cs
  79. 4 5
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/DateHeader.cs
  80. 1 0
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/NuGet.Config
  81. 5 2
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/PlatformBenchmarks.csproj
  82. 6 8
      frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/rd.xml
  83. 14 0
      frameworks/CSharp/aspnetcore-corert/aspcore-corert-rhtx.dockerfile
  84. 6 3
      frameworks/CSharp/aspnetcore-corert/aspcore-corert.dockerfile
  85. 1 1
      frameworks/CSharp/aspnetcore-corert/benchmark_config.json
  86. 1 16
      frameworks/CSharp/aspnetcore-mono/Benchmarks/Benchmarks.csproj
  87. 1 15
      frameworks/CSharp/aspnetcore-mono/PlatformBenchmarks/PlatformBenchmarks.csproj
  88. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-ef-pg.dockerfile
  89. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-my.dockerfile
  90. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-pg.dockerfile
  91. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc.dockerfile
  92. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-ef-pg.dockerfile
  93. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-my.dockerfile
  94. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-pg.dockerfile
  95. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw.dockerfile
  96. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-my.dockerfile
  97. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono-pg.dockerfile
  98. 1 1
      frameworks/CSharp/aspnetcore-mono/aspcore-mono.dockerfile
  99. 7 7
      frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj
  100. 0 6
      frameworks/CSharp/aspnetcore/Benchmarks/Configuration/Scenarios.cs

+ 4 - 0
.gitignore

@@ -107,3 +107,7 @@ build/
 _build/
 _build/
 deps/
 deps/
 frameworks/PHP/ubiquity/.buildpath
 frameworks/PHP/ubiquity/.buildpath
+
+# swift
+Package.resolved
+.swiftpm

+ 3 - 2
.travis.yml

@@ -27,6 +27,7 @@ env:
     - "TESTLANG=Crystal"
     - "TESTLANG=Crystal"
     - "TESTLANG=D"
     - "TESTLANG=D"
     - "TESTLANG=Dart"
     - "TESTLANG=Dart"
+    - "TESTLANG=Dylan"
     - "TESTLANG=Elixir"
     - "TESTLANG=Elixir"
     - "TESTLANG=Erlang"
     - "TESTLANG=Erlang"
     - "TESTLANG=FSharp"
     - "TESTLANG=FSharp"
@@ -99,8 +100,8 @@ env:
     - "TESTLANG=Nim"
     - "TESTLANG=Nim"
     - "TESTLANG=Perl"
     - "TESTLANG=Perl"
     - 'TESTDIR="PHP/php"'
     - 'TESTDIR="PHP/php"'
-    - 'TESTDIR="PHP/cakephp PHP/codeigniter PHP/fat-free PHP/fuel PHP/kumbiaphp PHP/laravel PHP/lithium PHP/lumen PHP/phpixie PHP/slim PHP/symfony PHP/ubiquity PHP/yii2 PHP/zend"'
-    - 'TESTDIR="PHP/amp PHP/hamlet PHP/hhvm PHP/peachpie PHP/swoole PHP/workerman PHP/phalcon"'
+    - 'TESTDIR="PHP/cakephp PHP/codeigniter PHP/fat-free PHP/fuel PHP/kumbiaphp PHP/phpixie PHP/slim PHP/symfony PHP/yii2 PHP/zend"'
+    - 'TESTDIR="PHP/amp PHP/hamlet PHP/laravel PHP/lumen PHP/hhvm PHP/peachpie PHP/swoole PHP/workerman PHP/phalcon PHP/ubiquity PHP/hyperf"'
     - 'TESTDIR="Python/aiohttp Python/api_hour Python/blacksheep Python/bottle Python/cherrypy Python/django Python/eve Python/falcon Python/fastapi Python/flask"'
     - 'TESTDIR="Python/aiohttp Python/api_hour Python/blacksheep Python/bottle Python/cherrypy Python/django Python/eve Python/falcon Python/fastapi Python/flask"'
     - 'TESTDIR="Python/hug Python/japronto Python/klein Python/morepath Python/pyramid Python/quart Python/responder Python/sanic Python/spyne Python/starlette"'
     - 'TESTDIR="Python/hug Python/japronto Python/klein Python/morepath Python/pyramid Python/quart Python/responder Python/sanic Python/spyne Python/starlette"'
     - 'TESTDIR="Python/tornado Python/turbogears Python/uvicorn Python/uwsgi Python/vibora Python/web2py Python/webware Python/weppy Python/wsgi"'
     - 'TESTDIR="Python/tornado Python/turbogears Python/uvicorn Python/uwsgi Python/vibora Python/web2py Python/webware Python/weppy Python/wsgi"'

+ 8 - 6
Dockerfile

@@ -1,20 +1,22 @@
-FROM ubuntu:16.04
+FROM buildpack-deps:bionic
 
 
 # One -q produces output suitable for logging (mostly hides
 # One -q produces output suitable for logging (mostly hides
 # progress indicators)
 # progress indicators)
-RUN apt update -yqq
+RUN apt-get -yqq update
 
 
 # WARNING: DONT PUT A SPACE AFTER ANY BACKSLASH OR APT WILL BREAK
 # WARNING: DONT PUT A SPACE AFTER ANY BACKSLASH OR APT WILL BREAK
-RUN apt -qqy install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
+RUN apt-get -yqq install -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
   git-core \
   git-core \
   cloc dstat                    `# Collect resource usage statistics` \
   cloc dstat                    `# Collect resource usage statistics` \
   python-dev \
   python-dev \
   python-pip \
   python-pip \
   software-properties-common \
   software-properties-common \
-  libmysqlclient-dev            `# Needed for MySQL-python` \
-  libpq-dev                     `# Needed for psycopg2`
+  libmysqlclient-dev            `# Needed for MySQL-python`
 
 
-RUN pip install colorama==0.3.1 requests MySQL-python psycopg2-binary pymongo docker==3.5.0 psutil
+RUN pip install colorama==0.3.1 requests MySQL-python psycopg2-binary pymongo docker==4.0.2 psutil
+
+# Fix for docker-py trying to import one package from the wrong location
+RUN cp -r /usr/local/lib/python2.7/dist-packages/backports/ssl_match_hostname/ /usr/lib/python2.7/dist-packages/backports
 
 
 ENV PYTHONPATH /FrameworkBenchmarks
 ENV PYTHONPATH /FrameworkBenchmarks
 ENV FWROOT /FrameworkBenchmarks
 ENV FWROOT /FrameworkBenchmarks

+ 1 - 1
README.md

@@ -4,7 +4,7 @@
 
 
 If you're new to the project, welcome! Please feel free to ask questions [here](https://github.com/TechEmpower/FrameworkBenchmarks/issues/2978). We encourage new frameworks and contributors to ask questions. We're here to help!
 If you're new to the project, welcome! Please feel free to ask questions [here](https://github.com/TechEmpower/FrameworkBenchmarks/issues/2978). We encourage new frameworks and contributors to ask questions. We're here to help!
 
 
-This project provides representative performance measures across a wide field of web application frameworks. With much help from the community, coverage is quite broad and we are happy to broaden it further with contributions. The project presently includes frameworks on many languages including `Go`, `Python`, `Java`, `Ruby`, `PHP`, `C#`, `Clojure`, `Groovy`, `Dart`, `JavaScript`, `Erlang`, `Haskell`, `Scala`, `Perl`, `Lua`, `C`, and others.  The current tests exercise plaintext responses, JSON serialization, database reads and writes via the object-relational mapper (ORM), collections, sorting, server-side templates, and XSS counter-measures. Future tests will exercise other components and greater computation.
+This project provides representative performance measures across a wide field of web application frameworks. With much help from the community, coverage is quite broad and we are happy to broaden it further with contributions. The project presently includes frameworks on many languages including `Go`, `Python`, `Java`, `Ruby`, `PHP`, `C#`, `F#`,`Clojure`, `Groovy`, `Dart`, `JavaScript`, `Erlang`, `Haskell`, `Scala`, `Perl`, `Lua`, `C`, and others.  The current tests exercise plaintext responses, JSON serialization, database reads and writes via the object-relational mapper (ORM), collections, sorting, server-side templates, and XSS counter-measures. Future tests will exercise other components and greater computation.
 
 
 [Read more and see the results of our tests on cloud and physical hardware](http://www.techempower.com/benchmarks/). For descriptions of the test types that we run, see the 
 [Read more and see the results of our tests on cloud and physical hardware](http://www.techempower.com/benchmarks/). For descriptions of the test types that we run, see the 
 [test requirements section](https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview).
 [test requirements section](https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview).

+ 12 - 5
deployment/vagrant/core.rb

@@ -1,6 +1,6 @@
 def provision_bootstrap(config)
 def provision_bootstrap(config)
 
 
-  # TODO this will break if the environment contains the ' delimiter, 
+  # TODO this will break if the environment contains the ' delimiter,
   # so at some point we need to escape the ' character here and unescape
   # so at some point we need to escape the ' character here and unescape
   # it in bootstrap.sh
   # it in bootstrap.sh
   config.vm.provision "shell" do |sh|
   config.vm.provision "shell" do |sh|
@@ -30,6 +30,13 @@ def provider_virtualbox(config)
     override.vm.hostname = "TFB-all"
     override.vm.hostname = "TFB-all"
     override.vm.box = "ubuntu/xenial64"
     override.vm.box = "ubuntu/xenial64"
 
 
+    # Allow increase in size for /dev/sda1
+    # Would need plugin:
+    #  vagrant plugin install vagrant-disksize
+    if ENV.fetch('TFB_DISKSIZE', "0") != "0"
+      override.disksize.size = ENV.fetch('TFB_DISKSIZE')
+    end
+
     if ENV.fetch('TFB_SHOW_VM', false)
     if ENV.fetch('TFB_SHOW_VM', false)
       vb.gui = true
       vb.gui = true
     end
     end
@@ -43,12 +50,12 @@ def provider_virtualbox(config)
     vb.cpus = ENV.fetch('TFB_VB_CPU', 2)
     vb.cpus = ENV.fetch('TFB_VB_CPU', 2)
 
 
     # The VirtualBox file system for shared folders (vboxfs)
     # The VirtualBox file system for shared folders (vboxfs)
-    # does not support posix's chown/chmod - these can only 
+    # does not support posix's chown/chmod - these can only
     # be set at mount time, and they are uniform for the entire
     # be set at mount time, and they are uniform for the entire
-    # shared directory. To mitigate the effects, we set the 
-    # folders and files to 777 permissions. 
+    # shared directory. To mitigate the effects, we set the
+    # folders and files to 777 permissions.
     # With 777 and owner vagrant *most* of the software works ok.
     # With 777 and owner vagrant *most* of the software works ok.
-    # Occasional issues are still possible. 
+    # Occasional issues are still possible.
     #
     #
     # See mitchellh/vagrant#4997
     # See mitchellh/vagrant#4997
     # See http://superuser.com/a/640028/136050
     # See http://superuser.com/a/640028/136050

+ 2 - 2
frameworks/C++/drogon/benchmark_config.json

@@ -25,7 +25,7 @@
         "notes": "",
         "notes": "",
         "versus": "None"
         "versus": "None"
       },
       },
-      "raw": {
+      "core": {
         "db_url": "/db",
         "db_url": "/db",
         "fortune_url": "/fortunes",
         "fortune_url": "/fortunes",
         "query_url": "/queries?queries=",
         "query_url": "/queries?queries=",
@@ -48,4 +48,4 @@
       }
       }
     }
     }
   ]
   ]
-}
+}

+ 22 - 7
frameworks/C++/drogon/drogon-raw.dockerfile → frameworks/C++/drogon/drogon-core.dockerfile

@@ -7,9 +7,8 @@ RUN  apt update -yqq && \
 	 apt install -yqq sudo curl wget cmake locales git \
 	 apt install -yqq sudo curl wget cmake locales git \
      openssl libssl-dev \
      openssl libssl-dev \
      libjsoncpp-dev \
      libjsoncpp-dev \
-     uuid-dev \
-     zlib1g-dev \
-	 postgresql-server-dev-all && \
+     uuid-dev libreadline-dev libbison-dev flex \
+     zlib1g-dev && \
      add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
      add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
 	 apt update -yqq && \
 	 apt update -yqq && \
 	 apt install -yqq gcc-8 g++-8
 	 apt install -yqq gcc-8 g++-8
@@ -27,19 +26,35 @@ ENV RANLIB=gcc-ranlib-8
 
 
 ENV IROOT=/install
 ENV IROOT=/install
 ENV DROGON_ROOT=$IROOT/drogon
 ENV DROGON_ROOT=$IROOT/drogon
+ENV PG_ROOT=$IROOT/postgres-batch_mode_ubuntu
 ENV TEST_PATH=/drogon_benchmark/build
 ENV TEST_PATH=/drogon_benchmark/build
+
+WORKDIR $IROOT
+
+RUN wget https://github.com/an-tao/postgres/archive/batch_mode_ubuntu.tar.gz
+RUN tar -xvzf batch_mode_ubuntu.tar.gz
+WORKDIR $PG_ROOT
+
+RUN ./configure --prefix=/usr CFLAGS='-O2 -pipe'
+RUN make && make install
+
 WORKDIR $IROOT
 WORKDIR $IROOT
 
 
 RUN git clone https://github.com/an-tao/drogon
 RUN git clone https://github.com/an-tao/drogon
 
 
 WORKDIR $DROGON_ROOT
 WORKDIR $DROGON_ROOT
 
 
-RUN git checkout 32836a0fef0a9a1061ac92ef87bd269edb2e1734
+RUN git checkout aa26e9a90388b6a6fe5356e2d12b6f6091c82818
+RUN git submodule update --init
+RUN mkdir build
+
+WORKDIR $DROGON_ROOT/build
 
 
-RUN ./build.sh
+RUN cmake -DCMAKE_BUILD_TYPE=release ..
+RUN make && make install
 
 
 WORKDIR $TEST_PATH
 WORKDIR $TEST_PATH
 
 
-RUN cmake ..
+RUN cmake -DCMAKE_BUILD_TYPE=release ..
 RUN make
 RUN make
-CMD ./drogon_benchmark config-raw.json
+CMD ./drogon_benchmark config-core.json

+ 21 - 7
frameworks/C++/drogon/drogon.dockerfile

@@ -7,9 +7,8 @@ RUN  apt update -yqq && \
 	 apt install -yqq sudo curl wget cmake locales git \
 	 apt install -yqq sudo curl wget cmake locales git \
      openssl libssl-dev \
      openssl libssl-dev \
      libjsoncpp-dev \
      libjsoncpp-dev \
-     uuid-dev \
-     zlib1g-dev \
-	 postgresql-server-dev-all && \
+     uuid-dev libreadline-dev libbison-dev flex \
+     zlib1g-dev && \
      add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
      add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
 	 apt update -yqq && \
 	 apt update -yqq && \
 	 apt install -yqq gcc-8 g++-8
 	 apt install -yqq gcc-8 g++-8
@@ -27,20 +26,35 @@ ENV RANLIB=gcc-ranlib-8
 
 
 ENV IROOT=/install
 ENV IROOT=/install
 ENV DROGON_ROOT=$IROOT/drogon
 ENV DROGON_ROOT=$IROOT/drogon
+ENV PG_ROOT=$IROOT/postgres-batch_mode_ubuntu
 ENV TEST_PATH=/drogon_benchmark/build
 ENV TEST_PATH=/drogon_benchmark/build
+
+WORKDIR $IROOT
+
+RUN wget https://github.com/an-tao/postgres/archive/batch_mode_ubuntu.tar.gz
+RUN tar -xvzf batch_mode_ubuntu.tar.gz
+WORKDIR $PG_ROOT
+
+RUN ./configure --prefix=/usr CFLAGS='-O2 -pipe'
+RUN make && make install
+
 WORKDIR $IROOT
 WORKDIR $IROOT
 
 
 RUN git clone https://github.com/an-tao/drogon
 RUN git clone https://github.com/an-tao/drogon
 
 
 WORKDIR $DROGON_ROOT
 WORKDIR $DROGON_ROOT
 
 
-RUN git checkout 32836a0fef0a9a1061ac92ef87bd269edb2e1734
+RUN git checkout aa26e9a90388b6a6fe5356e2d12b6f6091c82818
+RUN git submodule update --init
+RUN mkdir build
+
+WORKDIR $DROGON_ROOT/build
 
 
-RUN ./build.sh
+RUN cmake -DCMAKE_BUILD_TYPE=release ..
+RUN make && make install
 
 
 WORKDIR $TEST_PATH
 WORKDIR $TEST_PATH
 
 
-RUN cmake ..
+RUN cmake -DCMAKE_BUILD_TYPE=release ..
 RUN make
 RUN make
 CMD ./drogon_benchmark config.json
 CMD ./drogon_benchmark config.json
-

+ 45 - 105
frameworks/C++/drogon/drogon_benchmark/CMakeLists.txt

@@ -1,110 +1,50 @@
-cmake_minimum_required(VERSION 3.2)
-Project(drogon_benchmark)
-
-link_directories(/usr/local/lib)
-link_libraries(drogon trantor pthread dl)
-
-IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
-    EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g' | sed s'/-.*//g'" OUTPUT_VARIABLE version)
-    MESSAGE(STATUS "This is gcc version:: " ${version})
-    if(version LESS 5.4.0)
-        MESSAGE(STATUS "gcc is too old")
-        stop()
-    elseif(version LESS 7.1.0)
-        set(CMAKE_CXX_STD_FLAGS c++14)
-        MESSAGE(STATUS "c++14")
-    else()
-        set(CMAKE_CXX_STD_FLAGS c++17)
-        set(DR_DEFS "USE_STD_ANY")
-        MESSAGE(STATUS "c++17")
-    endif()
-else()
-    set(CMAKE_CXX_STD_FLAGS c++17)
-endif()
-
-if(CMAKE_BUILD_TYPE STREQUAL "")
-    set(CMAKE_BUILD_TYPE Release)
-endif()
-
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -std=${CMAKE_CXX_STD_FLAGS}")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -std=${CMAKE_CXX_STD_FLAGS}")
-
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/)
-
-#jsoncpp
-find_package (Jsoncpp REQUIRED)
-include_directories(${JSONCPP_INCLUDE_DIRS})
-link_libraries(${JSONCPP_LIBRARIES})
-
-#uuid
-find_package (UUID REQUIRED)
-include_directories(${UUID_INCLUDE_DIR})
-link_libraries(${UUID_LIBRARIES})
-
-#OpenSSL
-find_package (OpenSSL)
-if(OpenSSL_FOUND)
-    include_directories(${OPENSSL_INCLUDE_DIR})
-    link_libraries(${OPENSSL_LIBRARIES})
-endif()
-
-#zlib
-find_package(ZLIB REQUIRED)
-include_directories(${ZLIB_INCLUDE_DIR})
-link_libraries(${ZLIB_LIBRARIES})
-
-#find postgres
-find_package(PostgreSQL)
-if(PostgreSQL_FOUND)
-include_directories(${PostgreSQL_INCLUDE_DIR})
-link_libraries(${PostgreSQL_LIBRARIES})
-endif()
-
-#Find mysql, only mariadb client liberary is supported
-find_package(MySQL)
-if(MYSQL_FOUND)
-    message(STATUS "inc:" ${MYSQL_INCLUDE_DIR})
-    message(STATUS "libs:" ${MYSQL_CLIENT_LIBS})
-    message(STATUS "version:" ${MYSQL_VERSION_STRING})
-    if(MYSQL_VERSION_STRING STREQUAL "")
-        message(STATUS "The mysql in your system is not the mariadb, so we can't use it in drogon")
-    else()
-        message(STATUS "Ok! We find the mariadb!")
-        include_directories(${MYSQL_INCLUDE_DIR})
-        link_libraries(${MYSQL_CLIENT_LIBS})
-    endif()
-endif()
-
-#Find sqlite3.
-find_package (SQLite3)
-if (SQLITE3_FOUND)
-  include_directories(${SQLITE3_INCLUDE_DIRS})
-  link_libraries(${SQLITE3_LIBRARIES})
-endif()
-
-AUX_SOURCE_DIRECTORY(./ SRC_DIR)
-AUX_SOURCE_DIRECTORY(controllers CTL_SRC)
-AUX_SOURCE_DIRECTORY(filters FILTER_SRC)
-AUX_SOURCE_DIRECTORY(models MODEL_SRC)
-
-include_directories(/usr/local/include)
-
-FILE(GLOB SCP_LIST ${CMAKE_CURRENT_SOURCE_DIR}/views/*.csp)
+cmake_minimum_required(VERSION 3.5)
+project(drogon_benchmark)
+
+set(CMAKE_CXX_STANDARD 17)
+set(BENCHMARK_SOURCES
+    main.cc
+    controllers/DbCtrl.cc
+    controllers/DbCtrlRaw.cc
+    controllers/FortuneCtrl.cc
+    controllers/FortuneCtrlRaw.cc
+    controllers/QueriesCtrl.cc
+    controllers/QueriesCtrlRaw.cc
+    controllers/UpdatesCtrl.cc
+    controllers/UpdatesCtrlRaw.cc
+    models/Fortune.cc
+    models/World.cc
+    plugins/SyncPlugin.cc)
+
+file(GLOB SCP_LIST ${CMAKE_CURRENT_SOURCE_DIR}/views/*.csp)
 foreach(cspFile ${SCP_LIST})
 foreach(cspFile ${SCP_LIST})
-    message(STATUS "cspFile:" ${cspFile})
-    EXEC_PROGRAM(basename ARGS "${cspFile} .csp" OUTPUT_VARIABLE classname)
-    message(STATUS "view classname:" ${classname})
-    add_custom_command(OUTPUT ${classname}.h ${classname}.cc
-            COMMAND drogon_ctl
-            ARGS create view ${cspFile}
-            DEPENDS ${cspFile}
-            VERBATIM )
-    set(VIEWSRC ${VIEWSRC} ${classname}.cc)
+  message(STATUS "cspFile:" ${cspFile})
+  exec_program(basename
+               ARGS
+               "${cspFile} .csp"
+               OUTPUT_VARIABLE
+               classname)
+  message(STATUS "view classname:" ${classname})
+  add_custom_command(OUTPUT ${classname}.h ${classname}.cc
+                     COMMAND drogon_ctl
+                             ARGS
+                             create
+                             view
+                             ${cspFile}
+                     DEPENDS ${cspFile}
+                     VERBATIM)
+  set(BENCHMARK_SOURCES ${BENCHMARK_SOURCES} ${classname}.cc)
 endforeach()
 endforeach()
 
 
-include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-add_executable(drogon_benchmark ${SRC_DIR} ${CTL_SRC} ${FILTER_SRC} ${VIEWSRC} ${MODEL_SRC})
+add_executable(${PROJECT_NAME} ${BENCHMARK_SOURCES})
+find_package(Drogon REQUIRED)
+target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon)
+
+target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
 
 
 add_custom_command(TARGET drogon_benchmark POST_BUILD
 add_custom_command(TARGET drogon_benchmark POST_BUILD
-                   COMMAND ${CMAKE_COMMAND} -E copy_if_different
-                   ${CMAKE_SOURCE_DIR}/*.json $<TARGET_FILE_DIR:drogon_benchmark>)
+                   COMMAND ${CMAKE_COMMAND}
+                           -E
+                           copy_if_different
+                           ${CMAKE_SOURCE_DIR}/*.json
+                           $<TARGET_FILE_DIR:drogon_benchmark>)

+ 0 - 63
frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindJsoncpp.cmake

@@ -1,63 +0,0 @@
-# Find jsoncpp
-#
-# Find the jsoncpp includes and library
-# 
-# if you nee to add a custom library search path, do it via via CMAKE_PREFIX_PATH 
-# 
-# This module defines
-#  JSONCPP_INCLUDE_DIRS, where to find header, etc.
-#  JSONCPP_LIBRARIES, the libraries needed to use jsoncpp.
-#  JSONCPP_FOUND, If false, do not try to use jsoncpp.
-#  JSONCPP_INCLUDE_PREFIX, include prefix for jsoncpp
-
-# only look in default directories
-find_path(
-	JSONCPP_INCLUDE_DIR 
-	NAMES jsoncpp/json/json.h json/json.h
-	DOC "jsoncpp include dir"
-)
-
-find_library(
-	JSONCPP_LIBRARY
-	NAMES jsoncpp
-	DOC "jsoncpp library"
-)
-
-set(JSONCPP_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR})
-set(JSONCPP_LIBRARIES ${JSONCPP_LIBRARY})
-
-# debug library on windows
-# same naming convention as in qt (appending debug library with d)
-# boost is using the same "hack" as us with "optimized" and "debug"
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
-	find_library(
-		JSONCPP_LIBRARY_DEBUG
-		NAMES jsoncppd
-		DOC "jsoncpp debug library"
-	)
-	
-	set(JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARIES} debug ${JSONCPP_LIBRARY_DEBUG})
-
-endif()
-
-# find JSONCPP_INCLUDE_PREFIX
-find_path(
-	JSONCPP_INCLUDE_PREFIX
-	NAMES json.h
-	PATH_SUFFIXES jsoncpp/json json
-)
-
-if (${JSONCPP_INCLUDE_PREFIX} MATCHES "jsoncpp")
-	set(JSONCPP_INCLUDE_PREFIX "jsoncpp")
-	set(JSONCPP_INCLUDE_DIRS "${JSONCPP_INCLUDE_DIRS}/jsoncpp")
-else()
-	set(JSONCPP_INCLUDE_PREFIX "")
-endif()
-
-
-# handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE
-# if all listed variables are TRUE, hide their existence from configuration view
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(jsoncpp DEFAULT_MSG
-	JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
-mark_as_advanced (JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)

+ 0 - 114
frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindMySQL.cmake

@@ -1,114 +0,0 @@
-#--------------------------------------------------------
-# Copyright (C) 1995-2007 MySQL AB
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of version 2 of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# There are special exceptions to the terms and conditions of the GPL
-# as it is applied to this software. View the full text of the exception
-# in file LICENSE.exceptions in the top-level directory of this software
-# distribution.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-#
-# The MySQL Connector/ODBC is licensed under the terms of the
-# GPL, like most MySQL Connectors. There are special exceptions
-# to the terms and conditions of the GPL as it is applied to
-# this software, see the FLOSS License Exception available on
-# mysql.com.
-
-##########################################################################
-
-
-#-------------- FIND MYSQL_INCLUDE_DIR ------------------
-FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
-  /usr/include/mysql
-  /usr/local/include/mysql
-  /opt/mysql/mysql/include
-  /opt/mysql/mysql/include/mysql
-  /opt/mysql/include
-  /opt/local/include/mysql5
-  /usr/local/mysql/include
-  /usr/local/mysql/include/mysql
-  $ENV{ProgramFiles}/MySQL/*/include
-  $ENV{SystemDrive}/MySQL/*/include)
-
-#----------------- FIND MYSQL_LIB_DIR -------------------
-IF (WIN32)
-  # Set lib path suffixes
-  # dist = for mysql binary distributions
-  # build = for custom built tree
-  IF (CMAKE_BUILD_TYPE STREQUAL Debug)
-    SET(libsuffixDist debug)
-    SET(libsuffixBuild Debug)
-  ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
-    SET(libsuffixDist opt)
-    SET(libsuffixBuild Release)
-    ADD_DEFINITIONS(-DDBUG_OFF)
-  ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
-
-  FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
-    PATHS
-    $ENV{MYSQL_DIR}/lib/${libsuffixDist}
-    $ENV{MYSQL_DIR}/libmysql
-    $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
-    $ENV{MYSQL_DIR}/client/${libsuffixBuild}
-    $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
-    $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
-    $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
-ELSE (WIN32)
-  FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r mariadbclient
-    PATHS
-    /usr/lib/mysql
-    /usr/local/lib/mysql
-    /usr/local/mysql/lib
-    /usr/local/mysql/lib/mysql
-    /opt/local/mysql5/lib
-    /opt/local/lib/mysql5/mysql
-    /opt/mysql/mysql/lib/mysql
-    /opt/mysql/lib/mysql)
-ENDIF (WIN32)
-
-IF(MYSQL_LIB)
-  GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
-ENDIF(MYSQL_LIB)
-
-set(MYSQL_VERSION_STRING "")
-
-EXEC_PROGRAM (grep ARGS "MARIADB_BASE_VERSION ${MYSQL_INCLUDE_DIR}/*.h|awk '{print $3}'" OUTPUT_VARIABLE MYSQL_VERSION_STRING)
-
-IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
-  SET(MYSQL_FOUND TRUE)
-
-  FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
-  FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
-  IF (MYSQL_LIB)
-    SET(MYSQL_CLIENT_LIBS ${MYSQL_LIB})
-  ELSE()
-    SET(MYSQL_CLIENT_LIBS mysqlclient_r)
-  ENDIF()
-  IF (MYSQL_ZLIB)
-    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
-  ENDIF (MYSQL_ZLIB)
-  IF (MYSQL_TAOCRYPT)
-    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
-  ENDIF (MYSQL_TAOCRYPT)
-  # Added needed mysqlclient dependencies on Windows
-  IF (WIN32)
-    SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
-  ENDIF (WIN32)
-
-  MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
-  MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
-ELSEIF (MySQL_FIND_REQUIRED)
-  MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
-ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)

+ 0 - 37
frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindSQLite3.cmake

@@ -1,37 +0,0 @@
-# Copyright (C) 2007-2009 LuaDist.
-# Created by Peter Kapec <[email protected]>
-# Redistribution and use of this file is allowed according to the terms of the MIT license.
-# For details see the COPYRIGHT file distributed with LuaDist.
-#	Note:
-#		Searching headers and libraries is very simple and is NOT as powerful as scripts
-#		distributed with CMake, because LuaDist defines directories to search for.
-#		Everyone is encouraged to contact the author with improvements. Maybe this file
-#		becomes part of CMake distribution sometimes.
-
-# - Find sqlite3
-# Find the native SQLITE3 headers and libraries.
-#
-# SQLITE3_INCLUDE_DIRS	- where to find sqlite3.h, etc.
-# SQLITE3_LIBRARIES	- List of libraries when using sqlite.
-# SQLITE3_FOUND	- True if sqlite found.
-
-# Look for the header file.
-FIND_PATH(SQLITE3_INCLUDE_DIR NAMES sqlite3.h)
-
-# Look for the library.
-FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3)
-
-# Handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if all listed variables are TRUE.
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
-
-# Copy the results to the output variables.
-IF(SQLITE3_FOUND)
-	SET(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
-	SET(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
-ELSE(SQLITE3_FOUND)
-	SET(SQLITE3_LIBRARIES)
-	SET(SQLITE3_INCLUDE_DIRS)
-ENDIF(SQLITE3_FOUND)
-
-MARK_AS_ADVANCED(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)

+ 0 - 119
frameworks/C++/drogon/drogon_benchmark/cmake_modules/FindUUID.cmake

@@ -1,119 +0,0 @@
-# - Try to find UUID
-# Once done this will define
-#
-# UUID_FOUND - system has UUID
-# UUID_INCLUDE_DIRS - the UUID include directory
-# UUID_LIBRARIES - Link these to use UUID
-# UUID_DEFINITIONS - Compiler switches required for using UUID
-#
-# Copyright (c) 2006 Andreas Schneider <[email protected]>
-#
-# Redistribution and use is allowed according to the terms of the New
-# BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-
-
-if (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
-	# in cache already
-	set(UUID_FOUND TRUE)
-else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
-	find_path(UUID_INCLUDE_DIR
-		NAMES
-			uuid.h
-		PATH_SUFFIXES
-			uuid
-		HINTS
-			${UUID_DIR}/include
-			$ENV{UUID_DIR}/include
-			$ENV{UUID_DIR}
-			${DELTA3D_EXT_DIR}/inc
-			$ENV{DELTA_ROOT}/ext/inc
-			$ENV{DELTA_ROOT}
-		PATHS
-			~/Library/Frameworks
-			/Library/Frameworks
-			/usr/local/include
-			/usr/include
-			/usr/include/gdal
-			/sw/include # Fink
-			/opt/local/include # DarwinPorts
-			/opt/csw/include # Blastwave
-			/opt/include
-			[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
-			/usr/freeware/include
-	)
-
-	find_library(UUID_LIBRARY
-		NAMES
-			uuid ossp-uuid
-		HINTS
-			${UUID_DIR}/lib
-			$ENV{UUID_DIR}/lib
-			$ENV{UUID_DIR}
-			${DELTA3D_EXT_DIR}/lib
-			$ENV{DELTA_ROOT}/ext/lib
-			$ENV{DELTA_ROOT}
-			$ENV{OSG_ROOT}/lib
-		PATHS
-			~/Library/Frameworks
-			/Library/Frameworks
-			/usr/local/lib
-			/usr/lib
-			/sw/lib
-			/opt/local/lib
-			/opt/csw/lib
-			/opt/lib
-			/usr/freeware/lib64
-	)
-
-	find_library(UUID_LIBRARY_DEBUG
-		NAMES
-			uuidd 
-		HINTS
-			${UUID_DIR}/lib
-			$ENV{UUID_DIR}/lib
-			$ENV{UUID_DIR}
-			${DELTA3D_EXT_DIR}/lib
-			$ENV{DELTA_ROOT}/ext/lib
-			$ENV{DELTA_ROOT}
-			$ENV{OSG_ROOT}/lib
-		PATHS
-			~/Library/Frameworks
-			/Library/Frameworks
-			/usr/local/lib
-			/usr/lib
-			/sw/lib
-			/opt/local/lib
-			/opt/csw/lib
-			/opt/lib
-			/usr/freeware/lib64
-	)
-	
-	if (NOT UUID_LIBRARY AND BSD)
-		set(UUID_LIBRARY "")
-	endif(NOT UUID_LIBRARY AND BSD)
-
-	set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
-	set(UUID_LIBRARIES ${UUID_LIBRARY})
-
-	if (UUID_INCLUDE_DIRS)
-		if (BSD OR UUID_LIBRARIES)
-			set(UUID_FOUND TRUE)
-		endif (BSD OR UUID_LIBRARIES)
-	endif (UUID_INCLUDE_DIRS)
-
-	if (UUID_FOUND)
-		if (NOT UUID_FIND_QUIETLY)
-			message(STATUS "Found UUID: ${UUID_LIBRARIES}")
-		endif (NOT UUID_FIND_QUIETLY)
-	else (UUID_FOUND)
-		if (UUID_FIND_REQUIRED)
-			message(FATAL_ERROR "Could not find UUID")
-		endif (UUID_FIND_REQUIRED)
-	endif (UUID_FOUND)
-
-	# show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view
-	mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)
-
-endif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)

+ 2 - 2
frameworks/C++/drogon/drogon_benchmark/config-raw.json → frameworks/C++/drogon/drogon_benchmark/config-core.json

@@ -134,10 +134,10 @@
         ],
         ],
         //idle_connection_timeout: defaults to 60 seconds, the lifetime 
         //idle_connection_timeout: defaults to 60 seconds, the lifetime 
         //of the connection without read or write
         //of the connection without read or write
-        "idle_connection_timeout": 60,
+        "idle_connection_timeout": 0,
         //server_header_field: Set the 'server' header field in each response sent by drogon,
         //server_header_field: Set the 'server' header field in each response sent by drogon,
         //empty string by default with which the 'server' header field is set to "Server: drogon/version string\r\n"
         //empty string by default with which the 'server' header field is set to "Server: drogon/version string\r\n"
-        "server_header_field": "",
+        "server_header_field": "drogon",
         //keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection. 
         //keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection. 
         //After the maximum number of requests are made, the connection is closed.
         //After the maximum number of requests are made, the connection is closed.
         //The default value of 0 means no limit.
         //The default value of 0 means no limit.

+ 20 - 22
frameworks/C++/drogon/drogon_benchmark/config.json

@@ -103,21 +103,21 @@
         "static_files_cache_time": 5,
         "static_files_cache_time": 5,
         //simple_controllers_map:Configuring mapping from path to simple controller
         //simple_controllers_map:Configuring mapping from path to simple controller
         "simple_controllers_map": [
         "simple_controllers_map": [
-            {
-                "path": "/plaintext",
-                "controller": "PlaintextCtrl",
-                "http_methods": [
-                    "get"
-                ]
-            },
-            {
-                "path": "/json",
-                "controller": "JsonCtrl",
-                "http_methods": [
-                    "get"
-                ],
-                "filters": []
-            },
+            // {
+            //     "path": "/plaintext",
+            //     "controller": "PlaintextCtrl",
+            //     "http_methods": [
+            //         "get"
+            //     ]
+            // },
+            // {
+            //     "path": "/json",
+            //     "controller": "JsonCtrl",
+            //     "http_methods": [
+            //         "get"
+            //     ],
+            //     "filters": []
+            // },
             {
             {
                 "path": "/db",
                 "path": "/db",
                 "controller": "DbCtrl",
                 "controller": "DbCtrl",
@@ -150,10 +150,10 @@
         ],
         ],
         //idle_connection_timeout: defaults to 60 seconds, the lifetime 
         //idle_connection_timeout: defaults to 60 seconds, the lifetime 
         //of the connection without read or write
         //of the connection without read or write
-        "idle_connection_timeout": 60,
+        "idle_connection_timeout": 0,
         //server_header_field: Set the 'server' header field in each response sent by drogon,
         //server_header_field: Set the 'server' header field in each response sent by drogon,
         //empty string by default with which the 'server' header field is set to "Server: drogon/version string\r\n"
         //empty string by default with which the 'server' header field is set to "Server: drogon/version string\r\n"
-        "server_header_field": "",
+        "server_header_field": "dg",
         //keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection. 
         //keepalive_requests: Set the maximum number of requests that can be served through one keep-alive connection. 
         //After the maximum number of requests are made, the connection is closed.
         //After the maximum number of requests are made, the connection is closed.
         //The default value of 0 means no limit.
         //The default value of 0 means no limit.
@@ -176,15 +176,13 @@
     //plugins: Define all plugins running in the application
     //plugins: Define all plugins running in the application
     "plugins": [{
     "plugins": [{
         //name: The class name of the plugin
         //name: The class name of the plugin
-        //"name": "TestPlugin",
+        "name": "SyncPlugin",
         //dependencies: Plugins that the plugin depends on. It can be commented out
         //dependencies: Plugins that the plugin depends on. It can be commented out
         "dependencies": [],
         "dependencies": [],
         //config: The configuration of the plugin. This json object is the parameter to initialize the plugin.
         //config: The configuration of the plugin. This json object is the parameter to initialize the plugin.
         //It can be commented out
         //It can be commented out
-        "config": {
-            "heartbeat_interval": 2
-        }
+        "config": {}
     }],
     }],
     //custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method. 
     //custom_config: custom configuration for users. This object can be get by the app().getCustomConfig() method. 
     "custom_config": {}
     "custom_config": {}
-}
+}

+ 21 - 18
frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrl.cc

@@ -6,28 +6,31 @@
 #include <time.h>
 #include <time.h>
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
 
 
-void DbCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void DbCtrl::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
-    //write your application logic here
+    // write your application logic here
     static std::once_flag once;
     static std::once_flag once;
-    std::call_once(once, []() {
-        srand(time(NULL));
-    });
+    std::call_once(once, []() { srand(time(NULL)); });
     auto client = drogon::app().getFastDbClient();
     auto client = drogon::app().getFastDbClient();
 
 
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
     drogon::orm::Mapper<World> mapper(client);
     drogon::orm::Mapper<World> mapper(client);
     World::PrimaryKeyType id = rand() % 10000 + 1;
     World::PrimaryKeyType id = rand() % 10000 + 1;
-    mapper.findByPrimaryKey(id,
-                            [callbackPtr](World w) {
-                                auto j = w.toJson();
-                                auto resp = HttpResponse::newHttpJsonResponse(j);
-                                (*callbackPtr)(resp);
-                            },
-                            [callbackPtr](const DrogonDbException &e) {
-                                Json::Value ret;
-                                ret["result"] = "error!";
-                                auto resp = HttpResponse::newHttpJsonResponse(ret);
-                                (*callbackPtr)(resp);
-                            });
+    mapper.findByPrimaryKey(
+        id,
+        [callbackPtr](World w) {
+            auto j = w.toJson();
+            auto resp = HttpResponse::newHttpJsonResponse(j);
+            (*callbackPtr)(resp);
+        },
+        [callbackPtr](const DrogonDbException &e) {
+            Json::Value ret;
+            ret["result"] = "error!";
+            auto resp = HttpResponse::newHttpJsonResponse(ret);
+            (*callbackPtr)(resp);
+        });
 }
 }

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrl.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class DbCtrl:public drogon::HttpSimpleController<DbCtrl>
+class DbCtrl : public drogon::HttpSimpleController<DbCtrl>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/db", Get);
+    // list path definitions here;
+    // PATH_ADD("/db", Get);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 8 - 4
frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrlRaw.cc

@@ -15,15 +15,19 @@ void DbCtrlRaw::asyncHandleHttpRequest(
     std::call_once(once, []() { srand(time(NULL)); });
     std::call_once(once, []() { srand(time(NULL)); });
     auto client = drogon::app().getFastDbClient();
     auto client = drogon::app().getFastDbClient();
     int id = rand() % 10000 + 1;
     int id = rand() % 10000 + 1;
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
 
 
     *client << "select randomnumber from world where id=$1" << id >>
     *client << "select randomnumber from world where id=$1" << id >>
         [callbackPtr, id](const Result &rows) {
         [callbackPtr, id](const Result &rows) {
             auto resp = HttpResponse::newHttpResponse();
             auto resp = HttpResponse::newHttpResponse();
             char json[64];
             char json[64];
-            sprintf(json, "{\"id\":%d,\"randomnumber\":%s}", id,
-                    rows[0]["randomnumber"].c_str());
-            resp->setBody(std::string(json));
+            auto size = sprintf(json,
+                                "{\"id\":%d,\"randomnumber\":%s}",
+                                id,
+                                rows[0]["randomnumber"].c_str());
+            resp->setBody(std::string(json, size));
             resp->setContentTypeCode(CT_APPLICATION_JSON);
             resp->setContentTypeCode(CT_APPLICATION_JSON);
             (*callbackPtr)(resp);
             (*callbackPtr)(resp);
         } >>
         } >>

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/DbCtrlRaw.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class DbCtrlRaw:public drogon::HttpSimpleController<DbCtrlRaw>
+class DbCtrlRaw : public drogon::HttpSimpleController<DbCtrlRaw>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/db", Get);
+    // list path definitions here;
+    // PATH_ADD("/db", Get);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 32 - 26
frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrl.cc

@@ -3,34 +3,40 @@
 #include <algorithm>
 #include <algorithm>
 
 
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
-void FortuneCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void FortuneCtrl::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
     auto client = drogon::app().getFastDbClient();
     auto client = drogon::app().getFastDbClient();
     drogon::orm::Mapper<Fortune> mapper(client);
     drogon::orm::Mapper<Fortune> mapper(client);
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
 
 
-    mapper.findAll([callbackPtr](std::vector<Fortune> rows) {
-                        Fortune newRow;
-                        newRow.setId(0);
-                        newRow.setMessage("Additional fortune added at request time.");
-                        rows.emplace_back(std::move(newRow));
-                        std::sort(rows.begin(),
-                                  rows.end(),
-                                  [](const Fortune &f1, const Fortune &f2) -> bool {
-                                      if (f1.getValueOfMessage() < f2.getValueOfMessage())
-                                          return true;
-                                      else
-                                      {
-                                          return false;
-                                      }
-                                  });
-                        HttpViewData data;
-                        data.insert("rows",std::move(rows));
-                        auto resp=HttpResponse::newHttpViewResponse("fortune.csp",data);
-                        (*callbackPtr)(resp); },
-                   [callbackPtr](const DrogonDbException &err) {
-                       auto resp = HttpResponse::newHttpResponse();
-                       resp->setBody(std::string("error:") + err.base().what());
-                       (*callbackPtr)(resp);
-                   });
+    mapper.findAll(
+        [callbackPtr](std::vector<Fortune> rows) {
+            Fortune newRow;
+            newRow.setId(0);
+            newRow.setMessage("Additional fortune added at request time.");
+            rows.emplace_back(std::move(newRow));
+            std::sort(rows.begin(),
+                      rows.end(),
+                      [](const Fortune &f1, const Fortune &f2) -> bool {
+                          if (f1.getValueOfMessage() < f2.getValueOfMessage())
+                              return true;
+                          else
+                          {
+                              return false;
+                          }
+                      });
+            HttpViewData data;
+            data.insert("rows", std::move(rows));
+            auto resp = HttpResponse::newHttpViewResponse("fortune.csp", data);
+            (*callbackPtr)(resp);
+        },
+        [callbackPtr](const DrogonDbException &err) {
+            auto resp = HttpResponse::newHttpResponse();
+            resp->setBody(std::string("error:") + err.base().what());
+            (*callbackPtr)(resp);
+        });
 }
 }

+ 6 - 4
frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrl.h

@@ -1,11 +1,13 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class FortuneCtrl:public drogon::HttpSimpleController<FortuneCtrl>
+class FortuneCtrl : public drogon::HttpSimpleController<FortuneCtrl>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
+    // list path definitions here;
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 33 - 27
frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrlRaw.cc

@@ -3,33 +3,39 @@
 #include <algorithm>
 #include <algorithm>
 
 
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
-void FortuneCtrlRaw::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void FortuneCtrlRaw::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
     auto client = drogon::app().getFastDbClient();
     auto client = drogon::app().getFastDbClient();
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
 
 
-    *client << "select * from fortune where 1=$1"
-            << 1 >>
-        [callbackPtr](const Result &r) {
-            std::vector<std::pair<int, std::string>> rows;
-            for (auto row : r)
-            {
-                rows.emplace_back(row["id"].as<int>(), row["message"].as<std::string>());
-            }
-            rows.emplace_back(0, "Additional fortune added at request time.");
-            std::sort(rows.begin(), rows.end(), [](const std::pair<int, std::string> &p1, const std::pair<int, std::string> &p2) -> bool {
-                if (p1.second < p2.second)
-                    return true;
-                return false;
-            });
-            HttpViewData data;
-            data.insert("rows", std::move(rows));
-            auto resp = HttpResponse::newHttpViewResponse("fortune_raw.csp", data);
-            (*callbackPtr)(resp);
-        } >>
-        [callbackPtr](const DrogonDbException &err) {
-            auto resp = HttpResponse::newHttpResponse();
-            resp->setBody(std::string("error:") + err.base().what());
-            (*callbackPtr)(resp);
-        };
-}
+    *client << "select * from fortune where 1=$1" << 1 >> [callbackPtr](
+                                                              const Result &r) {
+        std::vector<std::pair<string_view, string_view>> rows;
+        for (auto const &row : r)
+        {
+            rows.emplace_back(row["id"].as<string_view>(),
+                              row["message"].as<string_view>());
+        }
+        rows.emplace_back("0", "Additional fortune added at request time.");
+        std::sort(rows.begin(),
+                  rows.end(),
+                  [](const std::pair<string_view, string_view> &p1,
+                     const std::pair<string_view, string_view> &p2) -> bool {
+                      if (p1.second < p2.second)
+                          return true;
+                      return false;
+                  });
+        HttpViewData data;
+        data.insert("rows", std::move(rows));
+        auto resp = HttpResponse::newHttpViewResponse("fortune_raw.csp", data);
+        (*callbackPtr)(resp);
+    } >> [callbackPtr](const DrogonDbException &err) {
+        auto resp = HttpResponse::newHttpResponse();
+        resp->setBody(std::string("error:") + err.base().what());
+        (*callbackPtr)(resp);
+    };
+}

+ 6 - 4
frameworks/C++/drogon/drogon_benchmark/controllers/FortuneCtrlRaw.h

@@ -1,11 +1,13 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class FortuneCtrlRaw:public drogon::HttpSimpleController<FortuneCtrlRaw>
+class FortuneCtrlRaw : public drogon::HttpSimpleController<FortuneCtrlRaw>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
+    // list path definitions here;
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 5 - 3
frameworks/C++/drogon/drogon_benchmark/controllers/JsonCtrl.cc

@@ -1,8 +1,10 @@
 #include "JsonCtrl.h"
 #include "JsonCtrl.h"
-void JsonCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback)
+void JsonCtrl::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
     Json::Value ret;
     Json::Value ret;
-    ret["message"]="Hello, World!";
-    auto resp=HttpResponse::newHttpJsonResponse(ret);
+    ret["message"] = "Hello, World!";
+    auto resp = HttpResponse::newHttpJsonResponse(ret);
     callback(resp);
     callback(resp);
 }
 }

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/JsonCtrl.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class JsonCtrl:public drogon::HttpSimpleController<JsonCtrl>
+class JsonCtrl : public drogon::HttpSimpleController<JsonCtrl>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback)override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/json",Get);
+    // list path definitions here;
+    // PATH_ADD("/json",Get);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 3 - 2
frameworks/C++/drogon/drogon_benchmark/controllers/PlaintextCtrl.cc

@@ -3,7 +3,8 @@ void PlaintextCtrl::asyncHandleHttpRequest(const HttpRequestPtr& req, std::funct
 {
 {
     auto resp = HttpResponse::newHttpResponse();
     auto resp = HttpResponse::newHttpResponse();
     resp->setBody("Hello, World!");
     resp->setBody("Hello, World!");
-    resp->setContentTypeCode(CT_TEXT_PLAIN);
-//    resp->setExpiredTime(0);
+    resp->setContentTypeCodeAndCustomString(CT_TEXT_PLAIN,
+                                            "Content-Type: text/plain\r\n");
+    //    resp->setExpiredTime(0);
     callback(resp);
     callback(resp);
 }
 }

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/PlaintextCtrl.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class PlaintextCtrl:public drogon::HttpSimpleController<PlaintextCtrl>
+class PlaintextCtrl : public drogon::HttpSimpleController<PlaintextCtrl>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback)override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/plaintext",Get);
+    // list path definitions here;
+    // PATH_ADD("/plaintext",Get);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 24 - 21
frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrl.cc

@@ -4,13 +4,13 @@
 
 
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
 
 
-void QueriesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void QueriesCtrl::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
-    //write your application logic here
+    // write your application logic here
     static std::once_flag once;
     static std::once_flag once;
-    std::call_once(once, []() {
-        srand(time(NULL));
-    });
+    std::call_once(once, []() { srand(time(NULL)); });
     int queries = 1;
     int queries = 1;
     auto &parameter = req->getParameter("queries");
     auto &parameter = req->getParameter("queries");
     if (!parameter.empty())
     if (!parameter.empty())
@@ -23,7 +23,9 @@ void QueriesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::functio
     }
     }
     auto json = std::make_shared<Json::Value>();
     auto json = std::make_shared<Json::Value>();
     json->resize(0);
     json->resize(0);
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
     auto counter = std::make_shared<int>(queries);
     auto counter = std::make_shared<int>(queries);
     auto client = app().getFastDbClient();
     auto client = app().getFastDbClient();
     drogon::orm::Mapper<World> mapper(client);
     drogon::orm::Mapper<World> mapper(client);
@@ -31,20 +33,21 @@ void QueriesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::functio
     for (int i = 0; i < queries; i++)
     for (int i = 0; i < queries; i++)
     {
     {
         World::PrimaryKeyType id = rand() % 10000 + 1;
         World::PrimaryKeyType id = rand() % 10000 + 1;
-        mapper.findByPrimaryKey(id,
-                                [callbackPtr, counter, json](World w) mutable {
-                                    json->append(w.toJson());
-                                    (*counter)--;
-                                    if ((*counter) == 0)
-                                    {
-                                        (*callbackPtr)(HttpResponse::newHttpJsonResponse(*json));
-                                    }
-                                },
-                                [callbackPtr](const DrogonDbException &e) {
-                                    Json::Value ret;
-                                    ret["result"] = "error!";
-                                    auto resp = HttpResponse::newHttpJsonResponse(ret);
-                                    (*callbackPtr)(resp);
-                                });
+        mapper.findByPrimaryKey(
+            id,
+            [callbackPtr, counter, json](World w) mutable {
+                json->append(w.toJson());
+                (*counter)--;
+                if ((*counter) == 0)
+                {
+                    (*callbackPtr)(HttpResponse::newHttpJsonResponse(*json));
+                }
+            },
+            [callbackPtr](const DrogonDbException &e) {
+                Json::Value ret;
+                ret["result"] = "error!";
+                auto resp = HttpResponse::newHttpJsonResponse(ret);
+                (*callbackPtr)(resp);
+            });
     }
     }
 }
 }

+ 5 - 3
frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrl.h

@@ -4,9 +4,11 @@ using namespace drogon;
 class QueriesCtrl : public drogon::HttpSimpleController<QueriesCtrl>
 class QueriesCtrl : public drogon::HttpSimpleController<QueriesCtrl>
 {
 {
   public:
   public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback) override;
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
+    // list path definitions here;
+    // PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 27 - 14
frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrlRaw.cc

@@ -1,12 +1,12 @@
 #include "QueriesCtrlRaw.h"
 #include "QueriesCtrlRaw.h"
 using namespace drogon::orm;
 using namespace drogon::orm;
-void QueriesCtrlRaw::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void QueriesCtrlRaw::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
-    //write your application logic here
+    // write your application logic here
     static std::once_flag once;
     static std::once_flag once;
-    std::call_once(once, []() {
-        srand(time(NULL));
-    });
+    std::call_once(once, []() { srand(time(NULL)); });
     int queries = 1;
     int queries = 1;
     auto &parameter = req->getParameter("queries");
     auto &parameter = req->getParameter("queries");
     if (!parameter.empty())
     if (!parameter.empty())
@@ -17,27 +17,40 @@ void QueriesCtrlRaw::asyncHandleHttpRequest(const HttpRequestPtr &req, std::func
         else if (queries < 1)
         else if (queries < 1)
             queries = 1;
             queries = 1;
     }
     }
-    auto json = std::make_shared<Json::Value>();
-    json->resize(0);
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
     auto counter = std::make_shared<int>(queries);
     auto counter = std::make_shared<int>(queries);
     auto client = app().getFastDbClient();
     auto client = app().getFastDbClient();
+    auto jsonStr = std::make_shared<std::string>();
+    jsonStr->reserve(queries * 36);
+    jsonStr->append("[", 1);
     for (int i = 0; i < queries; i++)
     for (int i = 0; i < queries; i++)
     {
     {
         int id = rand() % 10000 + 1;
         int id = rand() % 10000 + 1;
         *client << "select randomnumber from world where id=$1" << id >>
         *client << "select randomnumber from world where id=$1" << id >>
-            [callbackPtr, counter, json, id](const Result &r) mutable {
+            [callbackPtr, counter, jsonStr, id](const Result &r) mutable {
                 (*counter)--;
                 (*counter)--;
                 if (r.size() > 0)
                 if (r.size() > 0)
                 {
                 {
-                    Json::Value j;
-                    j["id"] = id;
-                    j["randomnumber"] = r[0]["randomnumber"].as<int>();
-                    json->append(std::move(j));
+                    char json[64];
+                    auto size = sprintf(json,
+                                        "{\"id\":%d,\"randomnumber\":%s}",
+                                        id,
+                                        r[0]["randomnumber"].c_str());
+                    jsonStr->append(json, size);
                 }
                 }
                 if ((*counter) == 0)
                 if ((*counter) == 0)
                 {
                 {
-                    (*callbackPtr)(HttpResponse::newHttpJsonResponse(*json));
+                    jsonStr->append("]", 1);
+                    auto resp = HttpResponse::newHttpResponse();
+                    resp->setContentTypeCode(ContentType::CT_APPLICATION_JSON);
+                    resp->setBody(std::move(*jsonStr));
+                    (*callbackPtr)(resp);
+                }
+                else
+                {
+                    jsonStr->append(",");
                 }
                 }
             } >>
             } >>
             [callbackPtr](const DrogonDbException &e) {
             [callbackPtr](const DrogonDbException &e) {

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/QueriesCtrlRaw.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class QueriesCtrlRaw:public drogon::HttpSimpleController<QueriesCtrlRaw>
+class QueriesCtrlRaw : public drogon::HttpSimpleController<QueriesCtrlRaw>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
+    // list path definitions here;
+    // PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 40 - 32
frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrl.cc

@@ -4,13 +4,13 @@
 
 
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
 
 
-void UpdatesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void UpdatesCtrl::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
-    //write your application logic here
+    // write your application logic here
     static std::once_flag once;
     static std::once_flag once;
-    std::call_once(once, []() {
-        srand(time(NULL));
-    });
+    std::call_once(once, []() { srand(time(NULL)); });
     int queries = 1;
     int queries = 1;
     auto &parameter = req->getParameter("queries");
     auto &parameter = req->getParameter("queries");
     if (!parameter.empty())
     if (!parameter.empty())
@@ -23,7 +23,9 @@ void UpdatesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::functio
     }
     }
     auto json = std::make_shared<Json::Value>();
     auto json = std::make_shared<Json::Value>();
     json->resize(0);
     json->resize(0);
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
     auto counter = std::make_shared<int>(queries);
     auto counter = std::make_shared<int>(queries);
     auto client = app().getFastDbClient();
     auto client = app().getFastDbClient();
     drogon::orm::Mapper<World> mapper(client);
     drogon::orm::Mapper<World> mapper(client);
@@ -31,31 +33,37 @@ void UpdatesCtrl::asyncHandleHttpRequest(const HttpRequestPtr &req, std::functio
     for (int i = 0; i < queries; i++)
     for (int i = 0; i < queries; i++)
     {
     {
         World::PrimaryKeyType id = rand() % 10000 + 1;
         World::PrimaryKeyType id = rand() % 10000 + 1;
-        mapper.findByPrimaryKey(id,
-                                [callbackPtr, counter, json, client](World w) mutable {
-                                    w.setRandomnumber(rand() % 10000 + 1);
-                                    drogon::orm::Mapper<World> mapper(client);
-                                    mapper.update(w,
-                                                  [w, json = std::move(json), counter = std::move(counter), callbackPtr](const size_t count) {
-                                                      json->append(w.toJson());
-                                                      (*counter)--;
-                                                      if ((*counter) == 0)
-                                                      {
-                                                          (*callbackPtr)(HttpResponse::newHttpJsonResponse(*json));
-                                                      }
-                                                  },
-                                                  [callbackPtr](const DrogonDbException &e) {
-                                                      Json::Value ret;
-                                                      ret["result"] = "error!";
-                                                      auto resp = HttpResponse::newHttpJsonResponse(ret);
-                                                      (*callbackPtr)(resp);
-                                                  });
-                                },
-                                [callbackPtr](const DrogonDbException &e) {
-                                    Json::Value ret;
-                                    ret["result"] = "error!";
-                                    auto resp = HttpResponse::newHttpJsonResponse(ret);
-                                    (*callbackPtr)(resp);
-                                });
+        mapper.findByPrimaryKey(
+            id,
+            [callbackPtr, counter, json, client](World w) mutable {
+                w.setRandomnumber(rand() % 10000 + 1);
+                drogon::orm::Mapper<World> mapper(client);
+                mapper.update(
+                    w,
+                    [w,
+                     json = std::move(json),
+                     counter = std::move(counter),
+                     callbackPtr](const size_t count) {
+                        json->append(w.toJson());
+                        (*counter)--;
+                        if ((*counter) == 0)
+                        {
+                            (*callbackPtr)(
+                                HttpResponse::newHttpJsonResponse(*json));
+                        }
+                    },
+                    [callbackPtr](const DrogonDbException &e) {
+                        Json::Value ret;
+                        ret["result"] = "error!";
+                        auto resp = HttpResponse::newHttpJsonResponse(ret);
+                        (*callbackPtr)(resp);
+                    });
+            },
+            [callbackPtr](const DrogonDbException &e) {
+                Json::Value ret;
+                ret["result"] = "error!";
+                auto resp = HttpResponse::newHttpJsonResponse(ret);
+                (*callbackPtr)(resp);
+            });
     }
     }
 }
 }

+ 5 - 3
frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrl.h

@@ -4,9 +4,11 @@ using namespace drogon;
 class UpdatesCtrl : public drogon::HttpSimpleController<UpdatesCtrl>
 class UpdatesCtrl : public drogon::HttpSimpleController<UpdatesCtrl>
 {
 {
   public:
   public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback) override;
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
+    // list path definitions here;
+    // PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 44 - 35
frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrlRaw.cc

@@ -1,10 +1,11 @@
 #include "UpdatesCtrlRaw.h"
 #include "UpdatesCtrlRaw.h"
 using namespace drogon::orm;
 using namespace drogon::orm;
-const void update(const std::shared_ptr<std::vector<Result>> &results,
-                  const std::shared_ptr<std::function<void(const HttpResponsePtr &)>> &callbackPtr,
-                  const DbClientPtr &client)
+const void update(
+    const std::shared_ptr<std::vector<Result>> &results,
+    const std::shared_ptr<std::function<void(const HttpResponsePtr &)>>
+        &callbackPtr,
+    const DbClientPtr &client)
 {
 {
-
     auto size = results->size();
     auto size = results->size();
     std::string sql;
     std::string sql;
     sql.reserve(256);
     sql.reserve(256);
@@ -12,14 +13,17 @@ const void update(const std::shared_ptr<std::vector<Result>> &results,
     int placeholdersCounter = 1;
     int placeholdersCounter = 1;
     for (size_t i = 0; i < size; i++)
     for (size_t i = 0; i < size; i++)
     {
     {
-        auto tmpStr = drogon::utils::formattedString("when $%d then $%d ", placeholdersCounter, placeholdersCounter + 1);
+        auto tmpStr = drogon::utils::formattedString("when $%d then $%d ",
+                                                     placeholdersCounter,
+                                                     placeholdersCounter + 1);
         placeholdersCounter += 2;
         placeholdersCounter += 2;
         sql.append(tmpStr);
         sql.append(tmpStr);
     }
     }
     sql.append("else randomnumber end where id in (");
     sql.append("else randomnumber end where id in (");
     for (size_t i = 0; i < size; i++)
     for (size_t i = 0; i < size; i++)
     {
     {
-        auto tmpStr = drogon::utils::formattedString("$%d,", placeholdersCounter);
+        auto tmpStr =
+            drogon::utils::formattedString("$%d,", placeholdersCounter);
         ++placeholdersCounter;
         ++placeholdersCounter;
         sql.append(tmpStr);
         sql.append(tmpStr);
     }
     }
@@ -27,42 +31,47 @@ const void update(const std::shared_ptr<std::vector<Result>> &results,
 
 
     auto sqlBinder = *client << std::move(sql);
     auto sqlBinder = *client << std::move(sql);
 
 
-    auto jsonPtr = std::make_shared<Json::Value>();
-    jsonPtr->resize(0);
-    for (auto &r : *results)
+    std::string jsonStr;
+    jsonStr.reserve(size * 36);
+    jsonStr.append("[", 1);
+    for (auto const &r : *results)
     {
     {
         auto randId = rand() % 10000 + 1;
         auto randId = rand() % 10000 + 1;
         auto id = r[0]["id"].as<int>();
         auto id = r[0]["id"].as<int>();
         sqlBinder << id;
         sqlBinder << id;
         sqlBinder << randId;
         sqlBinder << randId;
-        Json::Value j;
-        j["id"] = id;
-        j["randomnumber"] = randId;
-        jsonPtr->append(std::move(j));
+        char json[64];
+        auto size =
+            sprintf(json, "{\"id\":%d,\"randomnumber\":%d}", id, randId);
+        jsonStr.append(json, size);
+        jsonStr.append(",", 1);
     }
     }
-    for (auto &r : *results)
+    jsonStr[jsonStr.length() - 1] = ']';
+    for (auto const &r : *results)
     {
     {
         sqlBinder << r[0]["id"].as<int>();
         sqlBinder << r[0]["id"].as<int>();
     }
     }
 
 
-    sqlBinder >>
-        [jsonPtr = std::move(jsonPtr), callbackPtr](const Result &r) mutable {
-            (*callbackPtr)(HttpResponse::newHttpJsonResponse(*jsonPtr));
-        } >>
-        [callbackPtr](const DrogonDbException &e) {
-            Json::Value ret;
-            ret["result"] = "error!";
-            auto resp = HttpResponse::newHttpJsonResponse(ret);
-            (*callbackPtr)(resp);
-        };
+    sqlBinder >> [jsonStr = std::move(jsonStr),
+                  callbackPtr](const Result &r) mutable {
+        auto resp = HttpResponse::newHttpResponse();
+        resp->setContentTypeCode(ContentType::CT_APPLICATION_JSON);
+        resp->setBody(std::move(jsonStr));
+        (*callbackPtr)(resp);
+    } >> [callbackPtr](const DrogonDbException &e) {
+        Json::Value ret;
+        ret["result"] = "error!";
+        auto resp = HttpResponse::newHttpJsonResponse(ret);
+        (*callbackPtr)(resp);
+    };
 }
 }
-void UpdatesCtrlRaw::asyncHandleHttpRequest(const HttpRequestPtr &req, std::function<void(const HttpResponsePtr &)> &&callback)
+void UpdatesCtrlRaw::asyncHandleHttpRequest(
+    const HttpRequestPtr &req,
+    std::function<void(const HttpResponsePtr &)> &&callback)
 {
 {
-    //write your application logic here
+    // write your application logic here
     static std::once_flag once;
     static std::once_flag once;
-    std::call_once(once, []() {
-        srand(time(NULL));
-    });
+    std::call_once(once, []() { srand(time(NULL)); });
     size_t queries = 1;
     size_t queries = 1;
     auto &parameter = req->getParameter("queries");
     auto &parameter = req->getParameter("queries");
     if (!parameter.empty())
     if (!parameter.empty())
@@ -73,18 +82,18 @@ void UpdatesCtrlRaw::asyncHandleHttpRequest(const HttpRequestPtr &req, std::func
         else if (queries < 1)
         else if (queries < 1)
             queries = 1;
             queries = 1;
     }
     }
-    auto json = std::make_shared<Json::Value>();
-    json->resize(0);
-    auto callbackPtr = std::shared_ptr<std::function<void(const HttpResponsePtr &)>>(new std::function<void(const HttpResponsePtr &)>(std::move(callback)));
+    auto callbackPtr =
+        std::make_shared<std::function<void(const HttpResponsePtr &)>>(
+            std::move(callback));
     auto resultSetPtr = std::make_shared<std::vector<Result>>();
     auto resultSetPtr = std::make_shared<std::vector<Result>>();
     resultSetPtr->reserve(queries);
     resultSetPtr->reserve(queries);
     auto client = app().getFastDbClient();
     auto client = app().getFastDbClient();
     for (size_t i = 0; i < queries; i++)
     for (size_t i = 0; i < queries; i++)
     {
     {
         int id = rand() % 10000 + 1;
         int id = rand() % 10000 + 1;
-        *client << "select * from world where id=$1"
-                << id >>
-            [callbackPtr, resultSetPtr, client, queries](const Result &r) mutable {
+        *client << "select * from world where id=$1" << id >>
+            [callbackPtr, resultSetPtr, client, queries](
+                const Result &r) mutable {
                 resultSetPtr->push_back(r);
                 resultSetPtr->push_back(r);
                 if (resultSetPtr->size() == queries)
                 if (resultSetPtr->size() == queries)
                 {
                 {

+ 7 - 5
frameworks/C++/drogon/drogon_benchmark/controllers/UpdatesCtrlRaw.h

@@ -1,12 +1,14 @@
 #pragma once
 #pragma once
 #include <drogon/HttpSimpleController.h>
 #include <drogon/HttpSimpleController.h>
 using namespace drogon;
 using namespace drogon;
-class UpdatesCtrlRaw:public drogon::HttpSimpleController<UpdatesCtrlRaw>
+class UpdatesCtrlRaw : public drogon::HttpSimpleController<UpdatesCtrlRaw>
 {
 {
-public:
-    virtual void asyncHandleHttpRequest(const HttpRequestPtr& req, std::function<void (const HttpResponsePtr &)> &&callback) override;
+  public:
+    virtual void asyncHandleHttpRequest(
+        const HttpRequestPtr &req,
+        std::function<void(const HttpResponsePtr &)> &&callback) override;
     PATH_LIST_BEGIN
     PATH_LIST_BEGIN
-    //list path definitions here;
-    //PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
+    // list path definitions here;
+    // PATH_ADD("/path","filter1","filter2",HttpMethod1,HttpMethod2...);
     PATH_LIST_END
     PATH_LIST_END
 };
 };

+ 2 - 3
frameworks/C++/drogon/drogon_benchmark/main.cc

@@ -3,12 +3,11 @@
 
 
 int main(int argc, char const *argv[])
 int main(int argc, char const *argv[])
 {
 {
-    if(argc<2)
+    if (argc < 2)
     {
     {
         std::cout << "please input the config file name" << std::endl;
         std::cout << "please input the config file name" << std::endl;
         return -1;
         return -1;
     }
     }
-    drogon::app().loadConfigFile(argv[1]);
-    drogon::app().run();
+    drogon::app().loadConfigFile(argv[1]).run();
     return 0;
     return 0;
 }
 }

+ 37 - 38
frameworks/C++/drogon/drogon_benchmark/models/Fortune.cc

@@ -9,6 +9,7 @@
 #include <drogon/utils/Utilities.h>
 #include <drogon/utils/Utilities.h>
 #include <string>
 #include <string>
 
 
+using namespace drogon;
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
 
 
 const std::string Fortune::Cols::id = "id";
 const std::string Fortune::Cols::id = "id";
@@ -17,10 +18,9 @@ const std::string Fortune::primaryKeyName = "id";
 const bool Fortune::hasPrimaryKey = true;
 const bool Fortune::hasPrimaryKey = true;
 const std::string Fortune::tableName = "fortune";
 const std::string Fortune::tableName = "fortune";
 
 
-const std::vector<typename Fortune::MetaData> Fortune::_metaData={
-{"id","int32_t","integer",4,0,1,1},
-{"message","std::string","character varying",2048,0,0,1}
-};
+const std::vector<typename Fortune::MetaData> Fortune::_metaData = {
+    {"id", "int32_t", "integer", 4, 0, 1, 1},
+    {"message", "std::string", "character varying", 2048, 0, 0, 1}};
 const std::string &Fortune::getColumnName(size_t index) noexcept(false)
 const std::string &Fortune::getColumnName(size_t index) noexcept(false)
 {
 {
     assert(index < _metaData.size());
     assert(index < _metaData.size());
@@ -28,22 +28,24 @@ const std::string &Fortune::getColumnName(size_t index) noexcept(false)
 }
 }
 Fortune::Fortune(const Row &r) noexcept
 Fortune::Fortune(const Row &r) noexcept
 {
 {
-        if(!r["id"].isNull())
-        {
-            _id=std::make_shared<int32_t>(r["id"].as<int32_t>());
-        }
-        if(!r["message"].isNull())
-        {
-            _message=std::make_shared<std::string>(r["message"].as<std::string>());
-        }
+    if (!r["id"].isNull())
+    {
+        _id = std::make_shared<int32_t>(r["id"].as<int32_t>());
+    }
+    if (!r["message"].isNull())
+    {
+        _message =
+            std::make_shared<std::string>(r["message"].as<std::string>());
+    }
 }
 }
-const int32_t & Fortune::getValueOfId(const int32_t &defaultValue) const noexcept
+const int32_t &Fortune::getValueOfId() const noexcept
 {
 {
-    if(_id)
+    const static int32_t defaultValue = int32_t();
+    if (_id)
         return *_id;
         return *_id;
     return defaultValue;
     return defaultValue;
 }
 }
-std::shared_ptr<const int32_t> Fortune::getId() const noexcept
+const std::shared_ptr<int32_t> &Fortune::getId() const noexcept
 {
 {
     return _id;
     return _id;
 }
 }
@@ -53,19 +55,20 @@ void Fortune::setId(const int32_t &id) noexcept
     _dirtyFlag[0] = true;
     _dirtyFlag[0] = true;
 }
 }
 
 
-const typename Fortune::PrimaryKeyType & Fortune::getPrimaryKey() const
+const typename Fortune::PrimaryKeyType &Fortune::getPrimaryKey() const
 {
 {
     assert(_id);
     assert(_id);
     return *_id;
     return *_id;
 }
 }
 
 
-const std::string & Fortune::getValueOfMessage(const std::string &defaultValue) const noexcept
+const std::string &Fortune::getValueOfMessage() const noexcept
 {
 {
-    if(_message)
+    const static std::string defaultValue = std::string();
+    if (_message)
         return *_message;
         return *_message;
     return defaultValue;
     return defaultValue;
 }
 }
-std::shared_ptr<const std::string> Fortune::getMessage() const noexcept
+const std::shared_ptr<std::string> &Fortune::getMessage() const noexcept
 {
 {
     return _message;
     return _message;
 }
 }
@@ -80,23 +83,19 @@ void Fortune::setMessage(std::string &&message) noexcept
     _dirtyFlag[1] = true;
     _dirtyFlag[1] = true;
 }
 }
 
 
-
 void Fortune::updateId(const uint64_t id)
 void Fortune::updateId(const uint64_t id)
 {
 {
 }
 }
 
 
 const std::vector<std::string> &Fortune::insertColumns() noexcept
 const std::vector<std::string> &Fortune::insertColumns() noexcept
 {
 {
-    static const std::vector<std::string> _inCols={
-        "id",
-        "message"
-    };
+    static const std::vector<std::string> _inCols = {"id", "message"};
     return _inCols;
     return _inCols;
 }
 }
 
 
 void Fortune::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 void Fortune::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 {
 {
-    if(getId())
+    if (getId())
     {
     {
         binder << getValueOfId();
         binder << getValueOfId();
     }
     }
@@ -104,7 +103,7 @@ void Fortune::outputArgs(drogon::orm::internal::SqlBinder &binder) const
     {
     {
         binder << nullptr;
         binder << nullptr;
     }
     }
-    if(getMessage())
+    if (getMessage())
     {
     {
         binder << getValueOfMessage();
         binder << getValueOfMessage();
     }
     }
@@ -117,9 +116,9 @@ void Fortune::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 const std::vector<std::string> Fortune::updateColumns() const
 const std::vector<std::string> Fortune::updateColumns() const
 {
 {
     std::vector<std::string> ret;
     std::vector<std::string> ret;
-    for(size_t i=0;i<sizeof(_dirtyFlag);i++)
+    for (size_t i = 0; i < sizeof(_dirtyFlag); i++)
     {
     {
-        if(_dirtyFlag[i])
+        if (_dirtyFlag[i])
         {
         {
             ret.push_back(getColumnName(i));
             ret.push_back(getColumnName(i));
         }
         }
@@ -129,9 +128,9 @@ const std::vector<std::string> Fortune::updateColumns() const
 
 
 void Fortune::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 void Fortune::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 {
 {
-    if(_dirtyFlag[0])
+    if (_dirtyFlag[0])
     {
     {
-        if(getId())
+        if (getId())
         {
         {
             binder << getValueOfId();
             binder << getValueOfId();
         }
         }
@@ -140,9 +139,9 @@ void Fortune::updateArgs(drogon::orm::internal::SqlBinder &binder) const
             binder << nullptr;
             binder << nullptr;
         }
         }
     }
     }
-    if(_dirtyFlag[1])
+    if (_dirtyFlag[1])
     {
     {
-        if(getMessage())
+        if (getMessage())
         {
         {
             binder << getValueOfMessage();
             binder << getValueOfMessage();
         }
         }
@@ -155,21 +154,21 @@ void Fortune::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 Json::Value Fortune::toJson() const
 Json::Value Fortune::toJson() const
 {
 {
     Json::Value ret;
     Json::Value ret;
-    if(getId())
+    if (getId())
     {
     {
-        ret["id"]=getValueOfId();
+        ret["id"] = getValueOfId();
     }
     }
     else
     else
     {
     {
-        ret["id"]=Json::Value();
+        ret["id"] = Json::Value();
     }
     }
-    if(getMessage())
+    if (getMessage())
     {
     {
-        ret["message"]=getValueOfMessage();
+        ret["message"] = getValueOfMessage();
     }
     }
     else
     else
     {
     {
-        ret["message"]=Json::Value();
+        ret["message"] = Json::Value();
     }
     }
     return ret;
     return ret;
 }
 }

+ 27 - 21
frameworks/C++/drogon/drogon_benchmark/models/Fortune.h

@@ -19,13 +19,13 @@
 #include <tuple>
 #include <tuple>
 #include <stdint.h>
 #include <stdint.h>
 #include <iostream>
 #include <iostream>
+
 using namespace drogon::orm;
 using namespace drogon::orm;
 
 
 namespace drogon_model
 namespace drogon_model
 {
 {
-namespace hello_world 
+namespace hello_world
 {
 {
-
 class Fortune
 class Fortune
 {
 {
   public:
   public:
@@ -40,29 +40,35 @@ class Fortune
     const static bool hasPrimaryKey;
     const static bool hasPrimaryKey;
     const static std::string primaryKeyName;
     const static std::string primaryKeyName;
     typedef int32_t PrimaryKeyType;
     typedef int32_t PrimaryKeyType;
-    const PrimaryKeyType & getPrimaryKey() const;
-    Fortune(const Row &r) noexcept;
+    const PrimaryKeyType &getPrimaryKey() const;
+    explicit Fortune(const Row &r) noexcept;
     Fortune() = default;
     Fortune() = default;
-    
+
     /**  For column id  */
     /**  For column id  */
-    ///Get the value of the column id, returns the default value if the column is null
-    const int32_t &getValueOfId(const int32_t &defaultValue=int32_t()) const noexcept;
-    ///Returns a shared_ptr object pointing to the column const value, or an empty shared_ptr object if the column is null
-    std::shared_ptr<const int32_t> getId() const noexcept;
-    ///Set the value of the column id
+    /// Get the value of the column id, returns the default value if the column
+    /// is null
+    const int32_t &getValueOfId() const noexcept;
+    /// Return a shared_ptr object pointing to the column const value, or an
+    /// empty shared_ptr object if the column is null
+    const std::shared_ptr<int32_t> &getId() const noexcept;
+    /// Set the value of the column id
     void setId(const int32_t &id) noexcept;
     void setId(const int32_t &id) noexcept;
 
 
     /**  For column message  */
     /**  For column message  */
-    ///Get the value of the column message, returns the default value if the column is null
-    const std::string &getValueOfMessage(const std::string &defaultValue=std::string()) const noexcept;
-    ///Returns a shared_ptr object pointing to the column const value, or an empty shared_ptr object if the column is null
-    std::shared_ptr<const std::string> getMessage() const noexcept;
-    ///Set the value of the column message
+    /// Get the value of the column message, returns the default value if the
+    /// column is null
+    const std::string &getValueOfMessage() const noexcept;
+    /// Return a shared_ptr object pointing to the column const value, or an
+    /// empty shared_ptr object if the column is null
+    const std::shared_ptr<std::string> &getMessage() const noexcept;
+    /// Set the value of the column message
     void setMessage(const std::string &message) noexcept;
     void setMessage(const std::string &message) noexcept;
     void setMessage(std::string &&message) noexcept;
     void setMessage(std::string &&message) noexcept;
 
 
-
-    static size_t getColumnNumber() noexcept {  return 2;  }
+    static size_t getColumnNumber() noexcept
+    {
+        return 2;
+    }
     static const std::string &getColumnName(size_t index) noexcept(false);
     static const std::string &getColumnName(size_t index) noexcept(false);
 
 
     Json::Value toJson() const;
     Json::Value toJson() const;
@@ -73,7 +79,7 @@ class Fortune
     void outputArgs(drogon::orm::internal::SqlBinder &binder) const;
     void outputArgs(drogon::orm::internal::SqlBinder &binder) const;
     const std::vector<std::string> updateColumns() const;
     const std::vector<std::string> updateColumns() const;
     void updateArgs(drogon::orm::internal::SqlBinder &binder) const;
     void updateArgs(drogon::orm::internal::SqlBinder &binder) const;
-    ///For mysql only
+    /// For mysql or sqlite3
     void updateId(const uint64_t id);
     void updateId(const uint64_t id);
     std::shared_ptr<int32_t> _id;
     std::shared_ptr<int32_t> _id;
     std::shared_ptr<std::string> _message;
     std::shared_ptr<std::string> _message;
@@ -88,8 +94,8 @@ class Fortune
         const bool _notNull;
         const bool _notNull;
     };
     };
     static const std::vector<MetaData> _metaData;
     static const std::vector<MetaData> _metaData;
-    bool _dirtyFlag[2]={ false };
+    bool _dirtyFlag[2] = {false};
 };
 };
 
 
-} // namespace hello_world
-} // namespace drogon_model
+}  // namespace hello_world
+}  // namespace drogon_model

+ 37 - 38
frameworks/C++/drogon/drogon_benchmark/models/World.cc

@@ -9,6 +9,7 @@
 #include <drogon/utils/Utilities.h>
 #include <drogon/utils/Utilities.h>
 #include <string>
 #include <string>
 
 
+using namespace drogon;
 using namespace drogon_model::hello_world;
 using namespace drogon_model::hello_world;
 
 
 const std::string World::Cols::id = "id";
 const std::string World::Cols::id = "id";
@@ -17,10 +18,9 @@ const std::string World::primaryKeyName = "id";
 const bool World::hasPrimaryKey = true;
 const bool World::hasPrimaryKey = true;
 const std::string World::tableName = "world";
 const std::string World::tableName = "world";
 
 
-const std::vector<typename World::MetaData> World::_metaData={
-{"id","int32_t","integer",4,0,1,1},
-{"randomnumber","int32_t","integer",4,0,0,1}
-};
+const std::vector<typename World::MetaData> World::_metaData = {
+    {"id", "int32_t", "integer", 4, 0, 1, 1},
+    {"randomnumber", "int32_t", "integer", 4, 0, 0, 1}};
 const std::string &World::getColumnName(size_t index) noexcept(false)
 const std::string &World::getColumnName(size_t index) noexcept(false)
 {
 {
     assert(index < _metaData.size());
     assert(index < _metaData.size());
@@ -28,22 +28,24 @@ const std::string &World::getColumnName(size_t index) noexcept(false)
 }
 }
 World::World(const Row &r) noexcept
 World::World(const Row &r) noexcept
 {
 {
-        if(!r["id"].isNull())
-        {
-            _id=std::make_shared<int32_t>(r["id"].as<int32_t>());
-        }
-        if(!r["randomnumber"].isNull())
-        {
-            _randomnumber=std::make_shared<int32_t>(r["randomnumber"].as<int32_t>());
-        }
+    if (!r["id"].isNull())
+    {
+        _id = std::make_shared<int32_t>(r["id"].as<int32_t>());
+    }
+    if (!r["randomnumber"].isNull())
+    {
+        _randomnumber =
+            std::make_shared<int32_t>(r["randomnumber"].as<int32_t>());
+    }
 }
 }
-const int32_t & World::getValueOfId(const int32_t &defaultValue) const noexcept
+const int32_t &World::getValueOfId() const noexcept
 {
 {
-    if(_id)
+    const static int32_t defaultValue = int32_t();
+    if (_id)
         return *_id;
         return *_id;
     return defaultValue;
     return defaultValue;
 }
 }
-std::shared_ptr<const int32_t> World::getId() const noexcept
+const std::shared_ptr<int32_t> &World::getId() const noexcept
 {
 {
     return _id;
     return _id;
 }
 }
@@ -53,19 +55,20 @@ void World::setId(const int32_t &id) noexcept
     _dirtyFlag[0] = true;
     _dirtyFlag[0] = true;
 }
 }
 
 
-const typename World::PrimaryKeyType & World::getPrimaryKey() const
+const typename World::PrimaryKeyType &World::getPrimaryKey() const
 {
 {
     assert(_id);
     assert(_id);
     return *_id;
     return *_id;
 }
 }
 
 
-const int32_t & World::getValueOfRandomnumber(const int32_t &defaultValue) const noexcept
+const int32_t &World::getValueOfRandomnumber() const noexcept
 {
 {
-    if(_randomnumber)
+    const static int32_t defaultValue = int32_t();
+    if (_randomnumber)
         return *_randomnumber;
         return *_randomnumber;
     return defaultValue;
     return defaultValue;
 }
 }
-std::shared_ptr<const int32_t> World::getRandomnumber() const noexcept
+const std::shared_ptr<int32_t> &World::getRandomnumber() const noexcept
 {
 {
     return _randomnumber;
     return _randomnumber;
 }
 }
@@ -75,23 +78,19 @@ void World::setRandomnumber(const int32_t &randomnumber) noexcept
     _dirtyFlag[1] = true;
     _dirtyFlag[1] = true;
 }
 }
 
 
-
 void World::updateId(const uint64_t id)
 void World::updateId(const uint64_t id)
 {
 {
 }
 }
 
 
 const std::vector<std::string> &World::insertColumns() noexcept
 const std::vector<std::string> &World::insertColumns() noexcept
 {
 {
-    static const std::vector<std::string> _inCols={
-        "id",
-        "randomnumber"
-    };
+    static const std::vector<std::string> _inCols = {"id", "randomnumber"};
     return _inCols;
     return _inCols;
 }
 }
 
 
 void World::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 void World::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 {
 {
-    if(getId())
+    if (getId())
     {
     {
         binder << getValueOfId();
         binder << getValueOfId();
     }
     }
@@ -99,7 +98,7 @@ void World::outputArgs(drogon::orm::internal::SqlBinder &binder) const
     {
     {
         binder << nullptr;
         binder << nullptr;
     }
     }
-    if(getRandomnumber())
+    if (getRandomnumber())
     {
     {
         binder << getValueOfRandomnumber();
         binder << getValueOfRandomnumber();
     }
     }
@@ -112,9 +111,9 @@ void World::outputArgs(drogon::orm::internal::SqlBinder &binder) const
 const std::vector<std::string> World::updateColumns() const
 const std::vector<std::string> World::updateColumns() const
 {
 {
     std::vector<std::string> ret;
     std::vector<std::string> ret;
-    for(size_t i=0;i<sizeof(_dirtyFlag);i++)
+    for (size_t i = 0; i < sizeof(_dirtyFlag); i++)
     {
     {
-        if(_dirtyFlag[i])
+        if (_dirtyFlag[i])
         {
         {
             ret.push_back(getColumnName(i));
             ret.push_back(getColumnName(i));
         }
         }
@@ -124,9 +123,9 @@ const std::vector<std::string> World::updateColumns() const
 
 
 void World::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 void World::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 {
 {
-    if(_dirtyFlag[0])
+    if (_dirtyFlag[0])
     {
     {
-        if(getId())
+        if (getId())
         {
         {
             binder << getValueOfId();
             binder << getValueOfId();
         }
         }
@@ -135,9 +134,9 @@ void World::updateArgs(drogon::orm::internal::SqlBinder &binder) const
             binder << nullptr;
             binder << nullptr;
         }
         }
     }
     }
-    if(_dirtyFlag[1])
+    if (_dirtyFlag[1])
     {
     {
-        if(getRandomnumber())
+        if (getRandomnumber())
         {
         {
             binder << getValueOfRandomnumber();
             binder << getValueOfRandomnumber();
         }
         }
@@ -150,21 +149,21 @@ void World::updateArgs(drogon::orm::internal::SqlBinder &binder) const
 Json::Value World::toJson() const
 Json::Value World::toJson() const
 {
 {
     Json::Value ret;
     Json::Value ret;
-    if(getId())
+    if (getId())
     {
     {
-        ret["id"]=getValueOfId();
+        ret["id"] = getValueOfId();
     }
     }
     else
     else
     {
     {
-        ret["id"]=Json::Value();
+        ret["id"] = Json::Value();
     }
     }
-    if(getRandomnumber())
+    if (getRandomnumber())
     {
     {
-        ret["randomnumber"]=getValueOfRandomnumber();
+        ret["randomnumber"] = getValueOfRandomnumber();
     }
     }
     else
     else
     {
     {
-        ret["randomnumber"]=Json::Value();
+        ret["randomnumber"] = Json::Value();
     }
     }
     return ret;
     return ret;
 }
 }

+ 27 - 21
frameworks/C++/drogon/drogon_benchmark/models/World.h

@@ -19,13 +19,13 @@
 #include <tuple>
 #include <tuple>
 #include <stdint.h>
 #include <stdint.h>
 #include <iostream>
 #include <iostream>
+
 using namespace drogon::orm;
 using namespace drogon::orm;
 
 
 namespace drogon_model
 namespace drogon_model
 {
 {
-namespace hello_world 
+namespace hello_world
 {
 {
-
 class World
 class World
 {
 {
   public:
   public:
@@ -40,28 +40,34 @@ class World
     const static bool hasPrimaryKey;
     const static bool hasPrimaryKey;
     const static std::string primaryKeyName;
     const static std::string primaryKeyName;
     typedef int32_t PrimaryKeyType;
     typedef int32_t PrimaryKeyType;
-    const PrimaryKeyType & getPrimaryKey() const;
-    World(const Row &r) noexcept;
+    const PrimaryKeyType &getPrimaryKey() const;
+    explicit World(const Row &r) noexcept;
     World() = default;
     World() = default;
-    
+
     /**  For column id  */
     /**  For column id  */
-    ///Get the value of the column id, returns the default value if the column is null
-    const int32_t &getValueOfId(const int32_t &defaultValue=int32_t()) const noexcept;
-    ///Returns a shared_ptr object pointing to the column const value, or an empty shared_ptr object if the column is null
-    std::shared_ptr<const int32_t> getId() const noexcept;
-    ///Set the value of the column id
+    /// Get the value of the column id, returns the default value if the column
+    /// is null
+    const int32_t &getValueOfId() const noexcept;
+    /// Return a shared_ptr object pointing to the column const value, or an
+    /// empty shared_ptr object if the column is null
+    const std::shared_ptr<int32_t> &getId() const noexcept;
+    /// Set the value of the column id
     void setId(const int32_t &id) noexcept;
     void setId(const int32_t &id) noexcept;
 
 
     /**  For column randomnumber  */
     /**  For column randomnumber  */
-    ///Get the value of the column randomnumber, returns the default value if the column is null
-    const int32_t &getValueOfRandomnumber(const int32_t &defaultValue=int32_t()) const noexcept;
-    ///Returns a shared_ptr object pointing to the column const value, or an empty shared_ptr object if the column is null
-    std::shared_ptr<const int32_t> getRandomnumber() const noexcept;
-    ///Set the value of the column randomnumber
+    /// Get the value of the column randomnumber, returns the default value if
+    /// the column is null
+    const int32_t &getValueOfRandomnumber() const noexcept;
+    /// Return a shared_ptr object pointing to the column const value, or an
+    /// empty shared_ptr object if the column is null
+    const std::shared_ptr<int32_t> &getRandomnumber() const noexcept;
+    /// Set the value of the column randomnumber
     void setRandomnumber(const int32_t &randomnumber) noexcept;
     void setRandomnumber(const int32_t &randomnumber) noexcept;
 
 
-
-    static size_t getColumnNumber() noexcept {  return 2;  }
+    static size_t getColumnNumber() noexcept
+    {
+        return 2;
+    }
     static const std::string &getColumnName(size_t index) noexcept(false);
     static const std::string &getColumnName(size_t index) noexcept(false);
 
 
     Json::Value toJson() const;
     Json::Value toJson() const;
@@ -72,7 +78,7 @@ class World
     void outputArgs(drogon::orm::internal::SqlBinder &binder) const;
     void outputArgs(drogon::orm::internal::SqlBinder &binder) const;
     const std::vector<std::string> updateColumns() const;
     const std::vector<std::string> updateColumns() const;
     void updateArgs(drogon::orm::internal::SqlBinder &binder) const;
     void updateArgs(drogon::orm::internal::SqlBinder &binder) const;
-    ///For mysql only
+    /// For mysql or sqlite3
     void updateId(const uint64_t id);
     void updateId(const uint64_t id);
     std::shared_ptr<int32_t> _id;
     std::shared_ptr<int32_t> _id;
     std::shared_ptr<int32_t> _randomnumber;
     std::shared_ptr<int32_t> _randomnumber;
@@ -87,8 +93,8 @@ class World
         const bool _notNull;
         const bool _notNull;
     };
     };
     static const std::vector<MetaData> _metaData;
     static const std::vector<MetaData> _metaData;
-    bool _dirtyFlag[2]={ false };
+    bool _dirtyFlag[2] = {false};
 };
 };
 
 
-} // namespace hello_world
-} // namespace drogon_model
+}  // namespace hello_world
+}  // namespace drogon_model

+ 51 - 0
frameworks/C++/drogon/drogon_benchmark/plugins/SyncPlugin.cc

@@ -0,0 +1,51 @@
+/**
+ *
+ *  SyncPlugin.cc
+ *
+ */
+
+#include "SyncPlugin.h"
+#include <drogon/drogon.h>
+
+using namespace drogon;
+
+void SyncPlugin::initAndStart(const Json::Value &config)
+{
+    /// Initialize and start the plugin
+    drogon::app().registerSyncAdvice(
+        [](const HttpRequestPtr &req) -> HttpResponsePtr {
+            if (req->method() != Get)
+            {
+                return HttpResponsePtr{};
+            }
+            switch (req->path().length())
+            {
+                case 5:
+                    if (req->path() == "/json")
+                    {
+                        Json::Value ret;
+                        ret["message"] = "Hello, World!";
+                        return HttpResponse::newHttpJsonResponse(ret);
+                    }
+                    break;
+                case 10:
+                    if (req->path() == "/plaintext")
+                    {
+                        auto resp = HttpResponse::newHttpResponse();
+                        resp->setBody("Hello, World!");
+                        resp->setContentTypeCodeAndCustomString(
+                            CT_TEXT_PLAIN, "Content-Type: text/plain\r\n");
+                        return resp;
+                    }
+                    break;
+                default:
+                    break;
+            }
+            return HttpResponsePtr{};
+        });
+}
+
+void SyncPlugin::shutdown()
+{
+    /// Shutdown the plugin
+}

+ 24 - 0
frameworks/C++/drogon/drogon_benchmark/plugins/SyncPlugin.h

@@ -0,0 +1,24 @@
+/**
+ *
+ *  SyncPlugin.h
+ *
+ */
+
+#pragma once
+
+#include <drogon/plugins/Plugin.h>
+
+
+class SyncPlugin : public drogon::Plugin<SyncPlugin>
+{
+  public:
+    SyncPlugin() {}
+    /// This method must be called by drogon to initialize and start the plugin.
+    /// It must be implemented by the user.
+    virtual void initAndStart(const Json::Value &config) override;
+
+    /// This method must be called by drogon to shutdown the plugin.
+    /// It must be implemented by the user.
+    virtual void shutdown() override;
+};
+

+ 7 - 11
frameworks/C++/drogon/drogon_benchmark/views/fortune.csp

@@ -5,15 +5,11 @@ using namespace drogon_model::hello_world;
 <%c++
 <%c++
 auto &rows=@@.get<std::vector<Fortune>>("rows");
 auto &rows=@@.get<std::vector<Fortune>>("rows");
 %>
 %>
-<!DOCTYPE html>
-<html>
-<head><title>Fortunes</title></head>
-<body>
-<table>
-<tr><th>id</th><th>message</th></tr>
-<%c++for(auto &row:rows){%>
-<tr><td>{%row.getValueOfId()%}</td><td>{%HttpViewData::htmlTranslate(row.getValueOfMessage())%}</td></tr>
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>
+<%c++for(auto const &row:rows){%>
+<tr><td>{%row.getValueOfId()%}</td><td><%c++ if(HttpViewData::needTranslation(row.getValueOfMessage()))
+                                         $$<<HttpViewData::htmlTranslate(row.getValueOfMessage());
+                                    else
+                                         $$<<row.getValueOfMessage();%></td></tr>
 <%c++}%>
 <%c++}%>
-</table>
-</body>
-</html>
+</table></body></html>

+ 8 - 12
frameworks/C++/drogon/drogon_benchmark/views/fortune_raw.csp

@@ -1,15 +1,11 @@
 <%c++
 <%c++
-auto &rows=@@.get<std::vector<std::pair<int,std::string>>>("rows");
+auto &rows=@@.get<std::vector<std::pair<string_view,string_view>>>("rows");
 %>
 %>
-<!DOCTYPE html>
-<html>
-<head><title>Fortunes</title></head>
-<body>
-<table>
-<tr><th>id</th><th>message</th></tr>
-<%c++for(auto &row:rows){%>
-<tr><td>{%row.first%}</td><td>{%HttpViewData::htmlTranslate(row.second)%}</td></tr>
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>
+<%c++for(auto const &row:rows){%>
+<tr><td>{%row.first%}</td><td><%c++ if(HttpViewData::needTranslation(row.second))
+                                         $$<<HttpViewData::htmlTranslate(row.second);
+                                    else
+                                         $$<<row.second;%></td></tr>
 <%c++}%>
 <%c++}%>
-</table>
-</body>
-</html>
+</table></body></html>

+ 2 - 2
frameworks/C/h2o/h2o.dockerfile

@@ -13,13 +13,13 @@ ENV MUSTACHE_C_PREFIX=/opt/mustache-c
 
 
 RUN git clone "https://github.com/x86-64/mustache-c.git" "$MUSTACHE_C_BUILD_DIR" && \
 RUN git clone "https://github.com/x86-64/mustache-c.git" "$MUSTACHE_C_BUILD_DIR" && \
     cd "$MUSTACHE_C_BUILD_DIR" && \
     cd "$MUSTACHE_C_BUILD_DIR" && \
-    git checkout 01f1e4732c4862071bbf07242128abf1e28cc105 && \
+    git checkout c1948c599edfe48c6099ed70ab1d5911d8c3ddc8 && \
     CFLAGS="-O3 -flto -march=native" ./autogen.sh --prefix="$MUSTACHE_C_PREFIX" && \
     CFLAGS="-O3 -flto -march=native" ./autogen.sh --prefix="$MUSTACHE_C_PREFIX" && \
     make -j "$(nproc)" install
     make -j "$(nproc)" install
 
 
 ### Install h2o
 ### Install h2o
 
 
-ENV H2O_VERSION=2.2.5
+ENV H2O_VERSION=2.2.6
 ENV H2O_ARCHIVE="v${H2O_VERSION}.tar.gz"
 ENV H2O_ARCHIVE="v${H2O_VERSION}.tar.gz"
 ENV H2O_PREFIX=/opt/h2o
 ENV H2O_PREFIX=/opt/h2o
 
 

+ 3 - 17
frameworks/C/h2o/h2o.sh

@@ -8,7 +8,6 @@ H2O_APP_PROFILE_URL="http://127.0.0.1:$H2O_APP_PROFILE_PORT"
 SCRIPT_PATH=$(realpath "$0")
 SCRIPT_PATH=$(realpath "$0")
 H2O_APP_SRC_ROOT=$(dirname "$SCRIPT_PATH")
 H2O_APP_SRC_ROOT=$(dirname "$SCRIPT_PATH")
 H2O_APP_BUILD_DIR="${H2O_APP_SRC_ROOT}/build"
 H2O_APP_BUILD_DIR="${H2O_APP_SRC_ROOT}/build"
-NUM_WORKERS="$CPU_COUNT"
 
 
 if [[ -z "$DBHOST" ]]; then
 if [[ -z "$DBHOST" ]]; then
 	DBHOST=tfb-database
 	DBHOST=tfb-database
@@ -29,11 +28,9 @@ fi
 # A hacky way to detect whether we are running in the physical hardware or the cloud environment.
 # A hacky way to detect whether we are running in the physical hardware or the cloud environment.
 if [[ "$CPU_COUNT" -gt 16 ]]; then
 if [[ "$CPU_COUNT" -gt 16 ]]; then
 	echo "Running h2o_app in the physical hardware environment."
 	echo "Running h2o_app in the physical hardware environment."
-	USE_PROCESSES=false
-	DB_CONN=3
+	DB_CONN=5
 else
 else
 	echo "Running h2o_app in the cloud environment."
 	echo "Running h2o_app in the cloud environment."
-	USE_PROCESSES=false
 	DB_CONN=5
 	DB_CONN=5
 fi
 fi
 
 
@@ -54,6 +51,7 @@ run_curl()
 
 
 run_h2o_app()
 run_h2o_app()
 {
 {
+	LD_LIBRARY_PATH="${MUSTACHE_C_PREFIX}/lib:$LD_LIBRARY_PATH" \
 	taskset -c "$1" "$2/h2o_app" -a20 -f "$3/template" -m "$DB_CONN" "$4" "$5" \
 	taskset -c "$1" "$2/h2o_app" -a20 -f "$3/template" -m "$DB_CONN" "$4" "$5" \
 	        -d "host=$DBHOST dbname=hello_world user=benchmarkdbuser sslmode=disable \
 	        -d "host=$DBHOST dbname=hello_world user=benchmarkdbuser sslmode=disable \
 	            password=benchmarkdbpass" &
 	            password=benchmarkdbpass" &
@@ -86,17 +84,5 @@ make -j "$CPU_COUNT" install
 popd
 popd
 rm -rf "$H2O_APP_BUILD_DIR"
 rm -rf "$H2O_APP_BUILD_DIR"
 echo "Maximum database connections per thread: $DB_CONN"
 echo "Maximum database connections per thread: $DB_CONN"
-export LD_LIBRARY_PATH="${MUSTACHE_C_PREFIX}/lib:$LD_LIBRARY_PATH"
-
-if "$USE_PROCESSES"; then
-	echo "h2o_app processes: $NUM_WORKERS"
-
-	for ((i = 0; i < NUM_WORKERS; i++)); do
-		run_h2o_app "$i" "${H2O_APP_PREFIX}/bin" "${H2O_APP_PREFIX}/share/h2o_app" -t1
-	done
-else
-	echo "Running h2o_app multithreaded."
-	run_h2o_app 0 "${H2O_APP_PREFIX}/bin" "${H2O_APP_PREFIX}/share/h2o_app"
-fi
-
+run_h2o_app 0 "${H2O_APP_PREFIX}/bin" "${H2O_APP_PREFIX}/share/h2o_app"
 wait
 wait

+ 4 - 11
frameworks/C/h2o/src/database.c

@@ -390,12 +390,8 @@ static void start_database_connect(thread_context_t *ctx, db_conn_t *db_conn)
 	}
 	}
 	else {
 	else {
 		ctx->db_state.db_conn_num++;
 		ctx->db_state.db_conn_num++;
-		db_conn = calloc(1, sizeof(*db_conn));
-
-		if (!db_conn) {
-			STANDARD_ERROR("calloc");
-			goto error;
-		}
+		db_conn = h2o_mem_alloc(sizeof(*db_conn));
+		memset(db_conn, 0, sizeof(*db_conn));
 
 
 		const char * const conninfo = ctx->config->db_host ? ctx->config->db_host : "";
 		const char * const conninfo = ctx->config->db_host ? ctx->config->db_host : "";
 
 
@@ -451,17 +447,14 @@ error_dup:
 	PQfinish(db_conn->conn);
 	PQfinish(db_conn->conn);
 error_connect:
 error_connect:
 	free(db_conn);
 	free(db_conn);
-error:
 	error_notification(ctx, false, DB_ERROR);
 	error_notification(ctx, false, DB_ERROR);
 }
 }
 
 
 void add_prepared_statement(const char *name, const char *query, list_t **prepared_statements)
 void add_prepared_statement(const char *name, const char *query, list_t **prepared_statements)
 {
 {
-	prepared_statement_t * const p = calloc(1, sizeof(*p));
-
-	if (!p)
-		abort();
+	prepared_statement_t * const p = h2o_mem_alloc(sizeof(*p));
 
 
+	memset(p, 0, sizeof(*p));
 	p->l.next = *prepared_statements;
 	p->l.next = *prepared_statements;
 	p->name = name;
 	p->name = name;
 	p->query = query;
 	p->query = query;

+ 2 - 4
frameworks/C/h2o/src/event_loop.c

@@ -233,11 +233,9 @@ static void shutdown_server(h2o_socket_t *listener, const char *err)
 		}
 		}
 
 
 		for (size_t i = ctx->config->thread_num - 1; i > 0; i--) {
 		for (size_t i = ctx->config->thread_num - 1; i > 0; i--) {
-			message_t * const msg = calloc(1, sizeof(*msg));
-
-			if (!msg)
-				abort();
+			message_t * const msg = h2o_mem_alloc(sizeof(*msg));
 
 
+			memset(msg, 0, sizeof(*msg));
 			msg->type = SHUTDOWN;
 			msg->type = SHUTDOWN;
 			h2o_multithread_send_message(&ctx->global_thread_data[i].h2o_receiver, &msg->super);
 			h2o_multithread_send_message(&ctx->global_thread_data[i].h2o_receiver, &msg->super);
 		}
 		}

+ 24 - 28
frameworks/C/h2o/src/handlers/fortune.c

@@ -194,35 +194,31 @@ static int fortunes(struct st_h2o_handler_t *self, h2o_req_t *req)
 	thread_context_t * const ctx = H2O_STRUCT_FROM_MEMBER(thread_context_t,
 	thread_context_t * const ctx = H2O_STRUCT_FROM_MEMBER(thread_context_t,
 	                                                      event_loop.h2o_ctx,
 	                                                      event_loop.h2o_ctx,
 	                                                      req->conn->ctx);
 	                                                      req->conn->ctx);
-	fortune_ctx_t * const fortune_ctx = calloc(1, sizeof(*fortune_ctx));
-
-	if (fortune_ctx) {
-		fortune_t * const fortune = h2o_mem_alloc_pool(&req->pool, sizeof(*fortune));
-		fortune_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool, sizeof(*p), cleanup_request);
-
-		*p = fortune_ctx;
-		memset(fortune, 0, sizeof(*fortune));
-		fortune->id.base = NEW_FORTUNE_ID;
-		fortune->id.len = sizeof(NEW_FORTUNE_ID) - 1;
-		fortune->message.base = NEW_FORTUNE_MESSAGE;
-		fortune->message.len = sizeof(NEW_FORTUNE_MESSAGE) - 1;
-		fortune_ctx->generator.proceed = complete_fortunes;
-		fortune_ctx->num_result = 1;
-		fortune_ctx->param.command = FORTUNE_TABLE_NAME;
-		fortune_ctx->param.on_error = on_fortune_error;
-		fortune_ctx->param.on_result = on_fortune_result;
-		fortune_ctx->param.on_timeout = on_fortune_timeout;
-		fortune_ctx->param.flags = IS_PREPARED;
-		fortune_ctx->req = req;
-		fortune_ctx->result = &fortune->l;
-
-		if (execute_query(ctx, &fortune_ctx->param)) {
-			fortune_ctx->cleanup = true;
-			send_service_unavailable_error(DB_REQ_ERROR, req);
-		}
+	fortune_ctx_t * const fortune_ctx = h2o_mem_alloc(sizeof(*fortune_ctx));
+	fortune_t * const fortune = h2o_mem_alloc_pool(&req->pool, sizeof(*fortune));
+	fortune_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool, sizeof(*p), cleanup_request);
+
+	*p = fortune_ctx;
+	memset(fortune, 0, sizeof(*fortune));
+	fortune->id.base = NEW_FORTUNE_ID;
+	fortune->id.len = sizeof(NEW_FORTUNE_ID) - 1;
+	fortune->message.base = NEW_FORTUNE_MESSAGE;
+	fortune->message.len = sizeof(NEW_FORTUNE_MESSAGE) - 1;
+	memset(fortune_ctx, 0, sizeof(*fortune_ctx));
+	fortune_ctx->generator.proceed = complete_fortunes;
+	fortune_ctx->num_result = 1;
+	fortune_ctx->param.command = FORTUNE_TABLE_NAME;
+	fortune_ctx->param.on_error = on_fortune_error;
+	fortune_ctx->param.on_result = on_fortune_result;
+	fortune_ctx->param.on_timeout = on_fortune_timeout;
+	fortune_ctx->param.flags = IS_PREPARED;
+	fortune_ctx->req = req;
+	fortune_ctx->result = &fortune->l;
+
+	if (execute_query(ctx, &fortune_ctx->param)) {
+		fortune_ctx->cleanup = true;
+		send_service_unavailable_error(DB_REQ_ERROR, req);
 	}
 	}
-	else
-		send_error(INTERNAL_SERVER_ERROR, REQ_ERROR, req);
 
 
 	return 0;
 	return 0;
 }
 }

+ 111 - 122
frameworks/C/h2o/src/handlers/world.c

@@ -250,67 +250,65 @@ static int do_multiple_queries(bool do_update, bool use_cache, h2o_req_t *req)
 			sz += update_query_len - reuse_size;
 			sz += update_query_len - reuse_size;
 	}
 	}
 
 
-	multiple_query_ctx_t * const query_ctx = calloc(1, sz);
-
-	if (query_ctx) {
-		multiple_query_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool,
-		                                                       sizeof(*p),
-		                                                       cleanup_multiple_query_request);
-
-		*p = query_ctx;
-		query_ctx->ctx = ctx;
-		query_ctx->num_query = num_query;
-		query_ctx->req = req;
-		query_ctx->query_param = (query_param_t *) ((char *) query_ctx + base_size);
-		initialize_ids(num_query, query_ctx->res, &ctx->random_seed);
-
-		if (do_update)
-			query_ctx->flags |= DO_UPDATE;
-
-		if (use_cache) {
-			query_ctx->flags |= USE_CACHE;
-			fetch_from_cache(h2o_now(ctx->event_loop.h2o_ctx.loop),
-			                 &ctx->global_data->request_handler_data.world_cache,
-			                 query_ctx);
-
-			if (query_ctx->num_result == query_ctx->num_query) {
-				complete_multiple_query(query_ctx);
-				return 0;
-			}
+	multiple_query_ctx_t * const query_ctx = h2o_mem_alloc(sz);
+	multiple_query_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool,
+	                                                       sizeof(*p),
+	                                                       cleanup_multiple_query_request);
+
+	*p = query_ctx;
+	memset(query_ctx, 0, sz);
+	query_ctx->ctx = ctx;
+	query_ctx->num_query = num_query;
+	query_ctx->req = req;
+	query_ctx->query_param = (query_param_t *) ((char *) query_ctx + base_size);
+	initialize_ids(num_query, query_ctx->res, &ctx->random_seed);
+
+	if (do_update)
+		query_ctx->flags |= DO_UPDATE;
+
+	if (use_cache) {
+		query_ctx->flags |= USE_CACHE;
+		fetch_from_cache(h2o_now(ctx->event_loop.h2o_ctx.loop),
+		                 &ctx->global_data->request_handler_data.world_cache,
+		                 query_ctx);
+
+		if (query_ctx->num_result == query_ctx->num_query) {
+			complete_multiple_query(query_ctx);
+			return 0;
 		}
 		}
+	}
 
 
-		query_ctx->num_query_in_progress = MIN(num_query_in_progress,
-		                                       query_ctx->num_query - query_ctx->num_result);
-
-		for (size_t i = 0; i < query_ctx->num_query_in_progress; i++) {
-			query_ctx->query_param[i].ctx = query_ctx;
-			// We need a copy of id because the original may be overwritten
-			// by a completed query.
-			query_ctx->query_param[i].id = htonl(query_ctx->res[query_ctx->num_result + i].id);
-			query_ctx->query_param[i].id_format = 1;
-			query_ctx->query_param[i].id_len = sizeof(query_ctx->query_param[i].id);
-			query_ctx->query_param[i].id_pointer = (const char *) &query_ctx->query_param[i].id;
-			query_ctx->query_param[i].param.command = WORLD_TABLE_NAME;
-			query_ctx->query_param[i].param.nParams = 1;
-			query_ctx->query_param[i].param.on_error = on_multiple_query_error;
-			query_ctx->query_param[i].param.on_result = on_multiple_query_result;
-			query_ctx->query_param[i].param.on_timeout = on_multiple_query_timeout;
-			query_ctx->query_param[i].param.paramFormats = &query_ctx->query_param[i].id_format;
-			query_ctx->query_param[i].param.paramLengths = &query_ctx->query_param[i].id_len;
-			query_ctx->query_param[i].param.paramValues = &query_ctx->query_param[i].id_pointer;
-			query_ctx->query_param[i].param.flags = IS_PREPARED;
-			query_ctx->query_param[i].param.resultFormat = 1;
-
-			if (execute_query(ctx, &query_ctx->query_param[i].param)) {
-				query_ctx->num_query_in_progress = i;
-				query_ctx->flags |= DO_CLEANUP;
-				send_service_unavailable_error(DB_REQ_ERROR, req);
-				return 0;
-			}
-		}
+	query_ctx->num_query_in_progress = MIN(num_query_in_progress,
+	                                       query_ctx->num_query - query_ctx->num_result);
+
+	// Keep this loop separate, so that it could be vectorized.
+	for (size_t i = 0; i < query_ctx->num_query_in_progress; i++) {
+		query_ctx->query_param[i].ctx = query_ctx;
+		// We need a copy of id because the original may be overwritten
+		// by a completed query.
+		query_ctx->query_param[i].id = htonl(query_ctx->res[query_ctx->num_result + i].id);
+		query_ctx->query_param[i].id_format = 1;
+		query_ctx->query_param[i].id_len = sizeof(query_ctx->query_param[i].id);
+		query_ctx->query_param[i].id_pointer = (const char *) &query_ctx->query_param[i].id;
+		query_ctx->query_param[i].param.command = WORLD_TABLE_NAME;
+		query_ctx->query_param[i].param.nParams = 1;
+		query_ctx->query_param[i].param.on_error = on_multiple_query_error;
+		query_ctx->query_param[i].param.on_result = on_multiple_query_result;
+		query_ctx->query_param[i].param.on_timeout = on_multiple_query_timeout;
+		query_ctx->query_param[i].param.paramFormats = &query_ctx->query_param[i].id_format;
+		query_ctx->query_param[i].param.paramLengths = &query_ctx->query_param[i].id_len;
+		query_ctx->query_param[i].param.paramValues = &query_ctx->query_param[i].id_pointer;
+		query_ctx->query_param[i].param.flags = IS_PREPARED;
+		query_ctx->query_param[i].param.resultFormat = 1;
 	}
 	}
-	else
-		send_error(INTERNAL_SERVER_ERROR, REQ_ERROR, req);
+
+	for (size_t i = 0; i < query_ctx->num_query_in_progress; i++)
+		if (execute_query(ctx, &query_ctx->query_param[i].param)) {
+			query_ctx->num_query_in_progress = i;
+			query_ctx->flags |= DO_CLEANUP;
+			send_service_unavailable_error(DB_REQ_ERROR, req);
+			break;
+		}
 
 
 	return 0;
 	return 0;
 }
 }
@@ -482,19 +480,16 @@ static result_return_t on_multiple_query_result(db_query_param_t *param, PGresul
 		process_result(result, 0, query_ctx->res + query_ctx->num_result);
 		process_result(result, 0, query_ctx->res + query_ctx->num_result);
 
 
 		if (query_ctx->flags & USE_CACHE) {
 		if (query_ctx->flags & USE_CACHE) {
-			query_result_t * const r = malloc(sizeof(*r));
-
-			if (r) {
-				const h2o_iovec_t key = {.base = (char *) &r->id, .len = sizeof(r->id)};
-				const h2o_iovec_t value = {.base = (char *) r, .len = sizeof(*r)};
-
-				*r = query_ctx->res[query_ctx->num_result];
-				cache_set(h2o_now(query_ctx->ctx->event_loop.h2o_ctx.loop),
-				          key,
-				          0,
-				          value,
-				          &query_ctx->ctx->global_data->request_handler_data.world_cache);
-			}
+			query_result_t * const r = h2o_mem_alloc(sizeof(*r));
+			const h2o_iovec_t key = {.base = (char *) &r->id, .len = sizeof(r->id)};
+			const h2o_iovec_t value = {.base = (char *) r, .len = sizeof(*r)};
+
+			*r = query_ctx->res[query_ctx->num_result];
+			cache_set(h2o_now(query_ctx->ctx->event_loop.h2o_ctx.loop),
+			          key,
+			          0,
+			          value,
+			          &query_ctx->ctx->global_data->request_handler_data.world_cache);
 		}
 		}
 
 
 		query_ctx->num_result++;
 		query_ctx->num_result++;
@@ -559,20 +554,19 @@ static result_return_t on_populate_cache_result(db_query_param_t *param, PGresul
 		const size_t num_rows = PQntuples(result);
 		const size_t num_rows = PQntuples(result);
 
 
 		for (size_t i = 0; i < num_rows; i++) {
 		for (size_t i = 0; i < num_rows; i++) {
-			query_result_t * const r = calloc(1, sizeof(*r));
+			query_result_t * const r = h2o_mem_alloc(sizeof(*r));
 
 
-			if (r) {
-				process_result(result, i, r);
+			memset(r, 0, sizeof(*r));
+			process_result(result, i, r);
 
 
-				const h2o_iovec_t key = {.base = (char *) &r->id, .len = sizeof(r->id)};
-				const h2o_iovec_t value = {.base = (char *) r, .len = sizeof(*r)};
+			const h2o_iovec_t key = {.base = (char *) &r->id, .len = sizeof(r->id)};
+			const h2o_iovec_t value = {.base = (char *) r, .len = sizeof(*r)};
 
 
-				cache_set(h2o_now(query_ctx->ctx->event_loop.h2o_ctx.loop),
-				          key,
-				          0,
-				          value,
-				          &query_ctx->ctx->global_data->request_handler_data.world_cache);
-			}
+			cache_set(h2o_now(query_ctx->ctx->event_loop.h2o_ctx.loop),
+			          key,
+			          0,
+			          value,
+			          &query_ctx->ctx->global_data->request_handler_data.world_cache);
 		}
 		}
 	}
 	}
 	else
 	else
@@ -696,18 +690,17 @@ static void populate_cache(thread_context_t *ctx, void *arg)
 {
 {
 	IGNORE_FUNCTION_PARAMETER(arg);
 	IGNORE_FUNCTION_PARAMETER(arg);
 
 
-	populate_cache_ctx_t * const query_ctx = calloc(1, sizeof(*query_ctx));
+	populate_cache_ctx_t * const query_ctx = h2o_mem_alloc(sizeof(*query_ctx));
 
 
-	if (query_ctx) {
-		query_ctx->ctx = ctx;
-		query_ctx->param.command = POPULATE_CACHE_QUERY;
-		query_ctx->param.on_error = on_populate_cache_error;
-		query_ctx->param.on_result = on_populate_cache_result;
-		query_ctx->param.on_timeout = on_populate_cache_timeout;
+	memset(query_ctx, 0, sizeof(*query_ctx));
+	query_ctx->ctx = ctx;
+	query_ctx->param.command = POPULATE_CACHE_QUERY;
+	query_ctx->param.on_error = on_populate_cache_error;
+	query_ctx->param.on_result = on_populate_cache_result;
+	query_ctx->param.on_timeout = on_populate_cache_timeout;
 
 
-		if (execute_query(ctx, &query_ctx->param))
-			free(query_ctx);
-	}
+	if (execute_query(ctx, &query_ctx->param))
+		free(query_ctx);
 }
 }
 
 
 static void process_result(PGresult *result, size_t idx, query_result_t *out)
 static void process_result(PGresult *result, size_t idx, query_result_t *out)
@@ -791,37 +784,33 @@ static int single_query(struct st_h2o_handler_t *self, h2o_req_t *req)
 	thread_context_t * const ctx = H2O_STRUCT_FROM_MEMBER(thread_context_t,
 	thread_context_t * const ctx = H2O_STRUCT_FROM_MEMBER(thread_context_t,
 	                                                      event_loop.h2o_ctx,
 	                                                      event_loop.h2o_ctx,
 	                                                      req->conn->ctx);
 	                                                      req->conn->ctx);
-	single_query_ctx_t * const query_ctx = calloc(1, sizeof(*query_ctx));
-
-	if (query_ctx) {
-		single_query_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool,
-		                                                     sizeof(*p),
-		                                                     cleanup_single_query_request);
-
-		*p = query_ctx;
-		query_ctx->id = htonl(get_random_number(MAX_ID, &ctx->random_seed) + 1);
-		query_ctx->id_format = 1;
-		query_ctx->id_len = sizeof(query_ctx->id);
-		query_ctx->id_pointer = (const char *) &query_ctx->id;
-		query_ctx->param.command = WORLD_TABLE_NAME;
-		query_ctx->param.nParams = 1;
-		query_ctx->param.on_error = on_single_query_error;
-		query_ctx->param.on_result = on_single_query_result;
-		query_ctx->param.on_timeout = on_single_query_timeout;
-		query_ctx->param.paramFormats = &query_ctx->id_format;
-		query_ctx->param.paramLengths = &query_ctx->id_len;
-		query_ctx->param.paramValues = &query_ctx->id_pointer;
-		query_ctx->param.flags = IS_PREPARED;
-		query_ctx->param.resultFormat = 1;
-		query_ctx->req = req;
-
-		if (execute_query(ctx, &query_ctx->param)) {
-			query_ctx->cleanup = true;
-			send_service_unavailable_error(DB_REQ_ERROR, req);
-		}
+	single_query_ctx_t * const query_ctx = h2o_mem_alloc(sizeof(*query_ctx));
+	single_query_ctx_t ** const p = h2o_mem_alloc_shared(&req->pool,
+	                                                     sizeof(*p),
+	                                                     cleanup_single_query_request);
+
+	*p = query_ctx;
+	memset(query_ctx, 0, sizeof(*query_ctx));
+	query_ctx->id = htonl(get_random_number(MAX_ID, &ctx->random_seed) + 1);
+	query_ctx->id_format = 1;
+	query_ctx->id_len = sizeof(query_ctx->id);
+	query_ctx->id_pointer = (const char *) &query_ctx->id;
+	query_ctx->param.command = WORLD_TABLE_NAME;
+	query_ctx->param.nParams = 1;
+	query_ctx->param.on_error = on_single_query_error;
+	query_ctx->param.on_result = on_single_query_result;
+	query_ctx->param.on_timeout = on_single_query_timeout;
+	query_ctx->param.paramFormats = &query_ctx->id_format;
+	query_ctx->param.paramLengths = &query_ctx->id_len;
+	query_ctx->param.paramValues = &query_ctx->id_pointer;
+	query_ctx->param.flags = IS_PREPARED;
+	query_ctx->param.resultFormat = 1;
+	query_ctx->req = req;
+
+	if (execute_query(ctx, &query_ctx->param)) {
+		query_ctx->cleanup = true;
+		send_service_unavailable_error(DB_REQ_ERROR, req);
 	}
 	}
-	else
-		send_error(INTERNAL_SERVER_ERROR, REQ_ERROR, req);
 
 
 	return 0;
 	return 0;
 }
 }

+ 2 - 4
frameworks/C/h2o/src/main.c

@@ -276,11 +276,9 @@ void add_postinitialization_task(void (*task)(struct thread_context_t *, void *)
                                  void *arg,
                                  void *arg,
                                  list_t **postinitialization_tasks)
                                  list_t **postinitialization_tasks)
 {
 {
-	task_t * const t = calloc(1, sizeof(*t));
-
-	if (!t)
-		abort();
+	task_t * const t = h2o_mem_alloc(sizeof(*t));
 
 
+	memset(t, 0, sizeof(*t));
 	t->l.next = *postinitialization_tasks;
 	t->l.next = *postinitialization_tasks;
 	t->arg = arg;
 	t->arg = arg;
 	t->task = task;
 	t->task = task;

+ 5 - 1
frameworks/C/h2o/src/thread.c

@@ -123,6 +123,8 @@ global_thread_data_t *initialize_global_thread_data(const config_t *config,
 			ret[i].global_data = global_data;
 			ret[i].global_data = global_data;
 		}
 		}
 	}
 	}
+	else
+		STANDARD_ERROR("aligned_alloc");
 
 
 	return ret;
 	return ret;
 }
 }
@@ -152,8 +154,10 @@ void start_threads(global_thread_data_t *global_thread_data)
 	const size_t cpusetsize = CPU_ALLOC_SIZE(num_cpus);
 	const size_t cpusetsize = CPU_ALLOC_SIZE(num_cpus);
 	cpu_set_t * const cpuset = CPU_ALLOC(num_cpus);
 	cpu_set_t * const cpuset = CPU_ALLOC(num_cpus);
 
 
-	if (!cpuset)
+	if (!cpuset) {
+		STANDARD_ERROR("CPU_ALLOC");
 		abort();
 		abort();
+	}
 
 
 	CHECK_ERROR(pthread_attr_init, &attr);
 	CHECK_ERROR(pthread_attr_init, &attr);
 	// The first thread context is used by the main thread.
 	// The first thread context is used by the main thread.

+ 5 - 2
frameworks/C/h2o/src/tls.c

@@ -150,8 +150,11 @@ void initialize_openssl(const config_t *config, global_data_t *global_data)
 	SSL_library_init();
 	SSL_library_init();
 	SSL_load_error_strings();
 	SSL_load_error_strings();
 	openssl_global_data.num_lock = CRYPTO_num_locks();
 	openssl_global_data.num_lock = CRYPTO_num_locks();
-	openssl_global_data.lock = calloc(openssl_global_data.num_lock,
-	                                  sizeof(*openssl_global_data.lock));
+	openssl_global_data.lock =
+			h2o_mem_alloc(openssl_global_data.num_lock * sizeof(*openssl_global_data.lock));
+	memset(openssl_global_data.lock,
+	       0,
+	       openssl_global_data.num_lock * sizeof(*openssl_global_data.lock));
 	CHECK_ERROR(pthread_mutexattr_init, &openssl_global_data.lock_attr);
 	CHECK_ERROR(pthread_mutexattr_init, &openssl_global_data.lock_attr);
 	CHECK_ERROR(pthread_mutexattr_settype,
 	CHECK_ERROR(pthread_mutexattr_settype,
 	            &openssl_global_data.lock_attr,
 	            &openssl_global_data.lock_attr,

+ 6 - 8
frameworks/C/h2o/src/utility.c

@@ -164,15 +164,13 @@ json_generator_t *get_json_generator(list_t **pool, size_t *gen_num)
 		(*gen_num)--;
 		(*gen_num)--;
 	}
 	}
 	else {
 	else {
-		ret = malloc(sizeof(*ret));
+		ret = h2o_mem_alloc(sizeof(*ret));
+		memset(ret, 0, sizeof(*ret));
+		ret->gen = yajl_gen_alloc(NULL);
 
 
-		if (ret) {
-			ret->gen = yajl_gen_alloc(NULL);
-
-			if (!ret->gen) {
-				free(ret);
-				ret = NULL;
-			}
+		if (!ret->gen) {
+			free(ret);
+			ret = NULL;
 		}
 		}
 	}
 	}
 
 

+ 37 - 0
frameworks/CSharp/.gitignore

@@ -0,0 +1,37 @@
+*.swp
+*.*~
+project.lock.json
+.DS_Store
+*.pyc
+nupkg/
+
+# Visual Studio Code
+.vscode
+
+# Rider
+.idea
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+build/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+msbuild.log
+msbuild.err
+msbuild.wrn
+
+# Visual Studio 2015
+.vs/

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-jn.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 COPY run.sh run.sh
 
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 
 CMD bash run.sh
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my-ef.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 COPY run.sh run.sh
 
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 
 CMD bash run.sh
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-my.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 COPY run.sh run.sh
 
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 
 CMD bash run.sh
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx-ss.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 COPY run.sh run.sh
 
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 
 CMD bash run.sh
 CMD bash run.sh

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/aspnet-mono-ngx.dockerfile

@@ -6,7 +6,7 @@ COPY src src
 COPY nginx.conf nginx.conf
 COPY nginx.conf nginx.conf
 COPY run.sh run.sh
 COPY run.sh run.sh
 
 
-RUN xbuild src/Benchmarks.build.proj /t:Clean
-RUN xbuild src/Benchmarks.build.proj /t:Build
+RUN msbuild src/Benchmarks.build.proj /t:Clean
+RUN msbuild src/Benchmarks.build.proj /t:Build
 
 
 CMD bash run.sh
 CMD bash run.sh

+ 1 - 1
frameworks/CSharp/aspnet-mono-ngx/nginx.conf

@@ -2,7 +2,7 @@ pid /tmp/nginx.pid;
 error_log stderr error;
 error_log stderr error;
 
 
 events {
 events {
-    worker_connections 8192;
+    worker_connections 16384;
 }
 }
 
 
 http {
 http {

+ 8 - 7
frameworks/CSharp/aspnet-mono-ngx/run.sh

@@ -4,24 +4,25 @@ CPU_COUNT=$(nproc)
 
 
 # one fastcgi instance for each thread
 # one fastcgi instance for each thread
 # load balanced by nginx
 # load balanced by nginx
-port_start=9001
-port_end=$(($port_start+$CPU_COUNT))
+socket_index_start=1
+socket_index_end=$(($socket_index_start+$CPU_COUNT))
 
 
 # To debug, use --printlog --verbose --loglevels=All
 # To debug, use --printlog --verbose --loglevels=All
-for port in $(seq $port_start $port_end); do
-	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:/aspnet/src --socket=tcp:127.0.0.1:$port &
+for port in $(seq $socket_index_start $socket_index_end); do
+	MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 --applications=/:/aspnet/src --filename=/tmp/fastcgi-mono-server4-$port --socket=unix &
 done
 done
 
 
 sleep 5s
 sleep 5s
 
 
 # nginx
 # nginx
 conf="upstream mono {\n"
 conf="upstream mono {\n"
-for port in $(seq $port_start $port_end); do
-  conf+="\tserver 127.0.0.1:${port};\n"
+for port in $(seq $socket_index_start $socket_index_end); do
+  chmod -R 777 /tmp/fastcgi-mono-server4-$port
+  conf+="\tserver unix:/tmp/fastcgi-mono-server4-${port};\n"
 done
 done
 conf+="}"
 conf+="}"
 
 
 echo -e $conf > nginx.upstream.conf
 echo -e $conf > nginx.upstream.conf
-nginx -c /aspnet/nginx.conf -g "worker_processes ${CPU_COUNT};"
+nginx -c /aspnet/nginx.conf
 
 
 wait
 wait

+ 2 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.build.proj

@@ -6,9 +6,9 @@
     <Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
     <Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
     <NuGetExe Condition=" '$(NuGetExe)'=='' ">packages/nuget.exe</NuGetExe>
     <NuGetExe Condition=" '$(NuGetExe)'=='' ">packages/nuget.exe</NuGetExe>
     <NuGetExeDir>packages/</NuGetExeDir>
     <NuGetExeDir>packages/</NuGetExeDir>
-    <NuGetDownloadAddress Condition=" '$(NuGetDownloadAddress)'=='' ">http://nuget.org/nuget.exe</NuGetDownloadAddress>
+    <NuGetDownloadAddress Condition=" '$(NuGetDownloadAddress)'=='' ">https://dist.nuget.org/win-x86-commandline/latest/nuget.exe</NuGetDownloadAddress>
     <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' == 'Windows_NT'">"$(NuGetExe)"</NuGetCommand>
     <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' == 'Windows_NT'">"$(NuGetExe)"</NuGetCommand>
-    <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExe)"</NuGetCommand>
+    <NuGetCommand Condition=" '$(NuGetCommand)'=='' AND '$(OS)' != 'Windows_NT' ">mono "$(NuGetExe)"</NuGetCommand>
     <Properties>Configuration=$(Configuration);SolutionDir=$(SolutionDir)</Properties>
     <Properties>Configuration=$(Configuration);SolutionDir=$(SolutionDir)</Properties>
   </PropertyGroup>
   </PropertyGroup>
 
 

+ 36 - 25
frameworks/CSharp/aspnet-mono-ngx/src/Benchmarks.csproj

@@ -12,7 +12,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>Benchmarks.AspNet</RootNamespace>
     <RootNamespace>Benchmarks.AspNet</RootNamespace>
     <AssemblyName>Benchmarks.AspNet</AssemblyName>
     <AssemblyName>Benchmarks.AspNet</AssemblyName>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
     <MvcBuildViews>false</MvcBuildViews>
     <MvcBuildViews>false</MvcBuildViews>
     <RestorePackages>true</RestorePackages>
     <RestorePackages>true</RestorePackages>
   </PropertyGroup>
   </PropertyGroup>
@@ -47,10 +47,6 @@
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="System.Web.Razor">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
-    </Reference>
     <Reference Include="System.Web.WebPages">
     <Reference Include="System.Web.WebPages">
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.WebPages.3.2.2\lib\net45\System.Web.WebPages.dll</HintPath>
@@ -65,22 +61,6 @@
     <Reference Include="ServiceStack.Text">
     <Reference Include="ServiceStack.Text">
       <HintPath>$(SolutionDir)\packages\ServiceStack.Text.4.0.34\lib\net40\ServiceStack.Text.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\ServiceStack.Text.4.0.34\lib\net40\ServiceStack.Text.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="EntityFramework">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
-    </Reference>
-    <Reference Include="EntityFramework">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
-    </Reference>
-    <Reference Include="MySql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\MySql.Data.6.9.5\lib\net45\MySql.Data.dll</HintPath>
-    </Reference>
-    <Reference Include="MySql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\MySql.Data.Entity.6.9.5\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
-    </Reference>
     <Reference Include="Npgsql">
     <Reference Include="Npgsql">
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Npgsql.dll</HintPath>
@@ -89,10 +69,6 @@
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\Npgsql.EntityFramework.2.2.3\lib\net45\Npgsql.EntityFramework.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\Npgsql.EntityFramework.2.2.3\lib\net45\Npgsql.EntityFramework.dll</HintPath>
     </Reference>
     </Reference>
-    <Reference Include="Npgsql">
-      <Private>True</Private>
-      <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
-    </Reference>
     <Reference Include="MongoDB">
     <Reference Include="MongoDB">
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Bson.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Bson.dll</HintPath>
@@ -101,6 +77,41 @@
       <Private>True</Private>
       <Private>True</Private>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Driver.dll</HintPath>
       <HintPath>$(SolutionDir)\packages\mongocsharpdriver.1.9.2\lib\net35\MongoDB.Driver.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="System.Web.Razor">
+      <Private>True</Private>
+      <HintPath>$(SolutionDir)\packages\Microsoft.AspNet.Razor.3.2.2\lib\net45\System.Web.Razor.dll</HintPath>
+    </Reference>
+    <Reference Include="Renci.SshNet">
+      <HintPath>packages\SSH.NET.2016.1.0\lib\net40\Renci.SshNet.dll</HintPath>
+    </Reference>
+    <Reference Include="BouncyCastle.Crypto">
+      <HintPath>packages\BouncyCastle.1.8.3.1\lib\BouncyCastle.Crypto.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer">
+      <HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ComponentModel.DataAnnotations" />
+    <Reference Include="Google.Protobuf">
+      <HintPath>packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data.EntityFramework">
+      <HintPath>packages\MySql.Data.EntityFramework.8.0.17\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Security" />
+    <Reference Include="System.Xml" />
+    <Reference Include="EntityFramework">
+      <HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data">
+      <HintPath>packages\MySql.Data.8.0.17\lib\net452\MySql.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="Npgsql">
+      <Private>False</Private>
+      <HintPath>$(SolutionDir)\packages\Npgsql.2.2.3\lib\net45\Mono.Security.dll</HintPath>
+    </Reference>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <Compile Include="Application.cs" />
     <Compile Include="Application.cs" />

+ 5 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Controllers/AdoController.cs

@@ -22,9 +22,12 @@ namespace Benchmarks.AspNet.Controllers
             return connection;
             return connection;
         }
         }
         
         
-        public ActionResult Index(string providerName, int? queries)
+        public ActionResult Index(string providerName, string queries)
         {
         {
-            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queries ?? 1)));
+            int queryInt = 1;
+            int.TryParse(queries, out queryInt);
+            
+            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queryInt)));
             
             
             using (DbConnection connection = CreateConnection(providerName))
             using (DbConnection connection = CreateConnection(providerName))
             {
             {

+ 5 - 2
frameworks/CSharp/aspnet-mono-ngx/src/Controllers/EntityFrameworkController.cs

@@ -10,9 +10,12 @@ namespace Benchmarks.AspNet.Controllers
     {
     {
         Random random = new Random();
         Random random = new Random();
 
 
-        public ActionResult Index(string providerName, int? queries)
+        public ActionResult Index(string providerName, string queries)
         {
         {
-            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queries ?? 1)));
+            int queryInt = 1;
+            int.TryParse(queries, out queryInt);
+
+            List<World> worlds = new List<World>(Math.Max(1, Math.Min(500, queryInt)));
 
 
             using (EntityFramework db = new EntityFramework(providerName))
             using (EntityFramework db = new EntityFramework(providerName))
             {
             {

+ 21 - 19
frameworks/CSharp/aspnet-mono-ngx/src/Web.config

@@ -1,31 +1,33 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
 <configuration>
   <configSections>
   <configSections>
-    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
   </configSections>
   </configSections>
   <!-- Connection Strings -->
   <!-- Connection Strings -->
   <!-- Names are case insensitive -->
   <!-- Names are case insensitive -->
   <connectionStrings>
   <connectionStrings>
-    <add name="MySQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="MySql.Data.MySqlClient"/>
-    <add name="PostgreSQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="Npgsql"/>
-    <add name="MongoDB" connectionString="mongodb://tfb-database"/>
-    <add name="SQLServer" connectionString="server=tfb-database; user id=benchmarkdbuser; password=B3nchmarkDBPass; database=hello_world" providerName="System.Data.SqlClient"/>
+    <add name="MySQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="MySql.Data.MySqlClient" />
+    <add name="PostgreSQL" connectionString="server=tfb-database; user id=benchmarkdbuser; password=benchmarkdbpass; database=hello_world" providerName="Npgsql" />
+    <add name="MongoDB" connectionString="mongodb://tfb-database" />
+    <add name="SQLServer" connectionString="server=tfb-database; user id=benchmarkdbuser; password=B3nchmarkDBPass; database=hello_world" providerName="System.Data.SqlClient" />
   </connectionStrings>
   </connectionStrings>
   <!-- ADO.NET -->
   <!-- ADO.NET -->
   <system.data>
   <system.data>
     <DbProviderFactories>
     <DbProviderFactories>
-      <clear/>
-      <add name="MySql.Data.MySqlClient" description="Data Provider for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.5"/>
-      <add name="Npgsql" description="Data Provider for PostgreSQL" invariant="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.3"/>
-      <add name="System.Data.SqlClient" description="Data Provider for Microsoft SQL Server" invariant="System.Data.SqlClient" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0"/>
+      <clear />
+      <add name="MySql.Data.MySqlClient" description="Data Provider for MySQL" invariant="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.17" />
+      <add name="Npgsql" description="Data Provider for PostgreSQL" invariant="Npgsql" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.3" />
+      <add name="System.Data.SqlClient" description="Data Provider for Microsoft SQL Server" invariant="System.Data.SqlClient" type="System.Data.SqlClient.SqlClientFactory, System.Data, Version=4.0.0.0" />
     </DbProviderFactories>
     </DbProviderFactories>
   </system.data>
   </system.data>
   <!-- Entity Framework -->
   <!-- Entity Framework -->
   <entityFramework>
   <entityFramework>
     <providers>
     <providers>
-      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5"/>
-      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.3"/>
+      <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.3" />
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.17">
+      </provider>
     </providers>
     </providers>
   </entityFramework>
   </entityFramework>
   <appSettings>
   <appSettings>
@@ -40,23 +42,23 @@
   </appSettings>
   </appSettings>
   <system.web>
   <system.web>
     <!-- Show errors -->
     <!-- Show errors -->
-    <customErrors mode="Off"/>
+    <customErrors mode="Off" />
   </system.web>
   </system.web>
   <!-- Register the application as an HTTP module -->
   <!-- Register the application as an HTTP module -->
   <system.webServer>
   <system.webServer>
     <!-- Used by IIS -->
     <!-- Used by IIS -->
     <modules>
     <modules>
-      <remove name="Framework Benchmarks"/>
-      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application"/>
+      <remove name="Framework Benchmarks" />
+      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application" />
     </modules>
     </modules>
     <!-- In IIS >= 7.0 it's not possible to have both <httpModules> and <modules>, this setting disables the warning -->
     <!-- In IIS >= 7.0 it's not possible to have both <httpModules> and <modules>, this setting disables the warning -->
-    <validation validateIntegratedModeConfiguration="false"/>
+    <validation validateIntegratedModeConfiguration="false" />
   </system.webServer>
   </system.webServer>
   <system.web>
   <system.web>
     <!-- Used by the XSP web server on mono -->
     <!-- Used by the XSP web server on mono -->
     <httpModules>
     <httpModules>
-      <remove name="Framework Benchmarks"/>
-      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application"/>
+      <remove name="Framework Benchmarks" />
+      <add name="Framework Benchmarks" type="Benchmarks.AspNet.Application" />
     </httpModules>
     </httpModules>
   </system.web>
   </system.web>
-</configuration>
+</configuration>

+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csproj.CoreCompileInputs.cache


BIN
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/Benchmarks.csprojAssemblyReference.cache


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs


+ 0 - 0
frameworks/CSharp/aspnet-mono-ngx/src/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs


+ 15 - 12
frameworks/CSharp/aspnet-mono-ngx/src/packages.config

@@ -1,15 +1,18 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <packages>
 <packages>
-  <package id="EntityFramework" version="6.1.1" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
-  <package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
-  <package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
+  <package id="BouncyCastle" version="1.8.3.1" targetFramework="net472" />
+  <package id="EntityFramework" version="6.2.0" targetFramework="net472" />
+  <package id="Google.Protobuf" version="3.6.1" targetFramework="net472" />
+  <package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net472" />
+  <package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net472" />
+  <package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net472" />
+  <package id="mongocsharpdriver" version="1.9.2" targetFramework="net472" />
   <package id="MSBuild.Microsoft.VisualStudio.Web.targets" version="11.0.2.1" />
   <package id="MSBuild.Microsoft.VisualStudio.Web.targets" version="11.0.2.1" />
-  <package id="mongocsharpdriver" version="1.9.2" targetFramework="net45" />
-  <package id="MySql.Data" version="6.9.5" targetFramework="net45" />
-  <package id="MySql.Data.Entity" version="6.9.5" targetFramework="net45" />
-  <package id="Npgsql" version="2.2.3" targetFramework="net45" />
-  <package id="Npgsql.EntityFramework" version="2.2.3" targetFramework="net45" />
-  <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net45" />
-  <package id="ServiceStack.Text" version="4.0.34" targetFramework="net45" />
+  <package id="MySql.Data" version="8.0.17" targetFramework="net472" />
+  <package id="MySql.Data.EntityFramework" version="8.0.17" targetFramework="net472" />
+  <package id="Newtonsoft.Json" version="6.0.6" targetFramework="net472" />
+  <package id="Npgsql" version="2.2.3" targetFramework="net472" />
+  <package id="Npgsql.EntityFramework" version="2.2.3" targetFramework="net472" />
+  <package id="ServiceStack.Text" version="4.0.34" targetFramework="net472" />
+  <package id="SSH.NET" version="2016.1.0" targetFramework="net472" />
 </packages>
 </packages>

+ 1 - 2
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/AsciiString.cs

@@ -3,7 +3,6 @@
 
 
 using System;
 using System;
 using System.Text;
 using System.Text;
-using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
 
 
 namespace PlatformBenchmarks
 namespace PlatformBenchmarks
 {
 {
@@ -22,7 +21,7 @@ namespace PlatformBenchmarks
 
 
         public static implicit operator AsciiString(string str) => new AsciiString(str);
         public static implicit operator AsciiString(string str) => new AsciiString(str);
 
 
-        public override string ToString() => HttpUtilities.GetAsciiStringNonNullCharacters(_data);
+        public override string ToString() => Encoding.ASCII.GetString(_data);
         public static explicit operator string(AsciiString str) => str.ToString();
         public static explicit operator string(AsciiString str) => str.ToString();
 
 
         public bool Equals(AsciiString other) => ReferenceEquals(_data, other._data) || SequenceEqual(_data, other._data);
         public bool Equals(AsciiString other) => ReferenceEquals(_data, other._data) || SequenceEqual(_data, other._data);

+ 24 - 9
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkApplication.HttpConnection.cs

@@ -41,6 +41,13 @@ namespace PlatformBenchmarks
             }
             }
         }
         }
 
 
+        private static HtmlEncoder CreateHtmlEncoder()
+        {
+            var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana);
+            settings.AllowCharacter('\u2014');  // allow EM DASH through
+            return HtmlEncoder.Create(settings);
+        }
+
         private async Task ProcessRequestsAsync()
         private async Task ProcessRequestsAsync()
         {
         {
             while (true)
             while (true)
@@ -103,10 +110,19 @@ namespace PlatformBenchmarks
 
 
                 if (state == State.Headers)
                 if (state == State.Headers)
                 {
                 {
-                    if (Parser.ParseHeaders(new ParsingAdapter(this), buffer, out consumed, out examined, out int consumedBytes))
+                    var reader = new SequenceReader<byte>(buffer);
+                    var success = Parser.ParseHeaders(new ParsingAdapter(this), ref reader);
+
+                    consumed = reader.Position;
+                    if (success)
                     {
                     {
+                        examined = consumed;
                         state = State.Body;
                         state = State.Body;
                     }
                     }
+                    else
+                    {
+                        examined = buffer.End;
+                    }
 
 
                     buffer = buffer.Slice(consumed);
                     buffer = buffer.Slice(consumed);
                 }
                 }
@@ -129,16 +145,13 @@ namespace PlatformBenchmarks
         {
         {
         }
         }
 
 
-        public async ValueTask OnReadCompletedAsync()
+        public void OnHeadersComplete()
         {
         {
-            await Writer.FlushAsync();
         }
         }
 
 
-        private static HtmlEncoder CreateHtmlEncoder()
+        public async ValueTask OnReadCompletedAsync()
         {
         {
-            var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana);
-            settings.AllowCharacter('\u2014');  // allow EM DASH through
-            return HtmlEncoder.Create(settings);
+            await Writer.FlushAsync();
         }
         }
 
 
         private static void ThrowUnexpectedEndOfData()
         private static void ThrowUnexpectedEndOfData()
@@ -186,7 +199,9 @@ namespace PlatformBenchmarks
 
 
             public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded)
             public void OnStartLine(HttpMethod method, HttpVersion version, Span<byte> target, Span<byte> path, Span<byte> query, Span<byte> customMethod, bool pathEncoded)
                 => RequestHandler.OnStartLine(method, version, target, path, query, customMethod, pathEncoded);
                 => RequestHandler.OnStartLine(method, version, target, path, query, customMethod, pathEncoded);
+
+            public void OnHeadersComplete()
+                => RequestHandler.OnHeadersComplete();
         }
         }
     }
     }
-
-}
+}

+ 31 - 3
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BenchmarkConfigurationHelpers.cs

@@ -3,9 +3,8 @@
 
 
 using System;
 using System;
 using System.Net;
 using System.Net;
-using Microsoft.AspNetCore;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Server.Kestrel.Core;
+using Microsoft.AspNetCore.Http;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.Configuration;
 
 
 namespace PlatformBenchmarks
 namespace PlatformBenchmarks
@@ -29,6 +28,35 @@ namespace PlatformBenchmarks
                 theadCount = value;
                 theadCount = value;
             }
             }
 
 
+            if (string.Equals(webHost, "Sockets", StringComparison.OrdinalIgnoreCase))
+            {
+                builder.UseSockets(options =>
+                {
+                    if (theadCount.HasValue)
+                    {
+                        options.IOQueueCount = theadCount.Value;
+                    }
+                });
+            }
+            // else if (string.Equals(webHost, "LinuxTransport", StringComparison.OrdinalIgnoreCase))
+            // {
+            //     builder.ConfigureServices(services =>
+            //     {
+            //         services.Configure<KestrelServerOptions>(options =>
+            //         {
+            //             // Run callbacks on the transport thread
+            //             options.ApplicationSchedulingMode = SchedulingMode.Inline;
+            //         });
+            //     })
+            //     .UseLinuxTransport(options =>
+            //     {
+            //         if (theadCount.HasValue)
+            //         {
+            //             options.ThreadCount = theadCount.Value;
+            //         }
+            //     });
+            // }
+
             return builder;
             return builder;
         }
         }
         
         
@@ -41,7 +69,7 @@ namespace PlatformBenchmarks
                 return new IPEndPoint(IPAddress.Loopback, 8080);
                 return new IPEndPoint(IPAddress.Loopback, 8080);
             }
             }
 
 
-            var address = ServerAddress.FromUrl(url);
+            var address = BindingAddress.Parse(url);
 
 
             IPAddress ip;
             IPAddress ip;
 
 

+ 1 - 1
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Utilities/BufferExtensions.cs → frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferExtensions.cs

@@ -42,7 +42,7 @@ namespace PlatformBenchmarks
 
 
             // Fast path, try copying to the available memory directly
             // Fast path, try copying to the available memory directly
             var advanceBy = 0;
             var advanceBy = 0;
-            fixed (byte* output = &MemoryMarshal.GetReference(span))
+            fixed (byte* output = span)
             {
             {
                 var start = output;
                 var start = output;
                 if (number < 10 && bytesLeftInBlock >= 1)
                 if (number < 10 && bytesLeftInBlock >= 1)

+ 1 - 0
frameworks/CSharp/aspnetcore/PlatformBenchmarks/Utilities/BufferWriter.cs → frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/BufferWriter.cs

@@ -21,6 +21,7 @@ namespace PlatformBenchmarks
         }
         }
 
 
         public Span<byte> Span => _span;
         public Span<byte> Span => _span;
+
         public int Buffered => _buffered;
         public int Buffered => _buffered;
 
 
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         [MethodImpl(MethodImplOptions.AggressiveInlining)]

+ 4 - 5
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/Utilities/DateHeader.cs → frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/DateHeader.cs

@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
 
 
 using System;
 using System;
@@ -6,14 +6,13 @@ using System.Buffers.Text;
 using System.Diagnostics;
 using System.Diagnostics;
 using System.Text;
 using System.Text;
 using System.Threading;
 using System.Threading;
-using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure;
 
 
-namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
+namespace PlatformBenchmarks
 {
 {
     /// <summary>
     /// <summary>
     /// Manages the generation of the date header value.
     /// Manages the generation of the date header value.
     /// </summary>
     /// </summary>
-    internal static class DateHeader 
+    internal static class DateHeader
     {
     {
         const int prefixLength = 8; // "\r\nDate: ".Length
         const int prefixLength = 8; // "\r\nDate: ".Length
         const int dateTimeRLength = 29; // Wed, 14 Mar 2018 14:20:00 GMT
         const int dateTimeRLength = 29; // Wed, 14 Mar 2018 14:20:00 GMT
@@ -59,4 +58,4 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http
             }
             }
         }
         }
     }
     }
-}
+}

+ 1 - 0
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/NuGet.Config

@@ -4,5 +4,6 @@
     <clear />
     <clear />
     <add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
     <add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
     <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
     <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
+    <add key="rh" value="https://www.myget.org/F/redhat-dotnet/api/v3/index.json" />
   </packageSources>
   </packageSources>
 </configuration>
 </configuration>

+ 5 - 2
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
 
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <LangVersion>latest</LangVersion>
     <LangVersion>latest</LangVersion>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -22,7 +22,10 @@
 
 
   <ItemGroup>
   <ItemGroup>
     <PackageReference Include="Utf8Json" Version="1.3.7" />
     <PackageReference Include="Utf8Json" Version="1.3.7" />
-    <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
+    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0-preview7.19362.4" />
+    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.0.0-preview7.19362.4" />
+    <PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0-preview7.19362.4" />
+    <!--PackageReference Include="RedHat.AspNetCore.Server.Kestrel.Transport.Linux" Version="2.2.0-*" /-->
     <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
     <PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 6 - 8
frameworks/CSharp/aspnetcore-corert/PlatformBenchmarks/rd.xml

@@ -20,18 +20,13 @@
             <Type Name="Microsoft.Extensions.Options.OptionsFactory`1[[Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions,Microsoft.AspNetCore.Server.Kestrel.Core]]" Dynamic="Required All" />
             <Type Name="Microsoft.Extensions.Options.OptionsFactory`1[[Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions,Microsoft.AspNetCore.Server.Kestrel.Core]]" Dynamic="Required All" />
             <Type Name="Microsoft.Extensions.Options.OptionsMonitor`1[[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions,Microsoft.Extensions.Logging.Console]]" Dynamic="Required All" />
             <Type Name="Microsoft.Extensions.Options.OptionsMonitor`1[[Microsoft.Extensions.Logging.Console.ConsoleLoggerOptions,Microsoft.Extensions.Logging.Console]]" Dynamic="Required All" />
         </Assembly>
         </Assembly>
-        <Assembly Name="Microsoft.AspNetCore.Http">
-            <Type Name="Microsoft.AspNetCore.Http.HttpContextFactory" Dynamic="Required All" />
-        </Assembly>
+        <Assembly Name="Microsoft.AspNetCore.Http" Dynamic="Required All" />
         <Assembly Name="Microsoft.AspNetCore.HostFiltering">
         <Assembly Name="Microsoft.AspNetCore.HostFiltering">
             <Type Name="Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware" Dynamic="Required All" />
             <Type Name="Microsoft.AspNetCore.HostFiltering.HostFilteringMiddleware" Dynamic="Required All" />
         </Assembly>
         </Assembly>
-        <Assembly Name="Microsoft.AspNetCore.Hosting" Dynamic="Required All">
-            <Type Name="Microsoft.AspNetCore.Hosting.Internal.ApplicationLifetime" Dynamic="Required All" />
-            <Type Name="Microsoft.AspNetCore.Hosting.Internal.StartupLoader+ConfigureServicesDelegateBuilder`1[[System.Object,System.Private.CoreLib]]" Dynamic="Required All" />
-        </Assembly>
+        <Assembly Name="Microsoft.AspNetCore.Hosting" Dynamic="Required All" />
         <Assembly Name="Microsoft.Extensions.Logging.Abstractions">
         <Assembly Name="Microsoft.Extensions.Logging.Abstractions">
-            <Type Name="Microsoft.Extensions.Logging.Logger`1[[Microsoft.AspNetCore.Hosting.Internal.WebHost,Microsoft.AspNetCore.Hosting]]" Dynamic="Required All" />
+
         </Assembly>
         </Assembly>
         <Assembly Name="Microsoft.Extensions.Logging">
         <Assembly Name="Microsoft.Extensions.Logging">
             <Type Name="Microsoft.Extensions.Logging.LoggerFactory" Dynamic="Required All" />
             <Type Name="Microsoft.Extensions.Logging.LoggerFactory" Dynamic="Required All" />
@@ -44,5 +39,8 @@
         <Assembly Name="Microsoft.Extensions.Configuration.Json">
         <Assembly Name="Microsoft.Extensions.Configuration.Json">
             <Type Name="Microsoft.Extensions.Configuration.Json.JsonConfigurationSource" Dynamic="Required All" />
             <Type Name="Microsoft.Extensions.Configuration.Json.JsonConfigurationSource" Dynamic="Required All" />
         </Assembly>
         </Assembly>
+        <!--Assembly Name="RedHat.AspNetCore.Server.Kestrel.Transport.Linux">
+            <Type Name="RedHat.AspNetCore.Server.Kestrel.Transport.Linux.LinuxTransportFactory" Dynamic="Required All" />
+        </Assembly-->
     </Application>
     </Application>
 </Directives>
 </Directives>

+ 14 - 0
frameworks/CSharp/aspnetcore-corert/aspcore-corert-rhtx.dockerfile

@@ -0,0 +1,14 @@
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
+RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | tee /etc/apt/sources.list.d/llvm.list
+RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
+RUN apt-get update
+RUN apt-get -yqq install cmake clang-3.9 libicu57 libunwind8 uuid-dev libcurl4-openssl-dev zlib1g-dev libkrb5-dev
+WORKDIR /app
+COPY PlatformBenchmarks .
+RUN dotnet publish -c Release -o out -r linux-x64
+
+FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
+WORKDIR /app
+COPY --from=build /app/out ./
+
+ENTRYPOINT ["./PlatformBenchmarks", "--server.urls=http://+:8080", "KestrelTransport=LinuxTransport"]

+ 6 - 3
frameworks/CSharp/aspnetcore-corert/aspcore-corert.dockerfile

@@ -1,13 +1,16 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | tee /etc/apt/sources.list.d/llvm.list
 RUN echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main" | tee /etc/apt/sources.list.d/llvm.list
 RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
 RUN wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | apt-key add -
 RUN apt-get update
 RUN apt-get update
 RUN apt-get -yqq install cmake clang-3.9 libicu57 libunwind8 uuid-dev libcurl4-openssl-dev zlib1g-dev libkrb5-dev
 RUN apt-get -yqq install cmake clang-3.9 libicu57 libunwind8 uuid-dev libcurl4-openssl-dev zlib1g-dev libkrb5-dev
+RUN wget https://download.visualstudio.microsoft.com/download/pr/a0e368ac-7161-4bde-a139-1a3ef5a82bbe/439cdbb58950916d3718771c5d986c35/dotnet-sdk-3.0.100-preview8-013656-linux-x64.tar.gz
+RUN mkdir -p /dotnet
+RUN tar zxf dotnet-sdk-3.0.100-preview8-013656-linux-x64.tar.gz -C /dotnet
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
-RUN dotnet publish -c Release -o out -r linux-x64
+RUN /dotnet/dotnet publish -c Release -o out -r linux-x64
 
 
-FROM microsoft/dotnet:2.2-aspnetcore-runtime AS runtime
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.0 AS runtime
 WORKDIR /app
 WORKDIR /app
 COPY --from=build /app/out ./
 COPY --from=build /app/out ./
 
 

+ 1 - 1
frameworks/CSharp/aspnetcore-corert/benchmark_config.json

@@ -5,7 +5,7 @@
       "plaintext_url": "/plaintext",
       "plaintext_url": "/plaintext",
       "json_url": "/json",
       "json_url": "/json",
       "port": 8080,
       "port": 8080,
-      "approach": "Realistic",
+      "approach": "Stripped",
       "classification": "Platform",
       "classification": "Platform",
       "database": "None",
       "database": "None",
       "framework": "ASP.NET Core",
       "framework": "ASP.NET Core",

+ 1 - 16
frameworks/CSharp/aspnetcore-mono/Benchmarks/Benchmarks.csproj

@@ -4,8 +4,6 @@
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
     <LangVersion>7.3</LangVersion>
     <LangVersion>7.3</LangVersion>
     <RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
     <RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
-    <!-- Add the myget feed, without altering any other configurations. -->
-    <RestoreAdditionalProjectSources>https://dotnet.myget.org/F/dotnet-core/api/v3/index.json</RestoreAdditionalProjectSources>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
@@ -29,19 +27,6 @@
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
     <PackageReference Include="Npgsql" Version="4.0.4" />
     <PackageReference Include="Npgsql" Version="4.0.4" />
     <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" />
     <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" />
+    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2"/>
   </ItemGroup>
   </ItemGroup>
-
-  <ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
-    <!-- Make .NET 4.7.1 reference assemblies available even on Linux -->
-    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.7.1" Version="1.0.0" ExcludeAssets="All" PrivateAssets="All" />
-    <Reference Include="netstandard" />
-    <Reference Include="System.Runtime" />
-    <Reference Include="System.Threading.Tasks" />
-    <PackageReference Include="NETStandard.Library" Version="2.0.3" />
-  </ItemGroup>
-
-  <PropertyGroup Condition=" '$(TargetFramework)' == 'net471' ">
-    <!-- Make sure the reference assemblies are available -->
-    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.7.1\1.0.0\lib\net471\</FrameworkPathOverride>
-  </PropertyGroup>
 </Project>
 </Project>

+ 1 - 15
frameworks/CSharp/aspnetcore-mono/PlatformBenchmarks/PlatformBenchmarks.csproj

@@ -6,8 +6,6 @@
     <LangVersion>7.3</LangVersion>
     <LangVersion>7.3</LangVersion>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
     <RuntimeIdentifiers>linux-x64</RuntimeIdentifiers>
-    <!-- Add the myget feed, without altering any other configurations. -->
-    <RestoreAdditionalProjectSources>https://dotnet.myget.org/F/dotnet-core/api/v3/index.json</RestoreAdditionalProjectSources>
   </PropertyGroup>
   </PropertyGroup>
 
 
   <ItemGroup>
   <ItemGroup>
@@ -19,19 +17,7 @@
     <PackageReference Include="Utf8Json" Version="1.3.7" />
     <PackageReference Include="Utf8Json" Version="1.3.7" />
     <PackageReference Include="Npgsql" Version="4.0.4" />
     <PackageReference Include="Npgsql" Version="4.0.4" />
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
+    <PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0-preview.2"/>
   </ItemGroup>
   </ItemGroup>
   
   
-  <ItemGroup Condition=" '$(TargetFramework)' == 'net471' ">
-    <!-- Make .NET 4.7.1 reference assemblies available even on Linux -->
-    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.7.1" Version="1.0.0" ExcludeAssets="All" PrivateAssets="All" />
-    <Reference Include="netstandard" />
-    <Reference Include="System.Runtime" />
-    <Reference Include="System.Threading.Tasks" />
-    <PackageReference Include="NETStandard.Library" Version="2.0.3" />
-  </ItemGroup>
-  
-  <PropertyGroup Condition=" '$(TargetFramework)' == 'net471' ">
-    <!-- Make sure the reference assemblies are available -->
-    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.7.1\1.0.0\lib\net471\</FrameworkPathOverride>
-  </PropertyGroup>
 </Project>
 </Project>

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-ef-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-my.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mvc.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-ef-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-my.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-mw.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY Benchmarks .
 COPY Benchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-my.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono-pg.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 1 - 1
frameworks/CSharp/aspnetcore-mono/aspcore-mono.dockerfile

@@ -1,4 +1,4 @@
-FROM microsoft/dotnet:2.2-sdk AS build
+FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
 WORKDIR /app
 WORKDIR /app
 COPY PlatformBenchmarks .
 COPY PlatformBenchmarks .
 RUN dotnet publish -c Release -o out
 RUN dotnet publish -c Release -o out

+ 7 - 7
frameworks/CSharp/aspnetcore/Benchmarks/Benchmarks.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 <Project Sdk="Microsoft.NET.Sdk.Web">
   <PropertyGroup>
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.0</TargetFramework>
+    <LangVersion>preview</LangVersion>
     <OutputType>Exe</OutputType>
     <OutputType>Exe</OutputType>
   </PropertyGroup>
   </PropertyGroup>
 
 
@@ -12,12 +13,11 @@
   </ItemGroup>
   </ItemGroup>
 
 
   <ItemGroup>
   <ItemGroup>
-    <PackageReference Include="Microsoft.AspNetCore.App" />
-    <PackageReference Include="Dapper" Version="1.50.5" />
+    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview7.19365.7" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview7.19362.6" />
+
+    <PackageReference Include="Dapper" Version="1.60.6" />
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
     <PackageReference Include="MySqlConnector" Version="0.56.0" />
-    <PackageReference Include="Npgsql" Version="4.0.4" />
-    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.0" />
-    <PackageReference Include="SpanJson" Version="2.0.4" />
-    <PackageReference Include="Utf8Json" Version="1.3.7" />
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.0-preview7" />
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 0 - 6
frameworks/CSharp/aspnetcore/Benchmarks/Configuration/Scenarios.cs

@@ -23,12 +23,6 @@ namespace Benchmarks.Configuration
         [ScenarioPath("/json")]
         [ScenarioPath("/json")]
         public bool Json { get; set; }
         public bool Json { get; set; }
 
 
-        [ScenarioPath("/utf8json")]
-        public bool Utf8Json { get; set; }
-
-        [ScenarioPath("/spanjson")]
-        public bool SpanJson { get; set; }
-
         [ScenarioPath("/128B.txt", "/512B.txt", "/1KB.txt", "/4KB.txt", "/16KB.txt", "/512KB.txt", "/1MB.txt", "/5MB.txt")]
         [ScenarioPath("/128B.txt", "/512B.txt", "/1KB.txt", "/4KB.txt", "/16KB.txt", "/512KB.txt", "/1MB.txt", "/5MB.txt")]
         public bool StaticFiles { get; set; }
         public bool StaticFiles { get; set; }
 
 

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