FrankenPHP OPcache JIT &amp; Preloading for Laravel | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    FrankenPHP, OPcache JIT, and Preloading: Maximising Laravel Throughput        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)

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

  #laravel   #frankenphp   #performance   #opcache   #php  

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

     30 Sep 2026      2 min read    ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)  Mohamed Said  

       Table of contents

1. [  01   Why FrankenPHP Changes the Performance Equation  ](#why-frankenphp-changes-the-performance-equation)
2. [  02   OPcache Tuning Baseline  ](#opcache-tuning-baseline)
3. [  03   Preloading the Laravel Framework  ](#preloading-the-laravel-framework)
4. [  04   JIT: Tracing vs Function Mode  ](#jit-tracing-vs-function-mode)
5. [  05   FrankenPHP Worker Mode Configuration  ](#frankenphp-worker-mode-configuration)
6. [  06   Deployment Considerations  ](#deployment-considerations)
7. [  07   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
