I
I
IDONTSUDO2019-06-22 14:25:03
PHP
IDONTSUDO, 2019-06-22 14:25:03

PHP NODEJS Why such a noticeable difference in speed?

My Node js server responds in an average of 8:ms. During this time, it manages to log the request, validate the JWT, go to mongoDB, pull out the data and give it back.
Whereas the server on laravel responds in about 352 ms, on average. At the same time, the work of Laravel is almost the same as that of nodejs. The only difference is that laravel enters MySQL (but at the time of measurement, there was no data in mySQL, and the query took 0.0 ms)
Why such a difference?
PS. I measure everything on my local machine.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2019-06-22
@IDONTSUDO

in php, for each request, bootstrapping occurs every time, that is, a new process starts and initializes every time. and the node runs once and starts its webserver.
test on local - maybe xdebug is also enabled - it will also slow down.
thirdly, on the ssd disk, the results of php can be better (if not already used).

A
Alexey Skobkin, 2019-06-22
@skobkin

Have you compared the node.js code with the request-response-death or Event Loop PHP code?
Because in node.js, you most likely had code written in a different paradigm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question