What are the advantages of using Node.js vs PHP
77,717
Edited:
There are 2 main advantages:
- Speed! (Performance)
- Node.js is event-driven and non-blocking and very good at handling concurrent requests.
Here is a link to a benchmarking test for node.js against PHP on Apache.
Related videos on Youtube
Comments
-
overthetop almost 2 years
Possible Duplicate:
Why and When to use node js?Can someone tell me why all this fuss about node.js ? Is a regular web site (lets say a blog) written in node.js faster compared to same written in some php framework? I know that a web server written in node.js will be faster than apache but how about a real web application that doesn't create threads or something like that?
-
Rahul Chordiya about 13 yearswhy are you comparing client side script with server side script???
-
akamike about 13 years@Rahul: Node.js is server-side Javascript: nodejs.org
-
ceejayoz about 13 years@Rahul Node.js is server-side JavaScript.
-
Quentin about 13 years@Rahul — JavaScript is "a programming language" not "an exclusively client side programming language". Node.js is not designed to run inside web browsers.
-
overthetop about 13 years@rahul node.js is server side framework!
-
Twelve47 about 13 years@Rahul Node.js isn't designed to run in the browser. It isn't just straight js.
-
trusktr about 12 years@RahulChordiya Ditto what everyone said. Haha.
-
-
overthetop about 13 yearsyes i know that node.js web server is faster than apache :) so it is only the web server advantage?
-
Robin Maben about 13 yearsYes, that advantage is too cool to resist but I must also mention there's no large community support yet. So you'd have to be very daring to go with node.JS for your next project.
-
oldwizard about 13 yearsI'd say the main advantage is memory usage. If you do long-polling stuff node.js shines since it doesn't require a 100 MB Apache + PHP instance to handle each request. So if you do anything where you have many connections open at the same time - for long periods of time - go with node.js. Usually they coexist well. use node.js for updating a chat panel or similar, not to render your pages.
-
Alix Axel almost 13 yearsYou forgot to mention one of the most important features: it's non-blocking!
-
trusktr about 12 yearsA port of WordPress to Node.js would be awesome. hah
-
Nico Burns almost 11 years@trusktr tryghost.org
-
trusktr almost 11 years@NicoBurns That looks freackin' awesome.
-
trusktr almost 11 yearsIf I make a new freelance site for someone, I'll have to try Ghost.
-
Bogdan over 10 yearslast time i checked node.js can't use multi core servers.. :-) so why is that good... since php/apache can use a multi core and it's performance will be better.. :-)
-
FredTheWebGuy over 10 years@Bogdan Check again- stackoverflow.com/questions/2387724/…
-
Bogdan over 10 yearsmy bad :-) seems that i'm not good with news
-
barbushin over 10 yearsNodeJS is slower then PHP 5.5.5 + React + phpQuery see philsturgeon.co.uk/blog/2013/11/…
-
Gremio over 10 yearsAs SeniorDev eluded to, PHP can support non-blocking if you want such a thing. reactphp.org . I wouldn't say NodeJS is necessarily slower though. As Phil has pointed out in updates, increasing the max connections of NodeJS gets the two setups in his test neck and neck.
-
Rolf over 9 years@RobinMaben From my perpective memory leaks would be the biggest disadvantage with Node. Running a web app on a V8 core for days; no wonder.
-
Andy almost 8 yearsHow does node JS compare to Php on Apache/nginx when it comes to I/O operation like downloading or streaming large video files from object storage sever like S3 buckets ?
-
channasmcs over 7 yearsNormally, you write code in in Java,php,python,c# in "blocking" traditional way, that means when a tasking is executing, other tasks must wait for it to completed (in a queue) In Nodejs, the basic concept is the "non-blocking" way, that means when a tasking is executing, other tasks dont need to wait for it to completed.
-
Maaz Rehman about 7 yearsWhat about running php on Nginx ?
-
AVI over 6 yearshow about php7?
-
Abhishek Kamal almost 4 yearsWhat about in >= 2020 , PHP version 7+ uses less memory and became super fast and secured ?