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 Equation ](#why-frankenphp-changes-the-equation)
2. [  OPcache Preloading in Laravel ](#opcache-preloading-in-laravel)
3. [  Enabling JIT Tracing ](#enabling-jit-tracing)
4. [  FrankenPHP Worker Mode ](#frankenphp-worker-mode)
5. [  State Leakage — The Real Risk ](#state-leakage-the-real-risk)
6. [  Practical Throughput Expectations ](#practical-throughput-expectations)
7. [  Key Takeaways ](#key-takeaways)

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

  #laravel   #frankenphp   #opcache   #performance   #php  

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

     25 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   OPcache Preloading in Laravel  ](#opcache-preloading-in-laravel)
3. [  03   Enabling JIT Tracing  ](#enabling-jit-tracing)
4. [  04   FrankenPHP Worker Mode  ](#frankenphp-worker-mode)
5. [  05   State Leakage — The Real Risk  ](#state-leakage-the-real-risk)
6. [  06   Practical Throughput Expectations  ](#practical-throughput-expectations)
7. [  07   Key Takeaways  ](#key-takeaways)

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

Traditional PHP-FPM spawns a fresh process per request, discarding compiled bytecode between requests unless OPcache is warm. FrankenPHP embeds PHP directly into a Caddy-based server and, crucially, supports **worker mode** — a long-lived PHP process that boots Laravel once and handles thousands of requests before recycling. That single architectural shift makes JIT and preloading dramatically more valuable.

### OPcache Preloading in Laravel

Preloading compiles a set of PHP files into shared memory at server start. Every worker process inherits that memory map, skipping file I/O and compilation entirely for preloaded classes.

Create a preload script at `bootstrap/preload.php`:

```php
