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

kazilotus's avatar

Laravel web request getting queued ?

I have been coding in php for a long time but am new to laravel, from what i have always known, executing multiple separate instance of a php script will always run independent of each other,

// test.php
sleep('25');
root@ubuntu:/# time curl http://localhost/test.php

real    0m25.971s
user    0m0.236s
sys     0m0.088s

root@ubuntu:/# time curl http://localhost/test.php

real    0m25.799s
user    0m0.216s
sys     0m0.036s

So the script above ran as expected, but in laravel

Route::get('/test', function() {
    sleep('25');
});
// Both of these were run in seperate teminals simultaneously

root@ubuntu:/# time curl http://localhost:8080/test

real    0m25.971s
user    0m0.236s
sys     0m0.088s

root@ubuntu:/# time curl http://localhost:8080/test

real    0m52.526s // Took double time to execute
user    0m0.016s
sys     0m0.000s

the web requests are getting queued, which doesnt make any sense to me at all. Is this some feature in laravel that I'm not aware of ? If so, how do I fix it ? I don't want them to get queued.

0 likes
3 replies
usman's avatar
usman
Best Answer
Level 27

@kazilotus It is because you are using artisan serve command which uses the php builtin server that is single threaded. If you were using a web server instead then you would have gotten the expected results instead.

kazilotus's avatar

@usman Oh god!! Thank you for the clarification!! totally makes sense now.

Please or to participate in this conversation.