I'm using PM2 cluster module to spawn an instance of my Node.js application for each one of my CPU cores. At the sime time, for CPU-heavy operations (like crypto) I'm using Piscina (a worker pool library module for Node.js, which is based on Node.js worker threads module).
Basically, I create a Piscina instance with some worker threads and call it for crypto operations everytime I hit an specific API.
Could this be inefficient in terms of memory usage, given that I create a worker pool for each one of my app instances? What is the most efficient way to use worker threads and Node.js cluster module at the same time?