node-vm2

When use vm2 in worker_threads, is it possible to share a NodeVM instance between workers?

倖福魔咒の 提交于 2021-02-20 00:28:03
问题 I am using worker_threads and vm2 to implement a serverless-like thing, but I cannot get a NodeVM instance in the main thread and then pass through workData(because of worker_threads 's limitation), so I can only new NodeVM in a worker thread per request, inside which I cannot reuse a vm instance and the cost hurts. The new NodeVM() takes 200 ~ 450 ms to finish, so I wish to pre-init a reusable instance. const w = new Worker(` (async () => { const { workerData, parentPort } = require('worker

When use vm2 in worker_threads, is it possible to share a NodeVM instance between workers?

心不动则不痛 提交于 2021-02-20 00:26:33
问题 I am using worker_threads and vm2 to implement a serverless-like thing, but I cannot get a NodeVM instance in the main thread and then pass through workData(because of worker_threads 's limitation), so I can only new NodeVM in a worker thread per request, inside which I cannot reuse a vm instance and the cost hurts. The new NodeVM() takes 200 ~ 450 ms to finish, so I wish to pre-init a reusable instance. const w = new Worker(` (async () => { const { workerData, parentPort } = require('worker

When use vm2 in worker_threads, is it possible to share a NodeVM instance between workers?

蹲街弑〆低调 提交于 2021-02-20 00:25:30
问题 I am using worker_threads and vm2 to implement a serverless-like thing, but I cannot get a NodeVM instance in the main thread and then pass through workData(because of worker_threads 's limitation), so I can only new NodeVM in a worker thread per request, inside which I cannot reuse a vm instance and the cost hurts. The new NodeVM() takes 200 ~ 450 ms to finish, so I wish to pre-init a reusable instance. const w = new Worker(` (async () => { const { workerData, parentPort } = require('worker

When use vm2 in worker_threads, is it possible to share a NodeVM instance between workers?

一笑奈何 提交于 2021-02-20 00:25:13
问题 I am using worker_threads and vm2 to implement a serverless-like thing, but I cannot get a NodeVM instance in the main thread and then pass through workData(because of worker_threads 's limitation), so I can only new NodeVM in a worker thread per request, inside which I cannot reuse a vm instance and the cost hurts. The new NodeVM() takes 200 ~ 450 ms to finish, so I wish to pre-init a reusable instance. const w = new Worker(` (async () => { const { workerData, parentPort } = require('worker

When use vm2 in worker_threads, is it possible to share a NodeVM instance between workers?

本小妞迷上赌 提交于 2021-02-20 00:25:07
问题 I am using worker_threads and vm2 to implement a serverless-like thing, but I cannot get a NodeVM instance in the main thread and then pass through workData(because of worker_threads 's limitation), so I can only new NodeVM in a worker thread per request, inside which I cannot reuse a vm instance and the cost hurts. The new NodeVM() takes 200 ~ 450 ms to finish, so I wish to pre-init a reusable instance. const w = new Worker(` (async () => { const { workerData, parentPort } = require('worker