Browse Source

Merge pull request #3352 from TechEmpower/master

Merge master into docker
Mike Smith 7 years ago
parent
commit
6e11016ec2
99 changed files with 2144 additions and 343 deletions
  1. 9 13
      frameworks/Go/fasthttp/src/common/common.go
  2. 4 4
      frameworks/Go/fasthttp/src/server-mysql/server.go
  3. 5 5
      frameworks/Go/fasthttp/src/server-postgresql/server.go
  4. 2 0
      frameworks/Java/servlet/README.md
  5. 41 3
      frameworks/Java/servlet/benchmark_config.json
  6. 9 0
      frameworks/Java/servlet/servlet3-async.sh
  7. 9 0
      frameworks/Java/servlet/servlet3-sync.sh
  8. 34 0
      frameworks/Java/servlet/servlet3/README.md
  9. 97 0
      frameworks/Java/servlet/servlet3/pom.xml
  10. 12 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/HelloMessage.java
  11. 7 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/Helper.java
  12. 19 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/World.java
  13. 65 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/async/JSON.java
  14. 62 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/async/Plaintext.java
  15. 36 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/sync/JSON.java
  16. 33 0
      frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/sync/Plaintext.java
  17. 16 0
      frameworks/Java/servlet/servlet3/src/main/resources/logback.xml
  18. 17 0
      frameworks/Java/servlet/servlet3/src/main/webapp/jsp/error.jsp
  19. 60 0
      frameworks/Java/servlet/src/main/java/hello/DbSQLServlet.java
  20. 6 13
      frameworks/Java/servlet/src/main/java/hello/QueriesSQLServlet.java
  21. 10 1
      frameworks/Java/servlet/src/main/resources/WEB-INF/mysql/web.xml
  22. 12 3
      frameworks/Java/servlet/src/main/resources/WEB-INF/postgresql/web.xml
  23. 1 1
      frameworks/PHP/README.md
  24. 3 2
      frameworks/PHP/cakephp/deploy/nginx.conf
  25. 3 2
      frameworks/PHP/clancats/deploy/nginx.conf
  26. 3 2
      frameworks/PHP/codeigniter/deploy/nginx.conf
  27. 3 2
      frameworks/PHP/cygnite/deploy/nginx.conf
  28. 3 2
      frameworks/PHP/fat-free/deploy/nginx.conf
  29. 3 2
      frameworks/PHP/fuel/deploy/nginx.conf
  30. 3 2
      frameworks/PHP/hhvm/deploy/nginx.conf
  31. 3 2
      frameworks/PHP/kohana/deploy/nginx.conf
  32. 2 0
      frameworks/PHP/kumbiaphp/.gitignore
  33. 42 0
      frameworks/PHP/kumbiaphp/README.md
  34. 38 0
      frameworks/PHP/kumbiaphp/bench/app/config/config.ini
  35. 16 0
      frameworks/PHP/kumbiaphp/bench/app/config/config.php
  36. 11 0
      frameworks/PHP/kumbiaphp/bench/app/config/databases.php
  37. 38 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/db_controller.php
  38. 13 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/fortune_controller.php
  39. 16 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/index_controller.php
  40. 12 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/json_controller.php
  41. 59 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/raw_controller.php
  42. 20 0
      frameworks/PHP/kumbiaphp/bench/app/controllers/raw_fortune_controller.php
  43. 33 0
      frameworks/PHP/kumbiaphp/bench/app/libs/admin_controller.php
  44. 30 0
      frameworks/PHP/kumbiaphp/bench/app/libs/app_controller.php
  45. 32 0
      frameworks/PHP/kumbiaphp/bench/app/libs/rest_controller.php
  46. 87 0
      frameworks/PHP/kumbiaphp/bench/app/libs/scaffold_controller.php
  47. 16 0
      frameworks/PHP/kumbiaphp/bench/app/libs/view.php
  48. 9 0
      frameworks/PHP/kumbiaphp/bench/app/models/fortune.php
  49. 9 0
      frameworks/PHP/kumbiaphp/bench/app/models/world.php
  50. 24 0
      frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/default.phtml
  51. 4 0
      frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/fortune.phtml
  52. 2 0
      frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/hello.phtml
  53. 4 0
      frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/json.phtml
  54. 4 0
      frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/raw.phtml
  55. 34 0
      frameworks/PHP/kumbiaphp/bench/public/.user.ini
  56. BIN
      frameworks/PHP/kumbiaphp/bench/public/favicon.ico
  57. 97 0
      frameworks/PHP/kumbiaphp/bench/public/index.php
  58. 51 0
      frameworks/PHP/kumbiaphp/benchmark_config.json
  59. 65 0
      frameworks/PHP/kumbiaphp/deploy/nginx.conf
  60. 9 0
      frameworks/PHP/kumbiaphp/deploy/php
  61. 18 0
      frameworks/PHP/kumbiaphp/setup.sh
  62. 3 2
      frameworks/PHP/limonade/deploy/nginx.conf
  63. 3 2
      frameworks/PHP/lithium/deploy/nginx.conf
  64. 3 2
      frameworks/PHP/lumen/deploy/nginx.conf
  65. 4 4
      frameworks/PHP/phalcon-micro/README.md
  66. 3 2
      frameworks/PHP/phalcon-micro/deploy/nginx.conf
  67. 5 5
      frameworks/PHP/phalcon/README.md
  68. 3 2
      frameworks/PHP/phalcon/deploy/nginx.conf
  69. 4 7
      frameworks/PHP/php/dborm.php
  70. 7 12
      frameworks/PHP/php/dbraw.php
  71. 3 3
      frameworks/PHP/php/deploy/nginx.conf
  72. 4 22
      frameworks/PHP/php/fortune.php
  73. 2 0
      frameworks/PHP/php/info.php
  74. 2 12
      frameworks/PHP/php/json.php
  75. 9 17
      frameworks/PHP/php/updateraw.php
  76. 3 2
      frameworks/PHP/phpixie/deploy/nginx.conf
  77. 3 2
      frameworks/PHP/phreeze/deploy/nginx.conf
  78. 3 2
      frameworks/PHP/silex-orm/deploy/nginx.conf
  79. 3 2
      frameworks/PHP/silex/deploy/nginx.conf
  80. 3 2
      frameworks/PHP/silex/deploy/nginx_raw.conf
  81. 3 2
      frameworks/PHP/symfony/deploy/nginx.conf
  82. 3 2
      frameworks/PHP/yaf/deploy/nginx.conf
  83. 3 2
      frameworks/PHP/yii2/deploy/nginx.conf
  84. 3 2
      frameworks/PHP/zend/deploy/nginx.conf
  85. 3 2
      frameworks/PHP/zend1/deploy/nginx.conf
  86. 414 109
      frameworks/Rust/actix/Cargo.lock
  87. 3 3
      frameworks/Rust/actix/Cargo.toml
  88. 12 16
      frameworks/Rust/actix/src/db.rs
  89. 6 6
      frameworks/Rust/actix/src/main.rs
  90. 20 24
      frameworks/Rust/actix/src/pg.rs
  91. 2 2
      frameworks/Rust/actix/src/simple.rs
  92. 1 1
      toolset/setup/linux/frameworks/phalcon.sh
  93. 1 4
      toolset/setup/linux/languages/hhvm.sh
  94. 6 6
      toolset/setup/linux/languages/php/php-fpm.conf
  95. 1 1
      toolset/setup/linux/languages/php/php7.sh
  96. 42 0
      toolset/setup/linux/systools/apache-apr.sh
  97. 36 0
      toolset/setup/linux/systools/openssl.sh
  98. 74 0
      toolset/setup/linux/webservers/tomcat/server.xml
  99. 56 0
      toolset/setup/linux/webservers/tomcat/tomcat.sh

+ 9 - 13
frameworks/Go/fasthttp/src/common/common.go

@@ -6,10 +6,10 @@ import (
 	"log"
 	"math/rand"
 	"net"
+	"sort"
 	"sync"
 
 	"github.com/valyala/fasthttp"
-
 	"templates"
 )
 
@@ -65,18 +65,6 @@ func GetQueriesCount(ctx *fasthttp.RequestCtx) int {
 	return n
 }
 
