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

erstevn's avatar

Does Laravel tend to be much more slower than Node JS?

Does Laravel tend to be much more slower than Node JS? Or is it just me that doesn't know that Laravel have certain limiter or anything when runs in local machine (even though using production environment on the .env), both server by using built in webserver (artisan serve and node command).

I'm using basic landing page of laravel starter page runs on both Node JS (Express) and Laravel 10 (both are freshly installed and cloned to my device). Both renders the same page HTML of Laravel starter page, the welcome.blade.php and the index.html. But when i try to test the load by using wrk, it shows huge difference:

Laravel WRK test

$ wrk -c 200 -d 10s -t 8 http://localhost:8000
Latency ~1.27s
Req/s ~28.41rps
1448 requests in 10s, 39.56MB read

NodeJS Express WRK test

$ wrk -c 200 -d 10s -t 8 http://localhost:3000
Latency ~50.03ms
Req/s ~500.78rps
39887 requests in 10s, 1.28GB read

I don't know what is the problem, because both are freshly installed framework, or does Laravel responsible doing this limiting requests? Or am I missing something?

0 likes
7 replies
MohamedTammam's avatar

NodeJS load the app on the memory and execute it for every request.

PHP load the app on memory for each request. That makes NodeJS faster. But there're some tools to server PHP apps from the memory, but since the PHP community doesn't do that a lot, you need to watch for memory leaks because package developers assume that the memory will be freed after each request.

With that approach you will find out PHP is faster than NodeJS.

For me, I don't care about scaling HTTP layer since mostly the app will hit database limit before that, then team management, then amenability, etc. it's hard to hit HTTP limit even with PHP loads the app in memory for each request.

https://twitter.com/aschmelyun/status/1548270721964462081

1 like
erstevn's avatar

@MohamedTammam Ok i found out that the blade view components caching doesn't make so much difference because if I change to json response, it's faster than rendering blade components. I don't know how the blade component views caching works? Because i think it produces same RPS

MohamedTammam's avatar

@erstevn I didn't mention JSON. blade is being converted to PHP, when you cache it to save the time of converting blade to PHP for every request. The real difference comes when you try serving PHP using a tool openswoole that store the app in the memory only once for all requests.

And even with that, the difference will be reduced once you connect to the database and do real world scenarios. As I mentioned, mostly you're going to hit database bottleneck before HTTP limit.

jlrdw's avatar

I believe the architecture of node makes it faster. But use each tool as needed.

Tray2's avatar

You are using php artisan serve which starts a single threaded web server. This means that it handles one request at a time, and you are trying to run as many as you can for ten seconds. To make the comparison fair you need to set up a LEMP or LAMP stack.

1 like
erstevn's avatar

@Tray2 i actually trying to use customized sail for production also for testing this particular problem. And yet it still have low rps. But i'm gonna try answer from @mohamedtammam first, might be change the results

Snapey's avatar

@erstevn if you run artisan serve you are only testing the speed of php's built in web server, so your comparisons are not relevant

You are probably also comparing booting laravel and serving the blade files of its homepage with a static copy of its homepage, which again is a nonsense comparison

Please or to participate in this conversation.