FrankenPHP JIT &amp; Preloading for Laravel Throughput | 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: Squeezing Real Throughput from Laravel

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

 FrankenPHP embeds PHP directly into a Go server, unlocking worker mode, JIT compilation, and preloading in one binary. Here is how to configure each layer correctly for a production Laravel app.

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

ShareCopy linkCopied

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

  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)

 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
