So I used to make websites. It was WordPress and php based applications. But it's been 10 years.
-
Is nodejs more complex?
-
Why nodejs is more popular these days?
In terms of running applications and websites, (speed + SEO) is nodejs much faster? Do you have to do a lot of work to make it SEO friendly/faster?
NodeJS is not ALWAYS faster than PHP
NodeJS is not ALWAYS faster than PHP
Can i make PHP as fast as Node.js?
PHP ou Node?
Videos
Not a baitclick title, but a small experiment I made based on my most frequent use-cases :
On my general usage, my backend are used as an API between DB and frontend.
So, in very basic "benchmarks", we frequently see php compared (amongst others) to NodeJS.
I made my own benchmarks, and yes, I did find the same results: serving an "Hello World" page is many times faster with NodeJS than with PHP :
Lumen : 2963 requests / sec , 16.8 ms/req
Adonis : 9011 requests / sec, 5.5 ms/req
> "Hello World" tests : yes, Node is Faster than PHP, about 3 times
But, let's get back to my use case : DB query, fetch results, return results as JSON :
I fired a quick PHP Lumen (stripped version of Laravel), which queries a table containing 31 records (worth of 10498 bytes), and benchmarked against AdonisJS (because it is the most Laravel Look-alike framework), doing the same task (query, fetch and return the same table/data) :
The test consist of querying the server 5000 requests, 50 at a time (concurrency level). Here are the results for Lumen (php) vs AdonisJS (NodeJS) :
Lumen : 1762 requests / sec , 28 ms/req
Adonis : 925 requests / sec, 54 ms/req
> "DB API" tests : PHP is Faster than NodeJS, about 2 times !
Don't get me wrong, I'm not saying that you should not use Node for APIs. Node is surely great for a bunch of tasks, and many devs can see in it a way of using the same language on front and back.
But the reason to switch from (put your language here) to NodeJS should not be "Node is faster than [anything else], I read it in the benchmarks !"
I was just about to quit php and Laravel because of this argument: I might have to rethink the whole solution !
Please feel free to share your thoughts on this !
EDIT : just a foot note : I never tried to say that PHP is better than Node or Node is slower than PHP... I just tried to say that we can't tell that in every case Node will be faster than PHP... That the kind of conclusion I found in almost all search I made about "node versus other languages"....