Answer the question
In order to leave comments, you need to log in
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
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).
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 questionAsk a Question
731 491 924 answers to any question