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, and the real throughput gains you can expect in production.

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

ShareCopy linkCopied

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

  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)

 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
