FrankenPHP OPcache JIT &amp; Preloading for Laravel | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. FrankenPHP, OPcache JIT, and Preloading: Maximising Laravel Throughput

 FrankenPHP, OPcache JIT, and Preloading: Maximising Laravel Throughput
=======================================================================

 A practical deep-dive into running Laravel under FrankenPHP with OPcache JIT and preloading enabled — covering worker mode, preload scripts, JIT tracing vs function modes, and the real gotchas in production.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 30 Sep 2026 · Updated 30 Sep 2026 · 2 min read

ShareCopy linkCopied

 ![FrankenPHP, OPcache JIT, and Preloading: Maximising Laravel Throughput](https://cdn.msaied.com/719/2129727c31378ebd8778814d6764bac1.png) 

  On this page +1. [Why FrankenPHP Changes the Performance Equation](#why-frankenphp-changes-the-performance-equation)
2. [OPcache Tuning Baseline](#opcache-tuning-baseline)
3. [Preloading the Laravel Framework](#preloading-the-laravel-framework)
4. [JIT: Tracing vs Function Mode](#jit-tracing-vs-function-mode)
5. [FrankenPHP Worker Mode Configuration](#frankenphp-worker-mode-configuration)
6. [Deployment Considerations](#deployment-considerations)
7. [Takeaways](#takeaways)

 Why FrankenPHP Changes the Performance Equation
-----------------------------------------------

Traditional PHP-FPM spawns a fresh process per request, discarding all compiled bytecode context between requests unless OPcache is warm. FrankenPHP's **worker mode** keeps your Laravel application bootstrapped in memory across requests — closer to Laravel Octane's model, but baked into the server itself via a Go-powered Caddy module.

Combine that with OPcache's JIT compiler and a preload script, and you eliminate three of the biggest per-request costs: file stat checks, bytecode compilation, and framework bootstrap.

---

OPcache Tuning Baseline
-----------------------

Before touching JIT, get the fundamentals right:

```ini
; php.ini / conf.d/opcache.ini
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0   ; production only
opcache.save_comments=1         ; required by Laravel annotations / docblocks
opcache.revalidate_freq=0

```

`validate_timestamps=0` is critical in production — every `stat()` call you eliminate is latency you never pay.

---

Preloading the Laravel Framework
--------------------------------

PHP 8's preloading executes a script at worker startup and pins the resulting class/function definitions into shared memory, making them available to every request without re-parsing.

Laravel ships a preload helper you can reference directly:

```ini
opcache.preload=/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
opcache.preload_user=www-data

```

For a more surgical approach, generate your own preload file with a Composer script:

```php
