|
@@ -6,10 +6,10 @@ use Workerman\Protocols\Http;
|
|
use Workerman\Worker;
|
|
use Workerman\Worker;
|
|
|
|
|
|
$http_worker = new Worker('http://0.0.0.0:8080');
|
|
$http_worker = new Worker('http://0.0.0.0:8080');
|
|
-$http_worker->count = shell_exec('nproc');
|
|
|
|
-$http_worker->onWorkerStart = function () {
|
|
|
|
|
|
+$http_worker->count = shell_exec('nproc') * 3;
|
|
|
|
+$http_worker->onWorkerStart = static function () {
|
|
global $db;
|
|
global $db;
|
|
- $db = new mysqli('p:tfb-database', 'benchmarkdbuser', 'benchmarkdbpass', 'hello_world');
|
|
|
|
|
|
+ $db = new mysqli('tfb-database', 'benchmarkdbuser', 'benchmarkdbpass', 'hello_world');
|
|
};
|
|
};
|
|
|
|
|
|
$http_worker->onMessage = static function ($connection) {
|
|
$http_worker->onMessage = static function ($connection) {
|
|
@@ -23,7 +23,7 @@ $http_worker->onMessage = static function ($connection) {
|
|
return $connection->send(db());
|
|
return $connection->send(db());
|
|
|
|
|
|
case '/fortune':
|
|
case '/fortune':
|
|
- //Http::header('Content-Type: text/html; charset=utf-8');
|
|
|
|
|
|
+ // by default use 'Content-Type: text/html; charset=utf-8';
|
|
return $connection->send(fortune());
|
|
return $connection->send(fortune());
|
|
|
|
|
|
case '/update':
|
|
case '/update':
|