Node JS VS PHP Apache Server Backend technologies

Node JS

  • Node JS is server side scripting technology built using JavaScript, NodeJS is single threaded that means it only has one thread for a request.
  • Node JS is asynchronous where NodeJS can multi-task this quality of NodeJS made Node to come forward in the Market of Backend Web technology.

History of NodeJS

If we talk about history nodeJS was developed in 2009 Ryan Dahl and other developers in 2011 NPM that is Node Package Manager was created NPM is a dependency manager of NodeJS and it’s library After release of NodeJs and Npm there came a conflict on management of Node JS and all Open source libraries therefore in December 2014 NodeJS was Forked by IO.JS in February 2015 it was announced that a neutral NodeJS management will be created. and in June of 2015 new NodeJS foundation created. it’s made up of several large community developers including IBM, Microsoft, Paypal, drupal.

Officially on September 14 2015 NodeJs 4.0 released with a combination of NodeJS and IO.js and also included with ton of ES2015 features that is JavaScript version. now the NodeJs is stable on the release of 4.0 version. and it will be continued.

Why NodeJS is powerful than Apache server?

Let’s see with a simple but good example how Apache server is working and how Node JS working.

Apache server

Basically apache server is multi-treaded where there will be independent thread for each requests to the server. but the problem occurs when a client requests for more than one resource when the thread went for to get the resource from database server or data store.

Here in this picture as you can see there is a restaurant we’ll name it as Apache Restaurant, where there is only one waiter and a client. Here if the client requests for a salad the waiter went to bring it. that means the waiter a thread went to data-store or file system to get the resource or cook the salad in this case.

Request-Response

If the client request for water when the waiter went to bring the resource or salad in this case, the waiter will not respond the requests will be blocked this is called blocking in apache architecture. the requested thing only be served after finish of the response to last request.
so apache is synchronous. and this feature of apache will slower the performance.

NodeJS server

NodeJS server is asynchronous and single threaded that is it has only one thread for all the requests. umm,.. you might be thinking therefore NodeJS is slower because it has only one waiter in a restaurant. let’s come to that..

Single threaded

NodeJS restaurant where only one Waiter, for all clients,then how Node Manages all the requests?
yes, the Node JS however single threaded but it is Asynchronous

Speed and active

Apache Server with Many clients, if you request for something nodeJS will go to bring that resource for you, if you further request for any other resource simply node will not block your requests as Apache did, but Node JS will come at you and give you that resource. here if we have many clients also nodeJS keeps on providing resources or serving to the clients. it’ll never stop execution. so Node Js is Busy Busy Busy.. this quality of NodeJS made node popular now a days.. and many backend developers use nodeJS.

Node JS has many other features by using Node’s NPM i.e node Package Manager you can download and use Open source projects like Angular JS, React JS, Vue JS and many other javascript libraries..

In next tutorial we’ll learn how to install NodeJS and get Started with that..

Thank you for reading if you like this article please share.. to your friends colleges and relatives let other people also get to know about nodeJs and it’s goodies.. like Share comment..

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *