Slide 1

Slide 1 text

1 1

Slide 2

Slide 2 text

Alternative PHP-Server FrankenPHP PHP App Server Open Swoole programmatic Server for PHP with Async IO, Coroutines and Fibers RoadRunner high-performance PHP application server, load- balancer, and process manager 2 2 Christian Münch Christian Münch

Slide 3

Slide 3 text

Traditionelle PHP-Runtime Apache, NGINX, mod_php, PHP-FPM, PeachPie, HHVM, Phalanger, ... Was ist der Vorteil des klassischen LAMP Stack? Warum werden alternative PHP- Laufzeitumgebungen immer wichtiger? 3 3 Christian Münch Christian Münch

Slide 4

Slide 4 text

4 4

Slide 5

Slide 5 text

5 5

Slide 6

Slide 6 text

FrankenPHP Fakten Kévin Dunglas (Symfony Core Team, API Platform) Ist in golang geschrieben -> Single Binary Basiert auf dem Caddy Webserver Es gibt ein statisches und ein Docker Setup Es gibt einen Worker-Mode 6 6 Christian Münch Christian Münch

Slide 7

Slide 7 text

FrankenPHP Statisches Setup 7 7 Christian Münch Christian Münch

Slide 8

Slide 8 text

FrankenPHP Docker Setup 8 8 Christian Münch Christian Münch

Slide 9

Slide 9 text

WordPress Image (deprecated) 9 9 Christian Münch Christian Münch

Slide 10

Slide 10 text

FrankenPHP WordPress Image Beispiel Ein besseres Beispiel: https://github.com/StephenMiracle/frankenwp/blob/ main/examples/basic/compose.yaml 10 10 Christian Münch Christian Münch

Slide 11

Slide 11 text

11 11

Slide 12

Slide 12 text

Benchmark mit ApacheBench 12 12

Slide 13

Slide 13 text

Symfony mit FrankenPHP 13 13 Christian Münch Christian Münch

Slide 14

Slide 14 text

FrankenPHP Worker Mode https://frankenphp.dev /do cs/wo rker / 14 14

Slide 15

Slide 15 text

15 15

Slide 16

Slide 16 text

Open Swoole HTTP, WebSocket, MQTT, gRPC, TCP/UDP - Server Async, Coroutines, Fibers Nachteile: Memory und Resource Leaks (stateless vs. stateful) Problematisch: $_GET, $_POST, $_COOKIE, $_SESSION, ... Debugging 16 16 Christian Münch Christian Münch

Slide 17

Slide 17 text

Open Swoole Setup 17 17 Christian Münch Christian Münch

Slide 18

Slide 18 text

Open Swoole Code Beispiel 18 18 Christian Münch Christian Münch

Slide 19

Slide 19 text

Callbacks 19 19 Christian Münch Christian Münch

Slide 20

Slide 20 text

Websocket 20 20 Christian Münch Christian Münch

Slide 21

Slide 21 text

TCP Server 21 21 Christian Münch Christian Münch

Slide 22

Slide 22 text

Dockerfile 22 22

Slide 23

Slide 23 text

Test Client 23 23 Christian Münch Christian Münch

Slide 24

Slide 24 text

PSR Support https://www.php-fi g.o rg /p sr/ psr -1 5/ 24 24

Slide 25

Slide 25 text

Beispiel: Adobe Commerce GraphQL Server https://developer.adob e .co m/co mme rce /p hp /d evel o p me n t/ co mp o ne n t s/a p p- se rve r/ 25 25 Christian Münch Christian Münch

Slide 26

Slide 26 text

Christian Münch Christian Münch 26 26

Slide 27

Slide 27 text

RoadRunner High-performance PHP-to-Golang IPC bridge Persistente PHP-Worker Prozesse Langzeitstabilität (Logik zum automatischen Neustart von Workern) RoadRunner ist selbst ein PHP Prozessmanager Hochskalierbar Hat alles was ein moderner App-Server braucht Websockets, HTTP/2, gRPC, TCP ... 27 27 Christian Münch Christian Münch

Slide 28

Slide 28 text

RoadRunner Setup 28 28 Christian Münch Christian Münch

Slide 29

Slide 29 text

Konfiguration über .rr.yaml 29 29 Christian Münch Christian Münch

Slide 30

Slide 30 text

Server starten 30 30 Christian Münch Christian Münch

Slide 31

Slide 31 text

Christian Münch Christian Münch 31 31

Slide 32

Slide 32 text

Worker-Code 32 32 Christian Münch Christian Münch

Slide 33

Slide 33 text

Roadrunner App Server Features OpenTelemetry Monitoring Metriken (Prometheus) Health Checks Temporal.io Workflow Engine Enterprise Queue Support (AMQP, Kafka, Redis, NATS, SQS, Beantalk, ...) Key-Value Store (Redis, Memcached, ...) 33 33 Christian Münch Christian Münch

Slide 34

Slide 34 text

34 34

Slide 35

Slide 35 text

Beispiel: Key/Value Store 35 35 Christian Münch Christian Münch

Slide 36

Slide 36 text

Go Middleware für "PHP App" 36 36 Christian Münch Christian Münch

Slide 37

Slide 37 text

Benchmarks Stand: 17. Januar 2024 https://dev.to/di mdev /p e rfo rm an ce -be n chma rk- of- p hp- runt i me s-2l mc 37 37

Slide 38

Slide 38 text

Q&A Was für Erfahrungen habt ihr mit alternativen PHP- Servern gemacht? Würdet ihr FrankenPHP, Swoole oder RoadRunner für euer nächstes Projekt verwenden? Nutzt ihr andere PHP Lösungen? Braucht ihr die Performance? Welche Fragen habt ihr noch? Beleibt neugierig! 38 38 Christian Münch Christian Münch