Category: NodeJS
-
SetInterval ref and unref in NodeJS
A NodeJS process is alive as along as it has some events and callbacks that are to be processed. So if we have a simple setInterval function in a file, it means the node processor has always some events to be processed periodically. Simply adding this line will make the node run this script file […]
-
Difference between process.nextTick and setImmediate in NodeJS
In a funny deviation from what the name suggests, setImmediate is a callback that will be made after the nextTick() calls! The setImmediate by definition happens after current execution and after timer & I/O events, while the process.nextTick calls will be called after current script execution and before other timer & I/O Events! So an […]
-
What is process.nextTick in NodeJS?
The process.nextTick serves for the design logic where for one, events that are generated by while initialising or creating an object is not generated before the caller has registered listeners for those. Now considering the above case, there is a possible that the disk reader is just for a specific case reading from cache and […]
-
Handling POSIX SIGNALS in NodeJS (Javascript!)
NodeJS, built over the v8 Engine, which is essentially C/C++ application, exposes much if not all of the POSIX signals to the Javascript layer. Hence we can have multiple options coming out of design of architecture using these SIGNALing and SIGNAL Handling possibilities. A few noteworthy things that we can think of from the top […]
-
Difference between console.log and process.stdout.write in NodeJS
NodeJS can print a string to terminal using two ways. The well known console.log as in chrome and the lesser-known process.stdout.write way. Both have the same usage params. While you find console.log ends the line thats printed, the other does not. So which is good to use? The console.log is implemented in the NodeJS Core […]
-
Nodejs process – Is it always single threaded? How efficient is it?
A NodeJS process as we have come to know is considered and is, a programmatically single thread of execution. But that said, we also have complex and complicated system/workflows running in NodeJS without any problem. So How does this work? The MultiThread behind! The NodeJS is nothing but javascript running over the v8 engine of […]
-
Managing/Controlling Garbage collection in Node Process
NodeJS processes have automatic Garbage collection routine calls, but its aggressive by default and it will always try to use the slightest of idle time and this can lead to some performance drawbacks for certain applications. In such a case its good to use –-nouse_idle_notification flag while starting node process. What this does is instruct […]
-
How NodeJS Works? What is v8 Engine?
When Ryan Dahl started working on Node, and identifying the right language for creating this piece of software for making scalable server architectures, Javascript may not be the first language of choice. But the modularity, event-driven, asynchronous and concurrency-enabled language that javascript is quite surely fit the bill for his expectations and now javascript has […]