diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2022-09-28 10:46:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 23:16:29 +0530 |
commit | e64af6260a512a9e6eaed8bc8c48f0222c39afb2 (patch) | |
tree | 2471772b0a9f18e61fd0e8c4b2140fb2556c5e5e /cli/bench/http/deno_http_flash_ops_spawn.js | |
parent | d677ba67f50e5edb0491d8ed1e4171473d662081 (diff) |
feat(ext/flash): add `reuseport` option on Linux (#16022)
Diffstat (limited to 'cli/bench/http/deno_http_flash_ops_spawn.js')
-rw-r--r-- | cli/bench/http/deno_http_flash_ops_spawn.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cli/bench/http/deno_http_flash_ops_spawn.js b/cli/bench/http/deno_http_flash_ops_spawn.js new file mode 100644 index 000000000..6ee39a84a --- /dev/null +++ b/cli/bench/http/deno_http_flash_ops_spawn.js @@ -0,0 +1,16 @@ +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_ops.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); |