Node is increasingly being used by more companies both large and small. Some of the large tech companies using Node are LinkedIn, Paypal, NetFlix and Ebay. It is therefore important for Node applications to be scalable. Wonder why Node.js application is scalable? Here are some of the reasons.
If you find yourself asking why node.js application is scalable?, one of the major reasons is asynchronous processing. The main design principle which makes apps made in Node scalable is processing requests asynchronously. Whenever there is any background activity than needs to be handled for a request, Node delegates the required work e.g. File I/O or network I/O and goes on to handle another request, providing non-blocking I/O. Once the work is done, Node passes the processed data to the client.
Single threading in handling requests
Almost all other platforms create new threads for each request. This can reduce performance and cause scalability issues. This is due to factors such as thread initialization and termination overhead. Node differs from other platform such as PHP, J2EE and .NET in that a single thread handles client requests.
For any client request, Node listens to requests, hands over work to worker threads and is ready to accept new requests. Once the worker threads are done processing, the worker threads return their results to the main thread. The results can be sent to the request and processed further. This mean there is no context switching and makes it great for applications that are highly concurrent.
By now, you are better versed in some of the reasons Node is great. Specifically, you now have answers to the question “why node.js application is scalable?”
[vc_row][vc_column][td_block_21 separator=”” tag_slug=”node-js” limit=”40″ tdc_css=””][/vc_column][/vc_row]