A Chinese tech forum post explains why traditional PHP (Nginx/Apache + PHP-FPM) pays a framework bootstrap cost on every request due to its Share-Nothing model, and how FrankenPHP—an application server built on Caddy with an embedded PHP runtime, written in Go—eliminates that cost via Worker Mode, where the Laravel application boots once and stays resident in memory. The author walks through migrating Laravel with Laravel Octane (composer require laravel/octane; php artisan octane:install; php artisan octane:start --server=frankenphp), covers deployment options including FrankenPHP's standalone binary and Docker images, and details the key pitfall of long-lived processes: static properties, singletons, and global state leaking between requests. Mitigations include separating process-level from request-level state, setting max_requests to periodically recycle workers, monitoring memory growth, and maintaining graceful reload, rollback, and observability practices. Benchmarking guidance focuses on RPS and P95/P99 tail latency. Worker Mode benefits are largest for lightweight, high-volume APIs; slow SQL and external calls remain unaffected.
FrankenPHP Worker Mode with Laravel Octane: Stop Rebuilding Your App on Every Request
Summary
A Chinese tech forum post explains why traditional PHP (Nginx/Apache + PHP-FPM) pays a framework bootstrap cost on every request due to its Share-Nothing model, and how FrankenPHP—an application server built on Caddy with an embedded PHP runtime, written in Go—eliminates that cost via Worker Mode, where the Laravel application boots once and stays resident in memory. The author walks through migrating Laravel with Laravel Octane (composer require laravel/octane; php artisan octane:install; php artisan octane:start --server=frankenphp), covers deployment options including FrankenPHP's standalone binary and Docker images, and details the key pitfall of long-lived processes: static properties, singletons, and global state leaking between requests. Mitigations include separating process-level from request-level state, setting max_requests to periodically recycle workers, monitoring memory growth, and maintaining graceful reload, rollback, and observability practices. Benchmarking guidance focuses on RPS and P95/P99 tail latency. Worker Mode benefits are largest for lightweight, high-volume APIs; slow SQL and external calls remain unaffected.
This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/177168645