Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

radu-balta's avatar

Laravel on docker

Hello!

I'm using Laravel in a container on docker on windows with a TTFB of ~6s.

First thing: do not suggest WSL. It's the same TTFB of ~6s, with files on the WSL subsystem not windows.

Second thing:

I found this using die():

<?php
/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

define('LARAVEL_START', microtime(true));

require __DIR__.'/../../application/vendor/autoload.php';

$app = require_once __DIR__.'/../../application/bootstrap/app.php';

#die(); <-- TTFB 1.72s
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

#die(); <-- TTFB 2.67s

$kernel->terminate($request, $response);

#die(); <-- TTFB 2.74s

#if there is no die in the file then TTFB is ~6s

Why when i use die() after terminate() i have a TTFB of ~2.5s and without die() TTFB of ~6s?

0 likes
3 replies
s4muel's avatar

do you have the application code in the shared directory between host (windows) and the container? if so, there is terrible I/O performance. terrible. one way (but not the way i like) to make it better, is not to serve the app from the folder directly, but make a cron to r-sync the application files from the shared folder to a local-only folder. it sucks.

have a look at this video, may be you can find something out: https://www.youtube.com/watch?v=dxvSCAgnsKc

s4muel's avatar

i did, what makes you think i suggested WSL?

Please or to participate in this conversation.