Introduction to Isolated-VM in Node.js

#101 · ✸ 20 · 💬 3 · 2 years ago · docs.temporal.io · swyx · 📷
Temporal's Node SDK makes heavy use of V8 isolates via the isolated-vm npm package to ensure your Workflows are deterministic. In this blog post, I'll cover why the Node SDK V8 isolates, sketch out how the Node SDK uses isolates, and describe what that means for how you write Workflows in Node.js. The Temporal Node SDK runs your Workflow code in an isolate to remove sources of non-determinism. That's how the Temporal Node SDK ensures Workflows can't interfere with each other. How does the Temporal Node SDK handle overwriting the Date() constructor? The Temporal Node SDK compiles your Workflows with Webpack and creates an entry script that overrides Date() before your Workflow starts. The Temporal Node SDK runs Workflows in a subset of Node.js that has several globals stubbed out, including Math.random(), Date(), setTimeout(), and clearTimeout(). Workflow determinism is a critical assumption in Temporal, so making it impossible to accidentally break Workflow determinism is a major benefit of the Temporal Node SDK..
Introduction to Isolated-VM in Node.js



Send Feedback | WebAssembly Version (beta)