Lets suppose I have my app running on machine A, at some point I need to shut down that machine, and transfer my app to machine B to continue its process. so I need to be able to save and restore context of my app. How can implement that?To be more specific, my question is: How can I save/restore application context in node.js?
How to transfer contexts among separate node.js environments?
node.js
There are two ways to do this:Send a shutdown message to your app on Machine A; refuse new clients, wait for existing requests to wind down, close the app, and spin it up on machine B, orSend a freeze message to your app on Machine A; refuse new clients, suspend all activities, serialize the state of all activities to disk, close the app, restart the app on machine b.  Send an unfreeze message to your new app instance, which will re-hydrate the existing activities and resume them.Option 1 is by far the simplest and most reliable choice, as it only requires you to stop accepting requests and detect when there are no more tasks to process.