FrankenPHP JIT &amp; Preloading for Laravel Throughput | 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: Squeezing Real Throughput from Laravel        On this page       1. [  Why FrankenPHP Changes the Equation ](#why-frankenphp-changes-the-equation)
2. [  Layer 1 — OPcache Baseline ](#layer-1-opcache-baseline)
3. [  Layer 2 — Preloading ](#layer-2-preloading)
4. [  Layer 3 — JIT ](#layer-3-jit)
5. [  Layer 4 — FrankenPHP Worker Mode ](#layer-4-frankenphp-worker-mode)
6. [  Avoiding State Leakage ](#avoiding-state-leakage)
7. [  Takeaways ](#takeaways)

  ![FrankenPHP, OPcache JIT, and Preloading: Squeezing Real Throughput from Laravel](https://cdn.msaied.com/194/a8e2a07b7147b497f75d1dffb218c4a2.png)

  #laravel   #frankenphp   #performance   #opcache   #php  

 FrankenPHP, OPcache JIT, and Preloading: Squeezing Real Throughput from Laravel 
=================================================================================

     15 Jun 2026      1 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   Why FrankenPHP Changes the Equation  ](#why-frankenphp-changes-the-equation)
2. [  02   Layer 1 — OPcache Baseline  ](#layer-1-opcache-baseline)
3. [  03   Layer 2 — Preloading  ](#layer-2-preloading)
4. [  04   Layer 3 — JIT  ](#layer-3-jit)
5. [  05   Layer 4 — FrankenPHP Worker Mode  ](#layer-4-frankenphp-worker-mode)
6. [  06   Avoiding State Leakage  ](#avoiding-state-leakage)
7. [  07   Takeaways  ](#takeaways)

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

Traditional PHP-FPM restarts the PHP runtime on every request. FrankenPHP's **worker mode** boots Laravel once, keeps it in memory, and hands each request to a long-lived worker process — the same idea as Laravel Octane, but baked into the server binary itself. Pair that with OPcache JIT and preloading and you eliminate three of the biggest per-request costs: bootstrap, compilation, and opcode caching misses.

This article focuses on the configuration layer. Getting the numbers right matters more than the concept.

---

Layer 1 — OPcache Baseline
--------------------------

Before touching JIT, make sure OPcache is tuned for a large Laravel application. The defaults are conservative.

```ini
; php.ini (or conf.d/opcache.ini)
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=32
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0   ; disable in production
opcache.save_comments=1         ; required by Laravel annotations / attributes
opcache.revalidate_freq=0

```

`validate_timestamps=0` is the single highest-impact change for production. Without it PHP stat-checks every file on every request even when OPcache is warm.

---

Layer 2 — Preloading
--------------------

Preloading compiles a set of files at worker startup and pins them in shared memory. Every worker process shares those opcodes without copying.

Create `preload.php` at the project root:

```php
