Worker Threads

  • use to perform heavy JavaScript tasks
  • use to run code in parallel
  • runs in isolation but has ability to pass information between it and the parent Worker
  • connected to parent worker via message channel
    • parentPort.postMessage() - send message to parent
    • worker.postMessage() - send message to child
  • data is clone and not in shared memory
  • best not to use for I/O operations; Node.js native I/O mechanisms are way faster

To Review