In the field of Software Engineering you may be accustomed to the various options provided in the field, There are so many frameworks and languages. There are all kinds of packages to install. However once somebody becomes comfortable they may hesitate to give other ones a chance, some pounce at the opportunity while others may shy away. With all that in mind id love to inform you all about NodeJS.
What is NodeJS?
Node is often used to build back end services that communicate with client side applications. The applications receive and send data using the backends API. An API is an application programming interface that defines the interactions between multiple software applications or mixed hardware-software intermediaries. In layman's terms it serves as an interface between different programs so they can communicate.
To my surprise and maybe yours some of the biggest and leading companies in the world use Node for their backend. These companies include Linkedin, Netflix, Uber , NASA , eBay and Paypal. Obviously these aren't all of them but the ones I felt confident you may have heard of at least.
Input and Output
Input and output is referring to accessing to anything outside of the application. Once an application is running , it loads into the machines memory. That is what the CPU will mostly use when running your program.
Node makes Asynchronous, non-blocking servers, which only use one thread to service all requests. This means an instance of Node makes the most out of a single thread. This means the server can serve a lot of request without requiring more server hardware; an economical pro.
When requests arrive at the server, they are serviced one at a time. However, when the code serviced needs to query the DB for example, it sends the callback to a second queue and the main request continues to run; it doesn’t wait. Now when the DB operation completes and returns, the corresponding callback is pulled out of the second queue and queued in a third queue where they are pending execution. When the engine gets a chance to execute something else, it picks up a callback from the third queue and executes it.
Blocking (Input/Output Synchronous)
Synchronous blocking operations is how some web servers, handle IO or network requests by default. Code reads from a file or database, your code then“blocks” everything after it from executing until that first request is finished. In that period, your machine is holding onto memory and processing time for a thread that is idle.
While the thread is stalled to carter other requests depends on your software. Most server software spawns more threads to handle the additional requests. Causing more memory and processing to be consumed.
I am not saying other types of frameworks can’t run code asynchronously, but you have to write more code to make it happen. Node runs asynchronously by default.
Give Node a chance ?!