peterliu 4 years ago
parent
commit
5f6ae8e054

+ 23 - 0
frameworks/PHP/mark/README.md

@@ -0,0 +1,23 @@
+# Mark Benchmarking Test
+
+[Mark](https://github.com/passwalls/mark) is a high performance micro framework based on [Workerman](https://github.com/walkor/workerman) helps you quickly write APIs with php.
+
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [Mark](https://github.com/passwalls/mark)
+* [PHP-CLI](http://www.php.net/)
+
+
+### JSON Encoding Test
+Using the PHP standard [JSON encoder](http://www.php.net/manual/en/function.json-encode.php)
+
+## Test URLs
+
+### JSON Encoding Test
+http://localhost:8080/json
+
+### Plain text
+http://localhost:8080/plaintext
+

+ 23 - 0
frameworks/PHP/mark/benchmark_config.json

@@ -0,0 +1,23 @@
+{
+  "framework": "mark",
+  "tests": [{
+    "default": {
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Micro",
+      "framework": "mark",
+      "language": "PHP",
+      "flavor": "PHP8",
+      "orm": "Raw",
+      "platform": "workerman",
+      "webserver": "None",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "mark-php8-jit",
+      "notes": "",
+      "versus": "workerman"
+    }
+  }]
+}

+ 5 - 0
frameworks/PHP/mark/composer.json

@@ -0,0 +1,5 @@
+{
+    "require": {
+        "mark-php/mark": "^1.1"
+    }
+}

+ 15 - 0
frameworks/PHP/mark/config.toml

@@ -0,0 +1,15 @@
+[framework]
+name = "mark"
+
+[main]
+urls.plaintext = "/plaintext"
+urls.json = "/json"
+approach = "Realistic"
+classification = "Micro"
+database = "Postgres"
+database_os = "Linux"
+os = "Linux"
+orm = "Raw"
+platform = "workerman"
+webserver = "None"
+versus = "workerman"

+ 24 - 0
frameworks/PHP/mark/mark.dockerfile

@@ -0,0 +1,24 @@
+FROM ubuntu:20.10
+
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
+RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
+RUN apt-get update -yqq > /dev/null && \
+    apt-get install -yqq php8.0-cli php8.0-pgsql php8.0-xml > /dev/null
+
+RUN apt-get install -yqq composer > /dev/null
+
+RUN apt-get install -y php-pear php8.0-dev libevent-dev > /dev/null
+RUN pecl install event-3.0.2 > /dev/null && echo "extension=event.so" > /etc/php/8.0/cli/conf.d/event.ini
+ 
+COPY php.ini /etc/php/8.0/cli/php.ini
+
+ADD ./ /mark
+WORKDIR /mark
+
+RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
+
+EXPOSE 8080
+
+CMD php /mark/start.php start

+ 13 - 0
frameworks/PHP/mark/php.ini

@@ -0,0 +1,13 @@
+opcache.enable=1
+opcache.enable_cli=1
+opcache.validate_timestamps=0
+opcache.save_comments=0
+opcache.enable_file_override=1
+opcache.huge_code_pages=1
+
+mysqlnd.collect_statistics = Off
+
+memory_limit = 512M
+
+opcache.jit_buffer_size=128M
+opcache.jit=tracing

+ 41 - 0
frameworks/PHP/mark/start.php

@@ -0,0 +1,41 @@
+<?php
+use Mark\App;
+use Workerman\Timer;
+use Workerman\Protocols\Http\Response;
+
+require 'vendor/autoload.php';
+
+$api = new App('http://0.0.0.0:8080');
+
+$api->count = (int) shell_exec('nproc');
+
+$api->any('/plaintext', function () {
+    global $date;
+    return new Response(200, [
+        'Content-Type' => 'text/plain',
+        'Date'         => $date
+    ], 'Hello, World!');
+});
+
+$api->get('/json', function () {
+    global $date;
+    return new Response(200, [
+        'Content-Type' => 'application/json',
+        'Date'         => $date
+    ], \json_encode(['message' => 'Hello, World!']));
+});
+
+$date = gmdate('D, d M Y H:i:s').' GMT';
+
+$api->onWorkerStart = function () {
+    Timer::add(1, function () {
+        global $date;
+        $date = gmdate('D, d M Y H:i:s').' GMT';
+    });
+};
+
+$api->reusePort = true;
+
+$api->start();
+
+