Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions frameworks/symfony-spawn-tas/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
APP_ENV=prod
APP_DEBUG=0
APP_SECRET=benchmark_httparena_secret
DATABASE_URL=pgsql://bench:bench@localhost:5432/benchmark
DEFAULT_URI=http://localhost
9 changes: 9 additions & 0 deletions frameworks/symfony-spawn-tas/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/test/*
/var/
/vendor/
/.env.local
/.env.local.php
/.env.*.local
/public/bundles/
/public/build/
/node_modules/
32 changes: 32 additions & 0 deletions frameworks/symfony-spawn-tas/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM trueasync/php-true-async:0.7.0-alpha.14-php8.6-alpine

RUN apk add --no-cache git openssh-client

RUN printf '%s\n' \
'opcache.jit=1255' \
'opcache.jit_buffer_size=128M' \
'opcache.memory_consumption=256' \
'opcache.max_accelerated_files=10000' \
'opcache.validate_timestamps=0' \
'memory_limit=1024M' \
> /etc/php.d/99-arena.ini

# Install composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer

WORKDIR /app

COPY composer.json ./

RUN APP_ENV=prod COMPOSER_MAX_PARALLEL_HTTP=1 composer install --no-dev --optimize-autoloader --no-scripts --no-interaction

COPY . .

RUN APP_ENV=prod APP_DEBUG=0 APP_SECRET=benchmark \
DATABASE_URL=pgsql://bench:bench@localhost:5432/benchmark \
DEFAULT_URI=http://localhost \
php bin/console cache:warmup || true

EXPOSE 8080 8443

CMD ["php", "/app/public/index.php"]
88 changes: 88 additions & 0 deletions frameworks/symfony-spawn-tas/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"type": "project",
"license": "MIT",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.6",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-pcntl": "*",
"ext-pdo": "*",
"doctrine/dbal": "^4.4",
"doctrine/doctrine-bundle": "^2.18",
"symfony/console": "7.4.*",
"symfony/dotenv": "7.4.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.4.*",
"symfony/runtime": "7.4.*",
"symfony/yaml": "7.4.*",
"yangusik/symfony-spawn": "*"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.4.*"
},
"runtime": {
"class": "Spawn\\Symfony\\Runtime\\TrueAsyncRuntime",
"options": {
"listeners": [
{"host": "0.0.0.0", "port": 8080, "tls": false},
{"host": "0.0.0.0", "port": 8081, "tls": true, "protocol": "http1"},
{"host": "0.0.0.0", "port": 8443, "tls": true, "protocol": "auto"}
],
"static_handlers": [
{
"prefix": "/static/",
"root": "/data/static",
"precompressed": ["br", "gzip"],
"etag": true,
"open_file_cache": [1024, 60],
"on_missing": "next"
}
],
"workers": 0,
"compression": true,
"max_body_size": 33554432
}
}
}
}
7 changes: 7 additions & 0 deletions frameworks/symfony-spawn-tas/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Spawn\Symfony\TrueAsyncBundle::class => ['all' => true],
];
7 changes: 7 additions & 0 deletions frameworks/symfony-spawn-tas/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
doctrine:
dbal:
driver_class: Spawn\Symfony\Database\TrueAsyncPgsqlDriver
url: '%env(DATABASE_URL)%'
server_version: '17'
use_savepoints: true

6 changes: 6 additions & 0 deletions frameworks/symfony-spawn-tas/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
framework:
secret: '%env(APP_SECRET)%'
http_method_override: false
handle_all_throwables: true
php_errors:
log: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
true_async:
db_pool:
enabled: true
min: 4
max: 64
healthcheck_interval: 30
5 changes: 5 additions & 0 deletions frameworks/symfony-spawn-tas/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute
7 changes: 7 additions & 0 deletions frameworks/symfony-spawn-tas/config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
_defaults:
autowire: true
autoconfigure: true

App\:
resource: '../src/'
25 changes: 25 additions & 0 deletions frameworks/symfony-spawn-tas/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"display_name": "symfony-spawn-tas",
"language": "PHP",
"type": "tuned",
"engine": "C",
"description": "Symfony with symfony-spawn bundle: coroutine-per-request isolation via TrueAsync PHP core, Doctrine DBAL connection pooling, and TrueAsyncServer.",
"repo": "https://github.com/yangusik/symfony-spawn",
"enabled": true,
"tests": [
"baseline",
"pipelined",
"limited-conn",
"json",
"json-comp",
"json-tls",
"upload",
"static",
"static-h2",
"baseline-h2",
"async-db"
],
"maintainers": [
"YanGusik"
]
}
9 changes: 9 additions & 0 deletions frameworks/symfony-spawn-tas/public/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

use App\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
Loading