1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 09:39:08 -05:00
denoland-deno/cli/bench/http/deno_http_flash_spawn.js

16 lines
533 B
JavaScript

if (Deno.build.os !== "linux") {
throw new Error("SO_REUSEPORT is only supported on Linux");
}
const executable = Deno.execPath();
const path = new URL("./deno_http_flash.js", import.meta.url).pathname;
// single flash instance runs on ~1.8 cores
const cpus = navigator.hardwareConcurrency / 2;
const processes = new Array(cpus);
for (let i = 0; i < cpus; i++) {
const proc = Deno.run({
cmd: [executable, "run", "-A", "--unstable", path, Deno.args[0]],
});
processes.push(proc.status());
}
await Promise.all(processes);