-type FortunesByMessage []templates.Fortune
-
-func (s FortunesByMessage) Len() int           { return len(s) }
-func (s FortunesByMessage) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
-func (s FortunesByMessage) Less(i, j int) bool { return s[i].Message < s[j].Message }
-
-type WorldsByID []World
-
-func (w WorldsByID) Len() int           { return len(w) }
-func (w WorldsByID) Swap(i, j int)      { w[i], w[j] = w[j], w[i] }
-func (w WorldsByID) Less(i, j int) bool { return w[i].Id < w[j].Id }
-
 func GetListener() net.Listener {
 	ln, err := net.Listen("tcp4", *listenAddr)
 	if err != nil {
@@ -84,3 +72,11 @@ func GetListener() net.Listener {
 	}
 	return ln
 }
+
+func SortFortunesByMessage(fortunes []templates.Fortune) {
+	sort.Slice(fortunes, func(i, j int) bool { return fortunes[i].Message < fortunes[j].Message })
+}
+
+func SortWorldsByID(worlds []World) {
+	sort.Slice(worlds, func(i, j int) bool { return worlds[i].Id < worlds[j].Id })
+}

+ 4 - 4
frameworks/Go/fasthttp/src/server-mysql/server.go

@@ -5,7 +5,6 @@ import (
 	"flag"
 	"log"
 	"runtime"
-	"sort"
 
 	_ "github.com/go-sql-driver/mysql"
 	"github.com/valyala/fasthttp"
@@ -94,9 +93,9 @@ func fortuneHandler(ctx *fasthttp.RequestCtx) {
 		log.Fatalf("Error selecting db data: %v", err)
 	}
 
+	var f templates.Fortune
 	fortunes := make([]templates.Fortune, 0, 16)
 	for rows.Next() {
-		var f templates.Fortune
 		if err := rows.Scan(&f.ID, &f.Message); err != nil {
 			log.Fatalf("Error scanning fortune row: %s", err)
 		}
@@ -105,7 +104,7 @@ func fortuneHandler(ctx *fasthttp.RequestCtx) {
 	rows.Close()
 	fortunes = append(fortunes, templates.Fortune{Message: "Additional fortune added at request time."})
 
-	sort.Sort(common.FortunesByMessage(fortunes))
+	common.SortFortunesByMessage(fortunes)
 
 	ctx.SetContentType("text/html; charset=utf-8")
 	templates.WriteFortunePage(ctx, fortunes)
@@ -122,7 +121,8 @@ func updateHandler(ctx *fasthttp.RequestCtx) {
 	}
 
 	// sorting is required for insert deadlock prevention.
-	sort.Sort(common.WorldsByID(worlds))
+	common.SortWorldsByID(worlds)
+
 	txn, err := db.Begin()
 	if err != nil {
 		log.Fatalf("Error starting transaction: %s", err)

+ 5 - 5
frameworks/Go/fasthttp/src/server-postgresql/server.go

@@ -5,7 +5,6 @@ import (
 	"fmt"
 	"log"
 	"runtime"
-	"sort"
 
 	"github.com/jackc/pgx"
 	"github.com/valyala/fasthttp"
@@ -26,7 +25,7 @@ func main() {
 	flag.Parse()
 
 	var err error
-	maxConnectionCount := runtime.NumCPU() * 2
+	maxConnectionCount := runtime.NumCPU() * 4
 	if db, err = initDatabase("localhost", "benchmarkdbuser", "benchmarkdbpass", "hello_world", 5432, maxConnectionCount); err != nil {
 		log.Fatalf("Error opening database: %s", err)
 	}
@@ -82,9 +81,9 @@ func fortuneHandler(ctx *fasthttp.RequestCtx) {
 		log.Fatalf("Error selecting db data: %v", err)
 	}
 
+	var f templates.Fortune
 	fortunes := make([]templates.Fortune, 0, 16)
 	for rows.Next() {
-		var f templates.Fortune
 		if err := rows.Scan(&f.ID, &f.Message); err != nil {
 			log.Fatalf("Error scanning fortune row: %s", err)
 		}
@@ -93,7 +92,7 @@ func fortuneHandler(ctx *fasthttp.RequestCtx) {
 	rows.Close()
 	fortunes = append(fortunes, templates.Fortune{Message: "Additional fortune added at request time."})
 
-	sort.Sort(common.FortunesByMessage(fortunes))
+	common.SortFortunesByMessage(fortunes)
 
 	ctx.SetContentType("text/html; charset=utf-8")
 	templates.WriteFortunePage(ctx, fortunes)
@@ -110,7 +109,8 @@ func updateHandler(ctx *fasthttp.RequestCtx) {
 	}
 
 	// sorting is required for insert deadlock prevention.
-	sort.Sort(common.WorldsByID(worlds))
+	common.SortWorldsByID(worlds)
+
 	txn, err := db.Begin()
 	if err != nil {
 		log.Fatalf("Error starting transaction: %s", err)

+ 2 - 0
frameworks/Java/servlet/README.md

@@ -2,6 +2,8 @@
 
 This is the Java Servlet portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
 
+There is a Servlet 3.1 based tests implementation in the [servlet3](./servlet3) sub-folder. It is using Tomcat 9 as Servlet containter.
+
 ### Plaintext and JSON
 
 * [Plaintext test source](src/main/java/hello/PlaintextServlet.java)

+ 41 - 3
frameworks/Java/servlet/benchmark_config.json

@@ -62,7 +62,7 @@
     "raw": {
       "setup_file": "setup_mysql",
       "db_url": "/servlet/db",
-      "query_url": "/servlet/db?queries=",
+      "query_url": "/servlet/queries?queries=",
       "fortune_url": "/servlet/fortunes",
       "update_url": "/servlet/update?queries=",
       "port": 8080,
@@ -83,7 +83,7 @@
     "postgres-raw": {
       "setup_file": "setup_postgresql",
       "db_url": "/servlet/db",
-      "query_url": "/servlet/db?queries=",
+      "query_url": "/servlet/queries?queries=",
       "cached_query_url": "/servlet/cached-worlds?queries=",
       "fortune_url": "/servlet/fortunes",
       "update_url": "/servlet/update?queries=",
@@ -102,6 +102,44 @@
       "display_name": "servlet",
       "notes": "",
       "versus": "servlet-raw"
+    },
+    "async-tomcat": {
+      "setup_file": "servlet3-async",
+      "json_url": "/servlet3/json",
+      "plaintext_url": "/servlet3/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "None",
+      "framework": "None",
+      "language": "Java",
+      "orm": "Raw",
+      "platform": "Servlet",
+      "webserver": "Tomcat",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "servlet3",
+      "notes": "Servlet 3.1 Async I/O",
+      "versus": "servlet"
+    },
+    "sync-tomcat": {
+      "setup_file": "servlet3-sync",
+      "json_url": "/servlet3/json",
+      "plaintext_url": "/servlet3/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification" : "Platform",
+      "database": "None",
+      "framework": "None",
+      "language": "Java",
+      "orm": "Raw",
+      "platform": "Servlet",
+      "webserver": "Tomcat",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "servlet3",
+      "notes": "",
+      "versus": "servlet"
     }
   }]
-}
+}

+ 9 - 0
frameworks/Java/servlet/servlet3-async.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+fw_depends java tomcat maven
+
+cd servlet3
+mvn clean compile war:war
+rm -rf $CATALINA_HOME/webapps/*
+cp target/servlet3.war $CATALINA_HOME/webapps
+$CATALINA_HOME/bin/startup.sh

+ 9 - 0
frameworks/Java/servlet/servlet3-sync.sh

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+fw_depends java tomcat maven
+
+cd servlet3
+mvn clean compile war:war -P sync
+rm -rf $CATALINA_HOME/webapps/*
+cp target/servlet3.war $CATALINA_HOME/webapps
+$CATALINA_HOME/bin/startup.sh

+ 34 - 0
frameworks/Java/servlet/servlet3/README.md

@@ -0,0 +1,34 @@
+# Servlet 3.1 API benchmarking test
+
+This is Framework permutation based on the following technology stack
+
+* Java
+* Tomcat 9
+* Servlet 3.1 with Async I/O
+* Jackson 2 for JSON processing
+
+Currently implemented test types are Plaintext and JSON. Their implementation comes in two flavors: PO (plain old) Servlets and Servlets 3.1 with Async I/O.
+
+### Plaintext
+
+* [Async](src/main/java/com/gitlab/zloster/tfb/servlet3/async/Plaintext.java)
+* [Sync](src/main/java/com/gitlab/zloster/tfb/servlet3/sync/Plaintext.java)
+
+### JSON
+
+* [Async](src/main/java/com/gitlab/zloster/tfb/servlet3/async/JSON.java)
+* [Sync](src/main/java/com/gitlab/zloster/tfb/servlet3/sync/JSON.java)
+
+## Test URLs
+
+### Default Maven profile
+
+The `async` profile is activated by default.
+
+* Plaintext - `http://localhost:8080/servlet3/plaintext`
+* JSON - `http://localhost:8080/servlet3/json`
+
+### `sync` Maven profile
+
+* Plaintext - `http://localhost:8080/servlet3/plaintext`
+* JSON - `http://localhost:8080/servlet3/json`

+ 97 - 0
frameworks/Java/servlet/servlet3/pom.xml

@@ -0,0 +1,97 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.gitlab.zloster.tfb.servlet3</groupId>
+	<artifactId>servlet3</artifactId>
+	<version>0.0.1-SNAPSHOT</version>
+	<packaging>war</packaging>
+	<name>servlet3</name>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<java.version>1.8</java.version>
+		<slf4j.version>1.7.10</slf4j.version>
+	</properties>
+
+	<profiles>
+		<profile>
+			<id>sync</id>
+			<properties>
+				<exludeSources>**/async/*.java</exludeSources>
+			</properties>
+		</profile>
+		<profile>
+			<id>async</id>
+			<activation>
+				<activeByDefault>true</activeByDefault>
+			</activation>
+			<properties>
+				<exludeSources>**/sync/*.java</exludeSources>
+			</properties>
+		</profile>
+	</profiles>
+
+	<build>
+		<finalName>servlet3</finalName>
+
+		<plugins>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>3.7.0</version>
+				<configuration>
+					<source>${java.version}</source>
+					<target>${java.version}</target>
+					<optimize>true</optimize>
+					<debug>false</debug>
+					<excludes>
+						<exclude>${exludeSources}</exclude>
+					</excludes>
+				</configuration>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-war-plugin</artifactId>
+				<version>3.1.0</version>
+				<configuration>
+					<failOnMissingWebXml>false</failOnMissingWebXml>
+				</configuration>
+			</plugin>
+
+		</plugins>
+
+	</build>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>3.1.0</version>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>jstl</artifactId>
+			<version>1.2</version>
+			<scope>runtime</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>2.9.3</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+	</dependencies>
+
+</project>

+ 12 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/HelloMessage.java

@@ -0,0 +1,12 @@
+package com.gitlab.zloster.tfb.servlet3;
+
+public class HelloMessage {
+  private String message = "Hello, World!";
+
+  public HelloMessage() {
+  }
+
+  public String getMessage() {
+    return message;
+  }
+}

+ 7 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/Helper.java

@@ -0,0 +1,7 @@
+package com.gitlab.zloster.tfb.servlet3;
+
+public class Helper {
+	public static final String MEDIATYPE_APPLICATION_JSON = "application/json";
+	public static final String MEDIATYPE_TEXT_PLAIN = "text/plain";
+	public static final byte[] CONTENT = "Hello, World!".getBytes();
+}

+ 19 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/World.java

@@ -0,0 +1,19 @@
+package com.gitlab.zloster.tfb.servlet3;
+
+public class World {
+	private int id;
+	private int randomNumber;
+
+	public World(int id, int randomNumber) {
+		this.id = id;
+		this.randomNumber = randomNumber;
+	}
+
+	public int getId() {
+		return id;
+	}
+
+	public int getRandomNumber() {
+		return randomNumber;
+	}
+}

+ 65 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/async/JSON.java

@@ -0,0 +1,65 @@
+package com.gitlab.zloster.tfb.servlet3.async;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gitlab.zloster.tfb.servlet3.HelloMessage;
+import com.gitlab.zloster.tfb.servlet3.Helper;
+
+@SuppressWarnings("serial")
+@WebServlet(name = "JSON", urlPatterns = "/json", asyncSupported = true)
+public class JSON extends HttpServlet {
+	private static final Logger LOGGER = LoggerFactory.getLogger(JSON.class);
+	private static final ObjectMapper mapper = new ObjectMapper();
+
+	/**
+	 * The JSON serialization is performed on the request processing thread and
+	 * the response is sent back asynchronously.
+	 */
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
+			IOException {
+		final AsyncContext async = req.startAsync();
+		final ServletOutputStream out = resp.getOutputStream();
+		LOGGER.debug("JSON sync start");
+		resp.setContentType(Helper.MEDIATYPE_APPLICATION_JSON);
+		byte[] content = mapper.writeValueAsBytes(new HelloMessage());
+		out.setWriteListener(new WriteListener() {
+			@Override
+			public void onWritePossible() throws IOException {
+				byte[] buffer = new byte[32];
+				ByteArrayInputStream is = new ByteArrayInputStream(content);
+
+				while (out.isReady()) {
+					int len = is.read(buffer);
+
+					if (len < 0) {
+						async.complete();
+						LOGGER.debug("JSON async end");
+						return;
+					}
+					out.write(buffer, 0, len);
+				}
+			}
+
+			@Override
+			public void onError(Throwable t) {
+				LOGGER.error("JSON async error", t);
+				async.complete();
+			}
+		});
+	}
+}

+ 62 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/async/Plaintext.java

@@ -0,0 +1,62 @@
+package com.gitlab.zloster.tfb.servlet3.async;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.servlet.AsyncContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.gitlab.zloster.tfb.servlet3.Helper;
+
+/**
+ * Web Framework Benchmarks Test type 6: Plaintext
+ *
+ */
+@SuppressWarnings("serial")
+@WebServlet(name = "Plaintext", urlPatterns = "/plaintext", asyncSupported = true)
+public class Plaintext extends HttpServlet {
+	private static final Logger LOGGER = LoggerFactory.getLogger(Plaintext.class);
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
+			IOException {
+		final AsyncContext async = req.startAsync();
+		final ServletOutputStream out = resp.getOutputStream();
+		LOGGER.debug("plaintext async start");
+		resp.setContentType(Helper.MEDIATYPE_TEXT_PLAIN);
+
+		out.setWriteListener(new WriteListener() {
+			@Override
+			public void onWritePossible() throws IOException {
+				byte[] buffer = new byte[32];
+				ByteArrayInputStream is = new ByteArrayInputStream(Helper.CONTENT);
+
+				while (out.isReady()) {
+					int len = is.read(buffer);
+
+					if (len < 0) {
+						async.complete();
+						LOGGER.debug("plaintext async end");
+						return;
+					}
+					out.write(buffer, 0, len);
+				}
+			}
+
+			@Override
+			public void onError(Throwable t) {
+				LOGGER.error("plaintext async error", t);
+				async.complete();
+			}
+		});
+	}
+}

+ 36 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/sync/JSON.java

@@ -0,0 +1,36 @@
+package com.gitlab.zloster.tfb.servlet3.sync;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.gitlab.zloster.tfb.servlet3.HelloMessage;
+import com.gitlab.zloster.tfb.servlet3.Helper;
+
+/**
+ * Web Framework Benchmarks Test type 1: JSON serialization
+ *
+ */
+@SuppressWarnings("serial")
+@WebServlet("/json")
+public class JSON extends HttpServlet {
+	private static final Logger LOGGER = LoggerFactory.getLogger(JSON.class);
+	private static final ObjectMapper mapper = new ObjectMapper();
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
+			IOException {
+		LOGGER.debug("JSON sync start");
+		resp.setContentType(Helper.MEDIATYPE_APPLICATION_JSON);
+		mapper.writeValue(resp.getOutputStream(), new HelloMessage());
+		LOGGER.debug("JSON sync end");
+	}
+}

+ 33 - 0
frameworks/Java/servlet/servlet3/src/main/java/com/gitlab/zloster/tfb/servlet3/sync/Plaintext.java

@@ -0,0 +1,33 @@
+package com.gitlab.zloster.tfb.servlet3.sync;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.gitlab.zloster.tfb.servlet3.Helper;
+
+/**
+ * Web Framework Benchmarks Test type 6: Plaintext
+ *
+ */
+@SuppressWarnings("serial")
+@WebServlet(name = "Plaintext", urlPatterns = "/plaintext")
+public class Plaintext extends HttpServlet {
+	private static final Logger LOGGER = LoggerFactory.getLogger(Plaintext.class);
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
+			IOException {
+		LOGGER.debug("plaintext sync start");
+		resp.setContentType(Helper.MEDIATYPE_TEXT_PLAIN);
+		resp.getOutputStream().write(Helper.CONTENT);
+		LOGGER.debug("plaintext sync end");
+	}
+}

+ 16 - 0
frameworks/Java/servlet/servlet3/src/main/resources/logback.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+        <file>servlet3.log</file>
+        <append>true</append>
+        <encoder>
+            <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{35} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="com.gitlab.zloster.tfb.servlet3" level="ERROR"/>
+
+    <root level="INFO">
+        <appender-ref ref="FILE" />
+    </root>
+</configuration>

+ 17 - 0
frameworks/Java/servlet/servlet3/src/main/webapp/jsp/error.jsp

@@ -0,0 +1,17 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ page session="false" %>
+<%
+    if(request.getAttribute("statusCode") != null)
+        response.setStatus((Integer)request.getAttribute("statusCode"));
+    else
+        response.setStatus(500);
+%>
+<html>
+<head>
+<title>error</title>
+</head>
+<body>
+<h1>error</h1>
+${message}
+</body>
+</html>

+ 60 - 0
frameworks/Java/servlet/src/main/java/hello/DbSQLServlet.java

@@ -0,0 +1,60 @@
+package hello;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+
+/**
+ * Handles the single-query database test using a SQL database with a
+ * Servlet-container managed pool.
+ */
+@SuppressWarnings("serial")
+public class DbSQLServlet extends HttpServlet {
+	// Database details.
+	private static final String DB_QUERY = "SELECT * FROM World WHERE id = ?";
+	private static final int DB_ROWS = 10000;
+
+	// Database connection pool.
+	@Resource(name = "jdbc/hello_world")
+	private DataSource dataSource;
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
+			IOException {
+		// Reference the data source.
+		final Random random = ThreadLocalRandom.current();
+		World world = null;
+
+		// Fetch some rows from the database.
+		try (Connection conn = dataSource.getConnection()) {
+			try (PreparedStatement statement = conn.prepareStatement(DB_QUERY,
+					ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
+				statement.setInt(1, random.nextInt(DB_ROWS) + 1);
+				try (ResultSet results = statement.executeQuery()) {
+					results.next(); // Here the expectation is ONLY only one
+									// result row
+					world = new World(results.getInt("id"), results.getInt("randomNumber"));
+				}
+			}
+		} catch (SQLException sqlex) {
+			throw new ServletException(sqlex);
+		}
+
+		// Set content type to JSON
+		res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);
+
+		// Write JSON encoded message to the response.
+		Common.MAPPER.writeValue(res.getOutputStream(), world);
+	}
+}

+ 6 - 13
frameworks/Java/servlet/src/main/java/hello/DbPoolServlet.java → frameworks/Java/servlet/src/main/java/hello/QueriesSQLServlet.java

@@ -16,10 +16,10 @@ import javax.servlet.http.HttpServletResponse;
 import javax.sql.DataSource;
 
 /**
- * Database connectivity (with a Servlet-container managed pool) test.
+ * Handles the multi-query database test using a SQL database with a Servlet-container managed pool.
  */
 @SuppressWarnings("serial")
-public class DbPoolServlet extends HttpServlet {
+public class QueriesSQLServlet extends HttpServlet {
 	// Database details.
 	private static final String DB_QUERY = "SELECT * FROM World WHERE id = ?";
 	private static final int DB_ROWS = 10000;
@@ -31,14 +31,12 @@ public class DbPoolServlet extends HttpServlet {
 	@Override
 	protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,
 			IOException {
-		// Reference the data source.
-		final DataSource source = dataSource;
 		final int count = Common.normalise(req.getParameter("queries"));
 		final World[] worlds = new World[count];
 		final Random random = ThreadLocalRandom.current();
 
 		// Fetch some rows from the database.
-		try (Connection conn = source.getConnection()) {
+		try (Connection conn = dataSource.getConnection()) {
 			try (PreparedStatement statement = conn.prepareStatement(DB_QUERY,
 					ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {
 				// Run the query the number of times requested.
@@ -47,9 +45,8 @@ public class DbPoolServlet extends HttpServlet {
 					statement.setInt(1, id);
 
 					try (ResultSet results = statement.executeQuery()) {
-						if (results.next()) {
-							worlds[i] = new World(id, results.getInt("randomNumber"));
-						}
+						results.next();
+						worlds[i] = new World(id, results.getInt("randomNumber"));
 					}
 				}
 			}
@@ -61,10 +58,6 @@ public class DbPoolServlet extends HttpServlet {
 		res.setHeader(Common.HEADER_CONTENT_TYPE, Common.CONTENT_TYPE_JSON);
 
 		// Write JSON encoded message to the response.
-		if (count == 1) {
-			Common.MAPPER.writeValue(res.getOutputStream(), worlds[0]);
-		} else {
-			Common.MAPPER.writeValue(res.getOutputStream(), worlds);
-		}
+		Common.MAPPER.writeValue(res.getOutputStream(), worlds);
 	}
 }

+ 10 - 1
frameworks/Java/servlet/src/main/resources/WEB-INF/mysql/web.xml

@@ -5,13 +5,22 @@
 	version="2.4">
 	<servlet>
 		<servlet-name>db</servlet-name>
-		<servlet-class>hello.DbPoolServlet</servlet-class>
+		<servlet-class>hello.DbSQLServlet</servlet-class>
 		<load-on-startup>1</load-on-startup>
 	</servlet>
 	<servlet-mapping>
 		<servlet-name>db</servlet-name>
 		<url-pattern>/db</url-pattern>
 	</servlet-mapping>
+	<servlet>
+		<servlet-name>queries</servlet-name>
+		<servlet-class>hello.QueriesSQLServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>queries</servlet-name>
+		<url-pattern>/queries</url-pattern>
+	</servlet-mapping>
 	<servlet>
 		<servlet-name>fortunes</servlet-name>
 		<servlet-class>hello.FortunesServlet</servlet-class>

+ 12 - 3
frameworks/Java/servlet/src/main/resources/WEB-INF/postgresql/web.xml

@@ -4,14 +4,23 @@
 	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
 	version="2.4">
 	<servlet>
-		<servlet-name>postgres</servlet-name>
-		<servlet-class>hello.DbPoolServlet</servlet-class>
+		<servlet-name>db</servlet-name>
+		<servlet-class>hello.DbSQLServlet</servlet-class>
 		<load-on-startup>1</load-on-startup>
 	</servlet>
 	<servlet-mapping>
-		<servlet-name>postgres</servlet-name>
+		<servlet-name>db</servlet-name>
 		<url-pattern>/db</url-pattern>
 	</servlet-mapping>
+	<servlet>
+		<servlet-name>queries</servlet-name>
+		<servlet-class>hello.QueriesSQLServlet</servlet-class>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>queries</servlet-name>
+		<url-pattern>/queries</url-pattern>
+	</servlet-mapping>
 	<servlet>
 		<servlet-name>postgres-update</servlet-name>
 		<servlet-class>hello.PostgresUpdateServlet</servlet-class>

+ 1 - 1
frameworks/PHP/README.md

@@ -9,7 +9,7 @@ For further guidance, review the
 ### PHP Versions
 
 [PHP 7.2.2](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php/php7.sh),
-[PHP 5.6.33](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php/php5.sh) and [HHVM 3.21](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/hhvm.sh).
+[PHP 5.6.33](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/php/php5.sh) and [HHVM 3.24](https://github.com/TechEmpower/FrameworkBenchmarks/blob/master/toolset/setup/linux/languages/hhvm.sh).
 
 ## Adding New PHP-based Frameworks
 

+ 3 - 2
frameworks/PHP/cakephp/deploy/nginx.conf

@@ -1,7 +1,7 @@
-worker_processes  8;
+worker_processes  auto;
 
 events {
-    worker_connections 2048;
+    worker_connections 16384;
 	multi_accept on;
 	use epoll;
 }
@@ -10,6 +10,7 @@ http {
     include       /home/vagrant/FrameworkBenchmarks/installs/nginx/conf/mime.types;
     default_type  application/octet-stream;
     access_log off;
+    server_tokens off;
 
     sendfile on;
     tcp_nopush on;

+ 3 - 2
frameworks/PHP/clancats/deploy/nginx.conf

@@ -1,9 +1,9 @@
-worker_processes  8;
+worker_processes  auto;
 
 error_log stderr error;
 
 events {
-	worker_connections  1024;
+	worker_connections  16384;
 }
 
 http {
@@ -11,6 +11,7 @@ http {
 	default_type  application/octet-stream;
 
 	access_log off;
+	server_tokens off;
 
 	sendfile        on;
 	keepalive_timeout  65;

+ 3 - 2
frameworks/PHP/codeigniter/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-  worker_connections  1024;
+  worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
   #access_log  logs/access.log  main;
   access_log off;
+  server_tokens off;
 
   sendfile        on;
   #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/cygnite/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/fat-free/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/fuel/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/hhvm/deploy/nginx.conf

@@ -1,14 +1,15 @@
-worker_processes  8;
+worker_processes  auto;
 error_log stderr error;
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 http {
     include       /usr/local/nginx/conf/mime.types;
     default_type  application/octet-stream;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     keepalive_timeout  65;

+ 3 - 2
frameworks/PHP/kohana/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 2 - 0
frameworks/PHP/kumbiaphp/.gitignore

@@ -0,0 +1,2 @@
+vendor
+bench/public/info.php

+ 42 - 0
frameworks/PHP/kumbiaphp/README.md

@@ -0,0 +1,42 @@
+[![KumbiaPHP logo](https://rawgit.com/kumbiaphp/kumbiaphp/1.0/default/public/img/kumbiaphp.svg)](https://github.com/KumbiaPHP/KumbiaPHP) 
+
+[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/KumbiaPHP/KumbiaPHP/badges/quality-score.png?b=1.0)](https://scrutinizer-ci.com/g/KumbiaPHP/KumbiaPHP/?branch=1.0)
+[![Code Climate](https://codeclimate.com/github/KumbiaPHP/KumbiaPHP/badges/gpa.svg)](https://codeclimate.com/github/KumbiaPHP/KumbiaPHP)
+![PHP7 ready](https://rawgit.com/kumbiaphp/kumbiaphp/1.0/default/public/img/php7.svg)
+
+# KumbiaPHP Benchmarking Test
+
+This is the KumbiaPHP portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+Uses the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-encode.php).
+
+* [JSON test controller](bench/app/controllers/json_controller.php)
+
+
+### Data-Store/Database Mapping Test
+
+* [DB test controller](bench/app/controllers/db_controller.php)
+
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [KumbiaPHP Version 1.0](https://github.com/KumbiaPHP/KumbiaPHP)
+* [PHP Version 7.2.22](http://www.php.net/) with FPM and OPCache
+* [nginx 1.12.2](http://nginx.org/)
+* [MySQL 5.7.21](https://dev.mysql.com/)
+
+## Test URLs
+### JSON Encoding Test
+
+http://localhost/json
+
+### Data-Store/Database Mapping Test
+
+http://localhost/db/
+
+### Variable Query Test
+    
+http://localhost/db/queries/2
+

+ 38 - 0
frameworks/PHP/kumbiaphp/bench/app/config/config.ini

@@ -0,0 +1,38 @@
+;; Configuracion de Aplicacion
+
+; Explicación de la Configuración:
+
+; name: Es el nombre de la aplicación
+; database: base de datos a utilizar
+; dbdate: Formato de Fecha por defecto de la Applicación
+; debug: muestra los errores en pantalla (On|off)
+; log_exceptions: muestra las excepciones en pantalla (On|off)
+; cache_template: descomentar para habilitar cache de template
+; cache_driver: driver para la cache (file, sqlite, memsqlite)
+; metadata_lifetime: Tiempo de vida de la metadata cacheada
+; locale: Localicazion
+; routes: para activar los routes.ini
+
+
+; ¡¡¡ ADVERTENCIA !!!
+; Cuando se efectua el cambio de production=Off, a production=On, es necesario eliminar
+; el contenido del directorio de cache de la aplicacion para que se renueve
+; la metadata
+
+[application]
+name = "KUMBIA BENCH" 
+database = development
+dbdate = YYYY-MM-DD
+debug = Off
+log_exceptions = Off
+;cache_template = On
+cache_driver = nixfile
+metadata_lifetime = "+1 year"
+namespace_auth = "default"
+;routes = On
+
+
+; Deprecated configs that are from server not the application
+; timezone: Es la zona horaria que usará el framework, cambiarla http://php.net/manual/es/timezones.php
+; production: Indica si esta en producción
+; charset: codificacion de caracteres

+ 16 - 0
frameworks/PHP/kumbiaphp/bench/app/config/config.php

@@ -0,0 +1,16 @@
+<?php
+
+return [
+'application' => [
+    'name' => 'KUMBIA PROJECT',
+    'database' => 'default',
+    'dbdate' => 'YYYY-MM-DD',
+    'debug' => 'Off',
+    'log_exceptions' => 'Off',
+    //'cache_template' => 'On',
+    'cache_driver' => 'nixfile',
+    'metadata_lifetime' => '+1 year',
+    'namespace_auth' => 'default',
+    //'routes' => 'On',
+    ],
+];

+ 11 - 0
frameworks/PHP/kumbiaphp/bench/app/config/databases.php

@@ -0,0 +1,11 @@
+<?php
+//Conexión a Mysql
+return ['default' => [
+            'dsn' => 'mysql:host=TFB-database;dbname=hello_world',
+            'username' => 'benchmarkdbuser',
+            'password' => 'benchmarkdbpass',
+            'params' => [
+                PDO::ATTR_PERSISTENT => true, //conexión persistente
+            ]
+        ],
+    ];

+ 38 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/db_controller.php

@@ -0,0 +1,38 @@
+<?php
+
+class DbController extends AppController
+{
+    protected function before_filter()
+    {
+        View::select(null, null);
+        header('Content-type: application/json');
+    }
+
+    public function index()
+    {
+        echo json_encode(World::byId(mt_rand(1, 10000)));
+    }
+
+    public function queries($count = 1)
+    {
+        $count = is_numeric($count) ? min(max($count, 1), 500) : 1;
+        $worlds = [];
+        for ($i = 0; $i < $count; ++$i) {
+            $worlds[] = World::byId(mt_rand(1, 10000));
+        }
+        echo json_encode($worlds);
+    }
+
+    public function update($count = 1)
+    {
+        $count = is_numeric($count) ? min(max($count, 1), 500) : 1;
+        $worlds = [];
+        for ($i = 0; $i < $count; ++$i) {
+            $row = World::byId(mt_rand(1, 10000));
+            $row->randomNumber = mt_rand(1, 10000);
+            $row->update();
+            $worlds[] = $row;
+        }
+        echo json_encode($worlds);
+    }
+}

+ 13 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/fortune_controller.php

@@ -0,0 +1,13 @@
+<?php
+
+class FortuneController extends AppController
+{
+    public function index()
+    {
+        View::select(null,'fortune');
+        $data = World::all('SELECT id, message FROM Fortune');
+        $data[] = (object) ['id' => 0,'message' => 'Additional fortune added at request time.'];
+        usort($data, function($a, $b){return strcmp($a->message, $b->message);});
+        $this->data = $data;
+    }
+}

+ 16 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/index_controller.php

@@ -0,0 +1,16 @@
+<?php
+
+/**
+ * Controller por defecto si no se usa el routes
+ *
+ */
+class IndexController extends AppController
+{
+
+    public function index()
+    {
+        View::select(null, null);
+        header('Content-type: text/plain');
+        echo 'Hello, World!';
+    }
+}

+ 12 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/json_controller.php

@@ -0,0 +1,12 @@
+<?php
+
+class JsonController extends AppController
+{
+
+    public function index()
+    {
+        View::select(null, null);
+        header('Content-type: application/json');
+        echo json_encode(['message' => 'Hello, World!']);
+    }
+}

+ 59 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/raw_controller.php

@@ -0,0 +1,59 @@
+<?php
+
+class RawController extends AppController
+{
+    protected $pdo;
+
+    protected function before_filter()
+    {
+        View::select(null, null);
+        header('Content-type: application/json');
+
+        $this->pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+            PDO::ATTR_PERSISTENT => true
+        ));
+    }
+
+    public function index()
+    {
+        $res = $this->pdo->prepare('SELECT randomNumber FROM World WHERE id = ?');
+        $id = mt_rand(1, 10000);
+        $res->execute(array($id));
+        echo json_encode(['id' => $id, 'randomNumber' => $res->fetchColumn()]);
+    }
+
+    public function queries($count = 1)
+    {
+        //$queries = ($queries < 1) ? 1 : (($queries > 500) ? 500 : $queries);
+        $count = is_numeric($count) ? min(max($count, 1), 500) : 1;
+        $res = $this->pdo->prepare('SELECT randomNumber FROM World WHERE id = ?');
+        $worlds = [];
+        for ($i = 0; $i < $count; ++$i) {
+            $id = mt_rand(1, 10000);
+            $res->execute(array($id));
+            $worlds[] = array('id' => $id, 'randomNumber' => $res->fetchColumn());
+        }
+        echo json_encode($worlds);
+    }
+
+    public function update($count = 1)
+    {
+        $count = is_numeric($count) ? min(max($count, 1), 500) : 1;
+        $worlds = [];
+        
+        $sth = $this->pdo->prepare('SELECT * FROM World WHERE id = ?');
+        $updateSth = $this->pdo->prepare('UPDATE World SET randomNumber = ? WHERE id = ?');
+        
+        for ($i = 0; $i < $count; ++$i) {
+            $id = mt_rand(1, 10000);
+            $randomNumber = mt_rand(1, 10000);
+
+            $sth->execute(array($id));
+            $row = ['id' => $id, 'randomNumber' => $updateSth->fetchColumn()];
+            $row['randomNumber'] = $randomNumber;
+            $updateSth->execute([$randomNumber, $id]);
+            $worlds[] = $row;
+        }
+        echo json_encode($worlds);
+    }
+}

+ 20 - 0
frameworks/PHP/kumbiaphp/bench/app/controllers/raw_fortune_controller.php

@@ -0,0 +1,20 @@
+<?php
+
+class RawFortuneController extends AppController
+{
+    public function index()
+    {
+        View::select(null,'raw');
+        $pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
+            PDO::ATTR_PERSISTENT => true
+        ));
+        $res = $pdo->query('SELECT id, message FROM Fortune', PDO::FETCH_ASSOC);
+        $data = $res->fetchAll();
+        
+        array_push($data, array('id'=> 0, 'message' => 'Additional fortune added at request time.'));
+        usort($data, function($left, $right) {
+            return strcmp($left['message'], $right['message']);
+        });
+        $this->data = $data;
+    }
+}

+ 33 - 0
frameworks/PHP/kumbiaphp/bench/app/libs/admin_controller.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * @see Controller nuevo controller
+ */
+require_once CORE_PATH . 'kumbia/controller.php';
+
+/**
+ * Controlador para proteger los controladores que heredan
+ * Para empezar a crear una convención de seguridad y módulos
+ *
+ * Todas las controladores heredan de esta clase en un nivel superior
+ * por lo tanto los metodos aqui definidos estan disponibles para
+ * cualquier controlador.
+ *
+ * @category Kumbia
+ * @package Controller
+ */
+class AdminController extends Controller
+{
+
+    final protected function initialize()
+    {
+        //Código de auth y permisos
+        //Será libre, pero añadiremos uno por defecto en breve
+        //Posiblemente se cree una clase abstracta con lo que debe tener por defecto
+    }
+
+    final protected function finalize()
+    {
+        
+    }
+
+}

+ 30 - 0
frameworks/PHP/kumbiaphp/bench/app/libs/app_controller.php

@@ -0,0 +1,30 @@
+<?php
+/**
+ * @see Controller nuevo controller
+ */
+require_once CORE_PATH . 'kumbia/controller.php';
+
+/**
+ * Controlador principal que heredan los controladores
+ *
+ * Todas las controladores heredan de esta clase en un nivel superior
+ * por lo tanto los metodos aqui definidos estan disponibles para
+ * cualquier controlador.
+ *
+ * @category Kumbia
+ * @package Controller
+ */
+class AppController extends Controller
+{
+
+    final protected function initialize()
+    {
+
+    }
+
+    final protected function finalize()
+    {
+        
+    }
+
+}

+ 32 - 0
frameworks/PHP/kumbiaphp/bench/app/libs/rest_controller.php

@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * Controlador para manejar peticiones REST
+ * 
+ * Por defecto cada acción se llama como el método usado por el cliente
+ * (GET, POST, PUT, DELETE, OPTIONS, HEADERS, PURGE...)
+ * ademas se puede añadir mas acciones colocando delante el nombre del método
+ * seguido del nombre de la acción put_cancel, post_reset...
+ *
+ * @category Kumbia
+ * @package Controller
+ * @author kumbiaPHP Team
+ */
+require_once CORE_PATH . 'kumbia/kumbia_rest.php';
+class RestController extends KumbiaRest {
+
+    /**
+     * Inicialización de la petición
+     * ****************************************
+     * Aqui debe ir la autenticación de la API
+     * ****************************************
+     */
+    final protected function initialize() {
+        
+    }
+
+    final protected function finalize() {
+        
+    }
+
+}

+ 87 - 0
frameworks/PHP/kumbiaphp/bench/app/libs/scaffold_controller.php

@@ -0,0 +1,87 @@
+<?php
+
+/**
+ * Controlador base para la construcción de CRUD para modelos rápidamente
+ *
+ * @category Kumbia
+ * @package Controller
+ */
+class ScaffoldController extends AdminController
+{
+    /** @var string Carpeta en views/_shared/scaffolds/ */
+    public $scaffold = 'kumbia';
+    /** @var string Nombre del modelo en CamelCase */
+    public $model = '';
+
+    /**
+     * Resultados paginados
+     */
+    public function index($page = 1)
+    {
+        $this->data = (new $this->model)->paginate("page: $page", 'order: id desc');
+    }
+
+    /**
+     * Crea un Registro
+     */
+    public function crear()
+    {
+        if (Input::hasPost($this->model)) {
+
+            $obj = new $this->model;
+            //En caso que falle la operación de guardar
+            if (!$obj->save(Input::post($this->model))) {
+                Flash::error('Falló Operación');
+                //se hacen persistente los datos en el formulario
+                $this->{$this->model} = $obj;
+                return;
+            }
+            return Redirect::to();
+        }
+        // Sólo es necesario para el autoForm
+        $this->{$this->model} = new $this->model;
+    }
+
+    /**
+     * Edita un Registro
+     */
+    public function editar($id)
+    {
+        View::select('crear');
+
+        //se verifica si se ha enviado via POST los datos
+        if (Input::hasPost($this->model)) {
+            $obj = new $this->model;
+            if (!$obj->update(Input::post($this->model))) {
+                Flash::error('Falló Operación');
+                //se hacen persistente los datos en el formulario
+                $this->{$this->model} = Input::post($this->model);
+            } else {
+                return Redirect::to();
+            }
+        }
+
+        //Aplicando la autocarga de objeto, para comenzar la edición
+        $this->{$this->model} = (new $this->model)->find((int) $id);
+    }
+
+    /**
+     * Borra un Registro
+     */
+    public function borrar($id)
+    {
+        if (!(new $this->model)->delete((int) $id)) {
+            Flash::error('Falló Operación');
+        }
+        //enrutando al index para listar los articulos
+        Redirect::to();
+    }
+
+    /**
+     * Ver un Registro
+     */
+    public function ver($id)
+    {
+        $this->data = (new $this->model)->find_first((int) $id);
+    }
+}

+ 16 - 0
frameworks/PHP/kumbiaphp/bench/app/libs/view.php

@@ -0,0 +1,16 @@
+<?php
+/**
+ * @see KumbiaView
+ */
+require_once CORE_PATH . 'kumbia/kumbia_view.php';
+
+/**
+ * Esta clase permite extender o modificar la clase ViewBase de Kumbiaphp.
+ *
+ * @category KumbiaPHP
+ * @package View
+ */
+class View extends KumbiaView
+{
+
+}

+ 9 - 0
frameworks/PHP/kumbiaphp/bench/app/models/fortune.php

@@ -0,0 +1,9 @@
+<?php
+
+class Fortune extends \Kumbia\ActiveRecord\LiteRecord
+{
+    public static function all()
+    {
+        return parent::all('SELECT id, message FROM Fortune');
+    }
+}

+ 9 - 0
frameworks/PHP/kumbiaphp/bench/app/models/world.php

@@ -0,0 +1,9 @@
+<?php
+
+class World extends \Kumbia\ActiveRecord\LiteRecord
+{
+    public static function byId($id)
+    {
+        return self::first('SELECT id, randomNumber FROM World WHERE id = ?', $id);
+    }
+}

+ 24 - 0
frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/default.phtml

@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="es">
+ <head>
+  <meta charset=<?= APP_CHARSET ?> >
+  <title>KumbiaPHP Framework</title>
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <?php Tag::css('kumbia') ?>
+  <?= Html::includeCss() ?>
+</head>
+<body>
+<div class="container">
+  <header class="row">
+      <div class="col-8">
+        <?= Html::img('kumbiaphp.svg', 'KumbiaPHP logo') ?>
+      </div>
+      <div class="col-4 text-right">
+          App: <strong><?= basename(dirname(APP_PATH)) ?></strong> (<?= PRODUCTION ? 'Production' : 'Development' ?>)
+      </div>
+  </header>
+  <?php View::content() ?>
+  <?php View::partial('kumbia/footer') ?>
+</div>
+</body>
+</html>

+ 4 - 0
frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/fortune.phtml

@@ -0,0 +1,4 @@
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>
+<?php foreach ($data as $item) : ?>
+<tr><td><?= $item->id ?></td><td><?= h($item->message) ?></td></tr>
+<?php endforeach ?></table></body></html>

+ 2 - 0
frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/hello.phtml

@@ -0,0 +1,2 @@
+<?php header('Content-type: text/plain') ?>
+Hello, World!

+ 4 - 0
frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/json.phtml

@@ -0,0 +1,4 @@
+<?php
+/*mime type para el contenido*/
+header('Content-type: application/json');
+echo json_encode($data);

+ 4 - 0
frameworks/PHP/kumbiaphp/bench/app/views/_shared/templates/raw.phtml

@@ -0,0 +1,4 @@
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>
+<?php foreach ($data as $key => $value) : ?>
+<tr><td><?= $value['id'] ?></td><td><?= h($value['message']) ?></td></tr>
+<?php endforeach ?></table></body></html>

+ 34 - 0
frameworks/PHP/kumbiaphp/bench/public/.user.ini

@@ -0,0 +1,34 @@
+; Config PHP for FastCGi, FPM,...  (nginx for example)
+; like .htaccess but better
+; see http://php.net/manual/en/configuration.file.per-user.php
+; see http://php.net/manual/en/ini.core.php
+; check your php.ini for:
+;user_ini.filename
+;user_ini.cache_ttl
+
+;display_errors = On  ; OFF in production
+;html_errors = On
+;error_reporting = -1
+;default_charset = "UTF-8" ; before PHP 5.6
+;date.timezone = "Europe/Madrid"
+;magic_quotes_gpc = Off
+;open_basedir = "/your-path"
+
+
+;upload_max_filesize = 1000M
+;post_max_size = 1005M
+;memory_limit = 64M
+;max_execution_time = 120
+
+;session see http://php.net/manual/en/session.configuration.php
+;session.name = "SSID"
+;session.cookie_httponly = 1 ; No access from DOM (js)
+;session.cookie_secure = 1 ;only send with https
+;session.save_handler=memcache ; handler (redis, rediscluster, memcache, ...)
+;session.auto_start = 1  ; always start session automatically
+;session.cookie_lifetime = 84600  ; session lifetime to 1 day
+;session.gc_maxlifetime = 84600   ; session lifetime to 1 day
+
+;opcache.enable = Off
+;opcache.validate_timestamps = On
+;opcache.load_comments = Off ; Removed in PHP 7.0.0.

BIN
frameworks/PHP/kumbiaphp/bench/public/favicon.ico


+ 97 - 0
frameworks/PHP/kumbiaphp/bench/public/index.php

@@ -0,0 +1,97 @@
+<?php
+/**
+ * KumbiaPHP web & app Framework.
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://wiki.kumbiaphp.com/Licencia
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to [email protected] so we can send you a copy immediately.
+ *
+ * @copyright  Copyright (c) 2005 - 2017 Kumbia Team (http://www.kumbiaphp.com)
+ * @license    http://wiki.kumbiaphp.com/Licencia     New BSD License
+ */
+
+/**
+ * Esta sección prepara el entorno
+ * Todo esto se puede hacer desde la configuracion del
+ * Servidor/PHP, en caso de no poder usarlo desde ahí
+ * Puedes descomentar  estas lineas.
+ */
+
+//*Locale*
+//setlocale(LC_ALL, 'es_ES');
+
+//*Timezone*
+//ini_set('date.timezone', 'America/New_York');
+
+/**
+ * @TODO
+ * REVISAR ESTA SECCIÓN
+ */
+const APP_CHARSET = 'UTF-8';
+/**
+ * Indicar si la aplicacion se encuentra en produccion
+ * directamente desde el index.php.
+ */
+const PRODUCTION = false;
+
+/**
+ * Descomentar para mostrar los errores.
+ */
+//error_reporting(E_ALL ^ E_STRICT);ini_set('display_errors', 'On');
+
+/**
+ * Define el APP_PATH.
+ *
+ * APP_PATH:
+ * - Ruta al directorio de la aplicación (por defecto la ruta al directorio app)
+ * - Esta ruta se utiliza para cargar los archivos de la aplicacion
+ * - En producción, es recomendable ponerla manual
+ */
+//define('APP_PATH', dirname(__DIR__).'/app/');
+const APP_PATH = 'APP_ROOT';
+/**
+ * Define el CORE_PATH.
+ *
+ * CORE_PATH:
+ * - Ruta al directorio que contiene el núcleo de Kumbia (por defecto la ruta al directorio core)
+ */
+//define('CORE_PATH', dirname(dirname(APP_PATH)).'/vendor/Kumbia/core/');
+const CORE_PATH = 'CORE_ROOT';
+/**
+ * Define el PUBLIC_PATH.
+ *
+ * PUBLIC_PATH:
+ * - Path para genera la Url en los links a acciones y controladores
+ * - Esta ruta la utiliza Kumbia como base para generar las Urls para acceder de lado de
+ *   cliente (con el navegador web) y es relativa al DOCUMENT_ROOT del servidor web
+ *
+ *  EN PRODUCCION ESTA CONSTANTE DEBERÍA SER ESTABLECIDA MANUALMENTE
+ */
+//define('PUBLIC_PATH', substr($_SERVER['SCRIPT_NAME'], 0, -9)); // - index.php string[9]
+const PUBLIC_PATH = '/';
+
+ /**
+  * Obtiene la url usando PATH_INFO.
+  */
+//$url = empty($_SERVER['PATH_INFO']) ? '/' : $_SERVER['PATH_INFO'];
+
+ /**
+  * Obtiene la url usando $_GET['_url']
+  * Cambiar también en el .htaccess.
+  */
+ $url = $_GET['_url'] ?? '/';
+
+/**
+ * Carga el gestor de arranque
+ * Por defecto el bootstrap del core.
+ *
+ * @see Bootstrap
+ */
+//require APP_PATH . 'libs/bootstrap.php'; //bootstrap de app
+require CORE_PATH.'kumbia/bootstrap.php'; //bootstrap del core

+ 51 - 0
frameworks/PHP/kumbiaphp/benchmark_config.json

@@ -0,0 +1,51 @@
+{
+    "framework": "kumbiaphp",
+    "tests": [{
+        "default": {
+            "setup_file": "setup",
+            "plaintext_url": "/",
+            "json_url": "/json",
+            "db_url": "/db",
+            "query_url": "/db/queries/",
+            "fortune_url": "/fortune",
+            "update_url": "/db/update/",
+            "port": 8080,
+            "approach": "Realistic",
+            "classification": "Fullstack",
+            "database": "MySQL",
+            "framework": "KumbiaPHP",
+            "language": "PHP",
+            "flavor": "PHP7",
+            "orm": "micro",
+            "platform": "None",
+            "webserver": "nginx",
+            "os": "Linux",
+            "database_os": "Linux",
+            "display_name": "kumbiaphp",
+            "notes": "",
+            "versus": "php7"
+        },
+        "raw": {
+            "setup_file": "setup",
+            "db_url": "/raw",
+            "query_url": "/raw/queries/",
+            "fortune_url": "/raw-fortune",
+            "update_url": "/raw/update/",
+            "port": 8080,
+            "approach": "Realistic",
+            "classification": "Fullstack",
+            "database": "MySQL",
+            "framework": "KumbiaPHP",
+            "language": "PHP",
+            "flavor": "PHP7",
+            "orm": "Raw",
+            "platform": "None",
+            "webserver": "nginx",
+            "os": "Linux",
+            "database_os": "Linux",
+            "display_name": "kumbiaphp-raw",
+            "notes": "",
+            "versus": "php7"
+          }
+        }]
+      }

+ 65 - 0
frameworks/PHP/kumbiaphp/deploy/nginx.conf

@@ -0,0 +1,65 @@
+#user  nobody;
+worker_processes  auto;
+
+error_log stderr error;
+#pid        logs/nginx.pid;
+
+events {
+    worker_connections  16384;
+}
+
+http {
+    include       INSTALL_ROOT/nginx/conf/mime.types;
+    default_type  application/octet-stream;
+
+    #access_log  logs/access.log  main;
+    access_log off;
+    server_tokens off;
+
+    sendfile        on;
+    #tcp_nopush     on;
+
+    keepalive_timeout  65;
+
+    #gzip  on;
+    upstream fastcgi_backend {
+        server 127.0.0.1:9001;
+        keepalive 50;
+    }
+    server {
+        listen       8080;
+        server_name  localhost;
+
+        #location / {
+        #    root   html;
+        #    index  index.html index.htm;
+        #}
+
+
+        root TEST_ROOT;
+        index  index.php;
+
+        location / {
+            try_files $uri /index.php?_url=$uri&$args;
+        }
+
+        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9001
+        #
+        location ~ \.php$ {
+            try_files $uri =404;
+            fastcgi_pass   fastcgi_backend;
+            fastcgi_keep_conn on;
+            fastcgi_index  index.php;
+#            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
+            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
+            include        INSTALL_ROOT/nginx/conf/fastcgi_params;
+        }
+
+        # deny access to .htaccess files, if Apache's document root
+        # concurs with nginx's one
+        #
+        #location ~ /\.ht {
+        #    deny  all;
+        #}
+    }
+}

+ 9 - 0
frameworks/PHP/kumbiaphp/deploy/php

@@ -0,0 +1,9 @@
+<VirtualHost *:8080>
+  Alias /php/ "TEST_ROOT"
+  <Directory TEST_ROOT>
+          Options Indexes FollowSymLinks MultiViews
+          #AllowOverride None
+          Order allow,deny
+          allow from all
+  </Directory>
+</VirtualHost>

+ 18 - 0
frameworks/PHP/kumbiaphp/setup.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+fw_depends mysql php7 nginx
+
+sed -i "s|APP_ROOT|${TROOT}/bench/app/|g" bench/public/index.php
+sed -i "s|CORE_ROOT|${TROOT}/vendor/Kumbia/core/|g" bench/public/index.php
+sed -i "s|TEST_ROOT|${TROOT}/bench/public/|g" deploy/php
+sed -i "s|TEST_ROOT|${TROOT}/bench/public/|g" deploy/nginx.conf
+sed -i "s|INSTALL_ROOT|${IROOT}|g" deploy/nginx.conf
+
+
+[[ ! -e vendor/Kumbia ]] || rm -rf vendor/Kumbia
+
+git clone -b v1.0.0-rc.2 --single-branch --depth 1 https://github.com/KumbiaPHP/KumbiaPHP.git vendor/Kumbia
+git clone -b v0.4.0 --single-branch --depth 1 https://github.com/KumbiaPHP/ActiveRecord.git vendor/Kumbia/ActiveRecord
+
+php-fpm --fpm-config $FWROOT/toolset/setup/linux/languages/php/php-fpm.conf -g /tmp/php-fpm.pid
+nginx -c $TROOT/deploy/nginx.conf

+ 3 - 2
frameworks/PHP/limonade/deploy/nginx.conf

@@ -1,15 +1,16 @@
-worker_processes  8;
+worker_processes  auto;
 
 error_log stderr error;
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 http {
     include       /usr/local/nginx/conf/mime.types;
     default_type  application/octet-stream;
     access_log off;
+    server_tokens off;
     sendfile        on;
     keepalive_timeout  65;
 

+ 3 - 2
frameworks/PHP/lithium/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/lumen/deploy/nginx.conf

@@ -1,15 +1,16 @@
-worker_processes  8;
+worker_processes  auto;
 
 error_log stderr error;
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 http {
     include /usr/local/nginx/conf/mime.types;    
     default_type  application/octet-stream;
     access_log off;
+    server_tokens off;
     sendfile        on;
     keepalive_timeout  65;
 

+ 4 - 4
frameworks/PHP/phalcon-micro/README.md

@@ -22,10 +22,10 @@ Uses Phalcon's template engine 'Volt'
 ## Infrastructure Software Versions
 The tests were run with:
 
-* [Phalcon 3.2.4](http://phalconphp.com/)
-* [PHP Version 5.6.32](http://www.php.net/) with FPM, APC and Phalcon extension
-* [nginx 1.12.0](http://nginx.org/)
-* [MySQL 5.7.20](https://dev.mysql.com/)
+* [Phalcon 3.3.1](http://phalconphp.com/)
+* [PHP Version 5.6.33](http://www.php.net/) with FPM, APC and Phalcon extension
+* [nginx 1.12.2](http://nginx.org/)
+* [MySQL 5.7.21](https://dev.mysql.com/)
 
 ## Test URLs
 ### JSON Encoding Test

+ 3 - 2
frameworks/PHP/phalcon-micro/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 5 - 5
frameworks/PHP/phalcon/README.md

@@ -23,11 +23,11 @@ Uses Phalcons template engine 'Volt'
 ## Infrastructure Software Versions
 The tests were run with:
 
-* [Phalcon 3.2.4](http://phalconphp.com/)
-* [PHP Version 7.2.1](http://www.php.net/) with FPM, OPcache and Phalcon extension
-* [nginx 1.12.0](http://nginx.org/)
-* [MySQL 5.5.54](https://dev.mysql.com/)
-* [MongoDB 2.4.8](https://mongodb.org/)
+* [Phalcon 3.3.1](http://phalconphp.com/)
+* [PHP Version 7.2.2](http://www.php.net/) with FPM, OPcache and Phalcon extension
+* [nginx 1.12.2](http://nginx.org/)
+* [MySQL 5.7.21](https://dev.mysql.com/)
+* [MongoDB 3.6](https://mongodb.org/)
 
 ## Test URLs
 ### JSON Encoding Test

+ 3 - 2
frameworks/PHP/phalcon/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 4 - 7
frameworks/PHP/php/dborm.php

@@ -1,8 +1,4 @@
 <?php
-//
-// Database Test
-//
-
 // Set content type
 header("Content-type: application/json");
 
@@ -23,7 +19,7 @@ ActiveRecord\Config::initialize(function($cfg)
 // Read number of queries to run from URL parameter
 $query_count = 1;
 if (isset($_GET['queries']) && $_GET['queries'] > 0) {
-  $query_count = $_GET["queries"];
+  $query_count = $_GET["queries"] > 500 ? 500 : $_GET['queries'];
 }
 
 // Create an array with the response string.
@@ -40,8 +36,9 @@ for ($i = 0; $i < $query_count; $i++) {
   // Store result in array.
   $arr[] = $world->to_array();
 }
-
+if ($query_count === 1) {
+  $arr = $arr[0];
+}
 // Use the PHP standard JSON encoder.
 // http://www.php.net/manual/en/function.json-encode.php
 echo json_encode($arr);
-?>

+ 7 - 12
frameworks/PHP/php/dbraw.php

@@ -1,7 +1,5 @@
 <?php
-//
-// Database Test
-//
+header('Content-type: application/json');
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
@@ -12,31 +10,28 @@ $pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser',
 // Read number of queries to run from URL parameter
 $query_count = 1;
 if (isset($_GET['queries']) && $_GET['queries'] > 0) {
-  $query_count = $_GET['queries'];
+  $query_count = $_GET['queries'] > 500 ? 500 : $_GET['queries'];
 }
 
 // Create an array with the response string.
 $arr = array();
-$id = mt_rand(1, 10000);
 
 // Define query
-$statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id = :id');
-$statement->bindParam(':id', $id, PDO::PARAM_INT);
+$statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id = ?');
 
 // For each query, store the result set values in the response array
 while (0 < $query_count--) {
-  $statement->execute();
+  $id = mt_rand(1, 10000);
+  $statement->execute(array($id));
   
   // Store result in array.
   $arr[] = array('id' => $id, 'randomNumber' => $statement->fetchColumn());
-  $id = mt_rand(1, 10000);
 }
 
 // Use the PHP standard JSON encoder.
 // http://www.php.net/manual/en/function.json-encode.php
-if (count($arr) == 1) {
-  $arr = $arr[0];
+if (count($arr) === 1) {
+      $arr = $arr[0];
 }
 
 echo json_encode($arr);
-?>

+ 3 - 3
frameworks/PHP/php/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,10 +10,9 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
-
 http {
     include       /usr/local/nginx/conf/mime.types;
     default_type  application/octet-stream;
@@ -32,6 +31,7 @@ http {
     keepalive_timeout  65;
 
     #gzip  on;
+    server_tokens off;
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;

+ 4 - 22
frameworks/PHP/php/fortune.php

@@ -18,25 +18,7 @@ $arr[0] = 'Additional fortune added at request time.';
 
 asort($arr);
 ?>
-<!DOCTYPE html>
-<html>
-<head>
-<title>Fortunes</title>
-</head>
-<body>
-<table>
-<tr>
-<th>id</th>
-<th>message</th>
-</tr>
-<?php
-foreach ( $arr as $id => $fortune ) {
-?>
-<tr>
-<td><?php echo htmlspecialchars($id, ENT_QUOTES, 'UTF-8'); ?></td>  
-<td><?php echo htmlspecialchars($fortune, ENT_QUOTES, 'UTF-8'); ?></td>
-</tr>
-<?php } ?>
-</table>
-</body>
-</html>
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>
+<?php foreach ( $arr as $id => $fortune ) : ?>
+<tr><td><?php echo $id ?></td><td><?php echo htmlspecialchars($fortune, ENT_QUOTES, 'UTF-8') ?></td></tr>
+<?php endforeach ?></table></body></html>

+ 2 - 0
frameworks/PHP/php/info.php

@@ -0,0 +1,2 @@
+<?php
+phpinfo();

+ 2 - 12
frameworks/PHP/php/json.php

@@ -1,17 +1,7 @@
 <?php
-//
-// JSON Encoding Test
-//
-
 // Set content type
-header("Content-type: application/json");
-
-// Create an array with the response string.
-$arr = array(
-    "message" => "Hello, World!"
-);
+header('Content-type: application/json');
 
 // Use the PHP standard JSON encoder.
 // http://www.php.net/manual/en/function.json-encode.php
-echo json_encode($arr);
-?>
+echo json_encode(array('message' => 'Hello, World!'));

+ 9 - 17
frameworks/PHP/php/updateraw.php

@@ -1,7 +1,5 @@
 <?php
-//
-// Database Test
-//
+header('Content-type: application/json');
 
 // Database connection
 // http://www.php.net/manual/en/ref.pdo-mysql.php
@@ -12,37 +10,31 @@ $pdo = new PDO('mysql:host=TFB-database;dbname=hello_world', 'benchmarkdbuser',
 // Read number of queries to run from URL parameter
 $query_count = 1;
 if (isset($_GET['queries']) && $_GET['queries'] > 0) {
-  $query_count = $_GET['queries'];
+  $query_count = $_GET['queries'] > 500 ? 500 : $_GET['queries'];
 }
 
 // Create an array with the response string.
 $arr = array();
-$id = mt_rand(1, 10000);
-$randomNumber = mt_rand(1, 1000);
 
 // Define query
-$statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id = :id');
-$statement->bindParam(':id', $id, PDO::PARAM_INT);
-
-$updateStatement = $pdo->prepare('UPDATE World SET randomNumber = :randomNumber WHERE id = :id');
-$updateStatement->bindParam(':id', $id, PDO::PARAM_INT);
-$updateStatement->bindParam(':randomNumber', $randomNumber, PDO::PARAM_INT);
+$statement = $pdo->prepare('SELECT randomNumber FROM World WHERE id = ?');
+$updateStatement = $pdo->prepare('UPDATE World SET randomNumber = ? WHERE id = ?');
 
 // For each query, store the result set values in the response array
 while (0 < $query_count--) {
-  $statement->execute();
+  $id = mt_rand(1, 10000);
+  $randomNumber = mt_rand(1, 10000);
+
+  $statement->execute(array($id));
   
   // Store result in array.
   $world = array('id' => $id, 'randomNumber' => $statement->fetchColumn());
   $world['randomNumber'] = $randomNumber;
-  $updateStatement->execute();
+  $updateStatement->execute(array($randomNumber, $id));
   
   $arr[] = $world;
-  $id = mt_rand(1, 10000);
-  $randomNumber = mt_rand(1, 10000);
 }
 
 // Use the PHP standard JSON encoder.
 // http://www.php.net/manual/en/function.json-encode.php
 echo json_encode($arr);
-?>

+ 3 - 2
frameworks/PHP/phpixie/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;        
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/phreeze/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/silex-orm/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/silex/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/silex/deploy/nginx_raw.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/symfony/deploy/nginx.conf

@@ -1,7 +1,7 @@
-worker_processes  8;
+worker_processes  auto;
 
 events {
-    worker_connections 2048;
+    worker_connections 16384;
     multi_accept on;
     use epoll;
 }
@@ -11,6 +11,7 @@ http {
     default_type application/octet-stream;
 
     access_log off;
+    server_tokens off;
 
     sendfile on;
     tcp_nopush on;

+ 3 - 2
frameworks/PHP/yaf/deploy/nginx.conf

@@ -1,8 +1,8 @@
-worker_processes  8;
+worker_processes  auto;
 error_log stderr error;
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 http {
@@ -11,6 +11,7 @@ http {
     sendfile      on;
     keepalive_timeout  65;
     access_log off;
+    server_tokens off;
 
     upstream fastcgi_backend {
         server 127.0.0.1:9001;

+ 3 - 2
frameworks/PHP/yii2/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 http {
@@ -19,6 +19,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/zend/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

+ 3 - 2
frameworks/PHP/zend1/deploy/nginx.conf

@@ -1,5 +1,5 @@
 #user  nobody;
-worker_processes  8;
+worker_processes  auto;
 
 #error_log  logs/error.log;
 #error_log  logs/error.log  notice;
@@ -10,7 +10,7 @@ error_log stderr error;
 
 
 events {
-    worker_connections  1024;
+    worker_connections  16384;
 }
 
 
@@ -24,6 +24,7 @@ http {
 
     #access_log  logs/access.log  main;
     access_log off;
+    server_tokens off;
 
     sendfile        on;
     #tcp_nopush     on;

File diff suppressed because it is too large
+ 414 - 109
frameworks/Rust/actix/Cargo.lock


+ 3 - 3
frameworks/Rust/actix/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "actix"
-version = "0.1.1"
+version = "0.2.0"
 build = "build.rs"
 
 [[bin]]
@@ -24,8 +24,8 @@ rand = "0.3"
 num_cpus = "1.0"
 futures = "0.1"
 http = "0.1"
-actix = "^0.4.3"
-actix-web = "0.3"
+actix = "0.5"
+actix-web = "0.4"
 diesel = { version = "1.1", features = ["postgres"] }
 postgres = "0.15"
 

+ 12 - 16
frameworks/Rust/actix/src/db.rs

@@ -30,13 +30,12 @@ impl DbExecutor {
 
 pub struct RandomWorld;
 
-impl ResponseType for RandomWorld {
-    type Item = models::World;
-    type Error = io::Error;
+impl Message for RandomWorld {
+    type Result = io::Result<models::World>;
 }
 
 impl Handler<RandomWorld> for DbExecutor {
-    type Result = MessageResult<RandomWorld>;
+    type Result = io::Result<models::World>;
 
     fn handle(&mut self, _: RandomWorld, _: &mut Self::Context) -> Self::Result {
         use schema::World::dsl::*;
@@ -53,13 +52,12 @@ impl Handler<RandomWorld> for DbExecutor {
 
 pub struct RandomWorlds(pub u16);
 
-impl ResponseType for RandomWorlds {
-    type Item = Vec<models::World>;
-    type Error = io::Error;
+impl Message for RandomWorlds {
+    type Result = io::Result<Vec<models::World>>;
 }
 
 impl Handler<RandomWorlds> for DbExecutor {
-    type Result = MessageResult<RandomWorlds>;
+    type Result = io::Result<Vec<models::World>>;
 
     fn handle(&mut self, msg: RandomWorlds, _: &mut Self::Context) -> Self::Result {
         use schema::World::dsl::*;
@@ -79,15 +77,14 @@ impl Handler<RandomWorlds> for DbExecutor {
 
 pub struct UpdateWorld(pub usize);
 
-impl ResponseType for UpdateWorld {
-    type Item = Vec<models::World>;
-    type Error = io::Error;
+impl Message for UpdateWorld {
+    type Result = io::Result<Vec<models::World>>;
 }
 
 impl Handler<UpdateWorld> for DbExecutor {
-    type Result = MessageResult<UpdateWorld>;
+    type Result = io::Result<Vec<models::World>>;
 
-    fn handle(&mut self, msg: UpdateWorld, _: &mut Self::Context) -> MessageResult<UpdateWorld> {
+    fn handle(&mut self, msg: UpdateWorld, _: &mut Self::Context) -> Self::Result {
         use schema::World::dsl::*;
 
         let mut worlds = Vec::with_capacity(msg.0);
@@ -112,9 +109,8 @@ impl Handler<UpdateWorld> for DbExecutor {
 
 pub struct TellFortune;
 
-impl ResponseType for TellFortune {
-    type Item = Vec<models::Fortune>;
-    type Error = io::Error;
+impl Message for TellFortune {
+    type Result = io::Result<Vec<models::Fortune>>;
 }
 
 impl Handler<TellFortune> for DbExecutor {

+ 6 - 6
frameworks/Rust/actix/src/main.rs

@@ -22,11 +22,11 @@ mod schema;
 mod models;
 
 struct State {
-    db: SyncAddress<db::DbExecutor>
+    db: Addr<Syn, db::DbExecutor>
 }
 
 fn world_row(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> {
-    req.state().db.call_fut(db::RandomWorld)
+    req.state().db.send(db::RandomWorld)
         .from_err()
         .and_then(|res| {
             match res {
@@ -54,7 +54,7 @@ fn queries(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
     let q = cmp::min(500, cmp::max(1, q));
 
     // run sql queries
-    req.state().db.call_fut(db::RandomWorlds(q))
+    req.state().db.send(db::RandomWorlds(q))
         .from_err()
         .and_then(|res| {
             if let Ok(worlds) = res {
@@ -81,7 +81,7 @@ fn updates(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
     let q = cmp::min(500, cmp::max(1, q));
 
     // update worlds
-    req.state().db.call_fut(db::UpdateWorld(q))
+    req.state().db.send(db::UpdateWorld(q))
         .from_err()
         .and_then(move |res| {
             if let Ok(worlds) = res {
@@ -105,7 +105,7 @@ struct FortuneTemplate<'a> {
 }
 
 fn fortune(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> {
-    req.state().db.call_fut(db::TellFortune)
+    req.state().db.send(db::TellFortune)
         .from_err()
         .and_then(|res| {
             match res {
@@ -136,7 +136,7 @@ fn main() {
 
     // Start db executor actors
     let addr = SyncArbiter::start(
-        num_cpus::get() * 3, move || db::DbExecutor::new(&db_url));
+        num_cpus::get() * 4, move || db::DbExecutor::new(&db_url));
 
     // start http server
     HttpServer::new(

+ 20 - 24
frameworks/Rust/actix/src/pg.rs

@@ -33,11 +33,11 @@ pub struct Fortune {
 
 
 struct State {
-    db: SyncAddress<PgConnection>
+    db: Addr<Syn, PgConnection>
 }
 
 fn world_row(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> {
-    req.state().db.call_fut(RandomWorld)
+    req.state().db.send(RandomWorld)
         .from_err()
         .and_then(|res| {
             match res {
@@ -64,7 +64,7 @@ fn queries(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
     let q = cmp::min(500, cmp::max(1, q));
 
     // run sql queries
-    req.state().db.call_fut(RandomWorlds(q))
+    req.state().db.send(RandomWorlds(q))
         .from_err()
         .and_then(|res| {
             if let Ok(worlds) = res {
@@ -91,7 +91,7 @@ fn updates(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error
     let q = cmp::min(500, cmp::max(1, q));
 
     // update db
-    req.state().db.call_fut(UpdateWorld(q))
+    req.state().db.send(UpdateWorld(q))
         .from_err()
         .and_then(move |res| {
             if let Ok(worlds) = res {
@@ -115,7 +115,7 @@ struct FortuneTemplate<'a> {
 }
 
 fn fortune(req: HttpRequest<State>) -> Box<Future<Item=HttpResponse, Error=Error>> {
-    req.state().db.call_fut(TellFortune)
+    req.state().db.send(TellFortune)
         .from_err()
         .and_then(|res| {
             match res {
@@ -150,7 +150,7 @@ impl PgConnection {
         let conn = Connection::connect(db_url, TlsMode::None)
             .expect(&format!("Error connecting to {}", db_url));
         PgConnection{
-            conn: conn,
+            conn,
             rng: thread_rng(),
         }
     }
@@ -161,13 +161,12 @@ unsafe impl Send for PgConnection {}
 
 pub struct RandomWorld;
 
-impl ResponseType for RandomWorld {
-    type Item = World;
-    type Error = io::Error;
+impl Message for RandomWorld {
+    type Result = io::Result<World>;
 }
 
 impl Handler<RandomWorld> for PgConnection {
-    type Result = MessageResult<RandomWorld>;
+    type Result = io::Result<World>;
 
     fn handle(&mut self, _: RandomWorld, _: &mut Self::Context) -> Self::Result {
         let random_world = self.conn.prepare_cached(
@@ -178,19 +177,18 @@ impl Handler<RandomWorld> for PgConnection {
             return Ok(World {id: row.get(0), randomnumber: row.get(1)})
         }
 
-        Err(io::Error::new(io::ErrorKind::Other, format!("Database error")))
+        Err(io::Error::new(io::ErrorKind::Other, "Database error"))
     }
 }
 
 pub struct RandomWorlds(pub u16);
 
-impl ResponseType for RandomWorlds {
-    type Item = Vec<World>;
-    type Error = io::Error;
+impl Message for RandomWorlds {
+    type Result = io::Result<Vec<World>>;
 }
 
 impl Handler<RandomWorlds> for PgConnection {
-    type Result = MessageResult<RandomWorlds>;
+    type Result = io::Result<Vec<World>>;
 
     fn handle(&mut self, msg: RandomWorlds, _: &mut Self::Context) -> Self::Result {
         let random_world = self.conn.prepare_cached(
@@ -210,15 +208,14 @@ impl Handler<RandomWorlds> for PgConnection {
 
 pub struct UpdateWorld(pub u16);
 
-impl ResponseType for UpdateWorld {
-    type Item = Vec<World>;
-    type Error = io::Error;
+impl Message for UpdateWorld {
+    type Result = io::Result<Vec<World>>;
 }
 
 impl Handler<UpdateWorld> for PgConnection {
-    type Result = MessageResult<UpdateWorld>;
+    type Result = io::Result<Vec<World>>;
 
-    fn handle(&mut self, msg: UpdateWorld, _: &mut Self::Context) -> MessageResult<UpdateWorld> {
+    fn handle(&mut self, msg: UpdateWorld, _: &mut Self::Context) -> Self::Result {
         let get_world = self.conn.prepare_cached(
             "SELECT id FROM World WHERE id=$1").unwrap();
         let update_world = self.conn.prepare_cached(
@@ -241,9 +238,8 @@ impl Handler<UpdateWorld> for PgConnection {
 
 pub struct TellFortune;
 
-impl ResponseType for TellFortune {
-    type Item = Vec<Fortune>;
-    type Error = io::Error;
+impl Message for TellFortune {
+    type Result = io::Result<Vec<Fortune>>;
 }
 
 impl Handler<TellFortune> for PgConnection {
@@ -277,7 +273,7 @@ fn main() {
 
     // Start db executor actors
     let addr = SyncArbiter::start(
-        num_cpus::get() * 3, move || PgConnection::new(&db_url));
+        num_cpus::get() * 4, move || PgConnection::new(&db_url));
 
     // start http server
     HttpServer::new(

+ 2 - 2
frameworks/Rust/actix/src/simple.rs

@@ -46,8 +46,8 @@ fn main() {
     // start http server
     HttpServer::new(
         move || Application::new()
-            .resource("/json", |r| r.f(json))
-            .resource("/plaintext", |r| r.f(plaintext)))
+            .resource("/plaintext", |r| r.f(plaintext))
+            .resource("/json", |r| r.f(json)))
         .backlog(8192)
         .bind("0.0.0.0:8080").unwrap()
         .start();

+ 1 - 1
toolset/setup/linux/frameworks/phalcon.sh

@@ -7,7 +7,7 @@ fw_installed phalcon && return 0
 # Enable the PHP phalcon extension
 sed -i 's|;extension=phalcon.so|extension=phalcon.so|g' $PHP_HOME/lib/php.ini
 
-VERSION="3.2.4"
+VERSION="3.3.1"
 
 fw_get -O https://github.com/phalcon/cphalcon/archive/v${VERSION}.tar.gz
 fw_untar v${VERSION}.tar.gz

+ 1 - 4
toolset/setup/linux/languages/hhvm.sh

@@ -12,10 +12,7 @@ fi
 
 fw_get http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
 
-# hhvm 3.24 causes most of our hhvm-using test implementations to segmentation
-# fault when connecting to the mysql database (the crash happens right as they
-# try to specify utf8 as the charset).  hhvm 3.21 doesn't have this problem.
-echo deb [arch=amd64] http://dl.hhvm.com/ubuntu `lsb_release -sc`-lts-3.21 main | sudo tee /etc/apt/sources.list.d/hhvm.list
+echo deb [arch=amd64] http://dl.hhvm.com/ubuntu `lsb_release -sc`-lts-3.24 main | sudo tee /etc/apt/sources.list.d/hhvm.list
 sudo apt-get update
 sudo apt-get install -y hhvm
 

+ 6 - 6
toolset/setup/linux/languages/php/php-fpm.conf

@@ -29,7 +29,7 @@
 ; in a local file.
 ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@
 ; Default Value: log/php-fpm.log
-;error_log = log/php-fpm.log
+error_log = /dev/stderr
 
 ; syslog_facility is used to specify what type of program is logging the
 ; message. This lets syslogd specify that messages from different facilities
@@ -155,7 +155,7 @@ listen = 127.0.0.1:9001
 
 ; Set listen(2) backlog.
 ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
-listen.backlog = 256
+listen.backlog = 4096
 
 ; Set permissions for unix socket, if one is used. In Linux, read/write
 ; permissions must be set in order to allow connections from a web server. Many
@@ -217,22 +217,22 @@ pm = dynamic
 ; forget to tweak pm.* to fit your needs.
 ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
 ; Note: This value is mandatory.
-pm.max_children = 512
+pm.max_children = 1024
 
 ; The number of child processes created on startup.
 ; Note: Used only when pm is set to 'dynamic'
 ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
-pm.start_servers = 256
+pm.start_servers = 512
 
 ; The desired minimum number of idle server processes.
 ; Note: Used only when pm is set to 'dynamic'
 ; Note: Mandatory when pm is set to 'dynamic'
-pm.min_spare_servers = 16
+pm.min_spare_servers = 50
 
 ; The desired maximum number of idle server processes.
 ; Note: Used only when pm is set to 'dynamic'
 ; Note: Mandatory when pm is set to 'dynamic'
-pm.max_spare_servers = 256
+pm.max_spare_servers = 512
 
 ; The number of seconds after which an idle process will be killed.
 ; Note: Used only when pm is set to 'ondemand'

+ 1 - 1
toolset/setup/linux/languages/php/php7.sh

@@ -10,7 +10,7 @@ RETCODE=$(fw_exists ${IROOT}/php7.installed)
   source $IROOT/php7.installed
   return 0; }
 
-VERSION="7.2.1"
+VERSION="7.2.2"
 PHP_HOME=$IROOT/php-$VERSION
 
 rm -rf $IROOT/php7

+ 42 - 0
toolset/setup/linux/systools/apache-apr.sh

@@ -0,0 +1,42 @@
+#!/bin/bash
+
+fw_depends gcc-6 openssl
+
+fw_installed apache-apr && return 0
+
+APR_VERSION=1.6.3
+TEMP_DIRECTORY="$(mktemp -d)"
+
+# Ask Apache about the preferred mirror for our connection using JSON response. Source: https://stackoverflow.com/a/39670213
+APR_MIRROR="$(wget -qO - http://www.apache.org/dyn/closer.lua?as_json=1 | grep -P '"preferred": "' | cut -d \" -f4)"
+APR_FILENAME=apr-${APR_VERSION}
+APR_URL=${APR_MIRROR}apr/${APR_FILENAME}.tar.gz
+APR_SIGNATURE=http://www.apache.org/dist/apr/${APR_FILENAME}.tar.gz.asc
+
+APACHE_KEYS=https://people.apache.org/keys/group/apr.asc
+
+# Download the files at temporal storage
+wget -P ${TEMP_DIRECTORY} ${APACHE_KEYS}
+wget -P ${TEMP_DIRECTORY} ${APR_SIGNATURE}
+wget -P ${TEMP_DIRECTORY} ${APR_URL} 
+
+# It's highly unlikely Apache to change the filename of the GPG keys file
+gpg --import ${TEMP_DIRECTORY}/apr.asc
+
+# Verify the downloaded file using the signature file
+gpg --verify ${TEMP_DIRECTORY}/${APR_FILENAME}.tar.gz.asc ${TEMP_DIRECTORY}/${APR_FILENAME}.tar.gz
+
+#TODO below
+# Compile the project
+pushd "${TEMP_DIRECTORY}"
+fw_untar "${TEMP_DIRECTORY}/${APR_FILENAME}.tar.gz"
+pushd "$APR_FILENAME"
+# We need the newer custom OpenSSL
+./configure --with-ssl=/usr/local/ssl
+make
+sudo make install
+sudo ldconfig
+popd
+popd
+
+echo "# Apache APR should be in /usr/local/ssl" > $IROOT/apache-apr.installed

+ 36 - 0
toolset/setup/linux/systools/openssl.sh

@@ -0,0 +1,36 @@
+#!/bin/bash
+
+fw_depends gcc-6
+
+fw_installed openssl && return 0
+
+OPENSSL_VERSION=1.0.2n
+TEMP_DIRECTORY="$(mktemp -d)"
+OPENSSL_FILENAME=openssl-${OPENSSL_VERSION}
+OPENSSL_URL=https://www.openssl.org/source/${OPENSSL_FILENAME}.tar.gz
+OPENSSL_SIGNATURE=https://www.openssl.org/source/${OPENSSL_FILENAME}.tar.gz.asc
+
+# Import the PGP keys of OpenSSL team. See the website for updates
+gpg --keyserver keys.gnupg.net --recv-keys 8657ABB260F056B1E5190839D9C4D26D0E604491 5B2545DAB21995F4088CEFAA36CEE4DEB00CFE33 C1F33DD8CE1D4CC613AF14DA9195C48241FBF7DD 7953AC1FBC3DC8B3B292393ED5E9E43F7DF9EE8C E5E52560DD91C556DDBDA5D02064C53641C25E5D D099684DC7C21E02E14A8AFEF23479455C51B27C
+
+# Download the files at temporal storage
+wget -P ${TEMP_DIRECTORY} ${OPENSSL_SIGNATURE}
+wget -P ${TEMP_DIRECTORY} ${OPENSSL_URL} 
+
+# Verify the downloaded file using the signature file
+gpg --verify ${TEMP_DIRECTORY}/${OPENSSL_FILENAME}.tar.gz.asc ${TEMP_DIRECTORY}/${OPENSSL_FILENAME}.tar.gz
+
+# Compile the project
+pushd "${TEMP_DIRECTORY}"
+fw_untar "${TEMP_DIRECTORY}/${OPENSSL_FILENAME}.tar.gz"
+pushd "$OPENSSL_FILENAME"
+./config --shared
+make
+sudo make install
+sudo ln -sf /usr/local/ssl/bin/openssl `which openssl`
+openssl version -v
+sudo ldconfig
+popd
+popd
+
+echo "# OpenSSL should be in /usr/local/ssl" > $IROOT/openssl.installed

+ 74 - 0
toolset/setup/linux/webservers/tomcat/server.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<Server port="8005" shutdown="SHUTDOWN">
+  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
+
+  <!--APR library loader. Documentation at /docs/apr.html -->
+  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
+
+  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
+  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
+  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
+  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
+
+  <!-- Global JNDI resources
+       Documentation at /docs/jndi-resources-howto.html
+  -->
+  <GlobalNamingResources>
+    <!-- Editable user database that can also be used by
+         UserDatabaseRealm to authenticate users
+    -->
+    <Resource name="UserDatabase" auth="Container"
+              type="org.apache.catalina.UserDatabase"
+              description="User database that can be updated and saved"
+              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
+              pathname="conf/tomcat-users.xml" />
+  </GlobalNamingResources>
+
+  <Service name="Catalina">
+    <!--The connectors can use a shared executor, you can define one or more named thread pools
+    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
+        maxThreads="250" minSpareThreads="4"/>-->
+
+    <!-- A "Connector" using the shared thread pool
+    <Connector executor="tomcatThreadPool"
+               port="8080" protocol="HTTP/1.1"
+               connectionTimeout="20000"
+               redirectPort="8443"
+               server="Tomcat"/>
+    -->
+    <!-- Connector with NIO2 without too much tweaks -->
+    <Connector port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol"
+               connectionTimeout="30000"
+               keepAliveTimeout="30000"
+               URIEncoding="UTF-8"
+               redirectPort="8443"
+               server="Tomcat"/>
+
+    <Engine name="Catalina" defaultHost="localhost">
+      <Realm className="org.apache.catalina.realm.LockOutRealm">
+        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
+               resourceName="UserDatabase"/>
+      </Realm>
+
+      <Host name="localhost"  appBase="webapps"
+            unpackWARs="true" autoDeploy="true">
+      </Host>
+    </Engine>
+  </Service>
+</Server>

+ 56 - 0
toolset/setup/linux/webservers/tomcat/tomcat.sh

@@ -0,0 +1,56 @@
+#!/bin/bash
+
+fw_depends java openssl apache-apr
+
+fw_installed tomcat && return 0
+
+TOMCAT_VERSION=9.0.5
+TEMP_DIRECTORY="$(mktemp -d)"
+
+# Ask Apache about the preferred mirror for our connection using JSON response. Source: https://stackoverflow.com/a/39670213
+APACHE_MIRROR="$(wget -qO - http://www.apache.org/dyn/closer.lua?as_json=1 | grep -P '"preferred": "' | cut -d \" -f4)"
+TOMCAT_FILENAME=apache-tomcat-${TOMCAT_VERSION}
+TOMCAT_URL=${APACHE_MIRROR}tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/${TOMCAT_FILENAME}.tar.gz
+
+TOMCAT_SIGNATURE=https://www.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VERSION}/bin/apache-tomcat-${TOMCAT_VERSION}.tar.gz.asc
+
+APACHE_KEYS=https://www.apache.org/dist/tomcat/tomcat-9/KEYS
+
+# Download the files at temporal storage
+wget -P ${TEMP_DIRECTORY} ${APACHE_KEYS}
+wget -P ${TEMP_DIRECTORY} ${TOMCAT_SIGNATURE}
+wget -P ${TEMP_DIRECTORY} ${TOMCAT_URL} 
+
+# It's highly unlikely Apache to change the filename of the GPG keys file
+gpg --import ${TEMP_DIRECTORY}/KEYS
+
+# Verify the downloaded file using the signature file
+gpg --verify ${TEMP_DIRECTORY}/${TOMCAT_FILENAME}.tar.gz.asc ${TEMP_DIRECTORY}/${TOMCAT_FILENAME}.tar.gz
+
+tar -xzf ${TEMP_DIRECTORY}/${TOMCAT_FILENAME}.tar.gz -C $IROOT
+
+# Build Tomcat Native adapter - Apache APR
+pushd "${IROOT}/${TOMCAT_FILENAME}/bin"
+mkdir -p tomcat-native
+tar -xzf tomcat-native.tar.gz -C tomcat-native --strip-components=1
+pushd "tomcat-native/native"
+./configure --with-apr=/usr/local/apr --with-ssl=/usr/local/ssl
+make
+sudo make install
+popd
+popd
+
+# Configure default server.xml
+pushd "${IROOT}/${TOMCAT_FILENAME}/conf/"
+mv server.xml server.xml.orig
+cat $FWROOT/toolset/setup/linux/webservers/tomcat/server.xml > server.xml
+popd
+
+# Configure Tomcat to use compiled native adapter
+echo -e "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/local/ssl/lib\n
+export LD_LIBRARY_PATH" > ${IROOT}/${TOMCAT_FILENAME}/bin/setenv.sh
+
+echo "export CATALINA_HOME=$IROOT/$TOMCAT_FILENAME" > $IROOT/tomcat.installed
+echo -e "export PATH=\$IROOT/$TOMCAT_FILENAME/bin:\$PATH" >> $IROOT/tomcat.installed
+
+source $IROOT/tomcat.installed

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