From e64af6260a512a9e6eaed8bc8c48f0222c39afb2 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Wed, 28 Sep 2022 10:46:29 -0700 Subject: feat(ext/flash): add `reuseport` option on Linux (#16022) --- cli/bench/http/deno_http_flash_spawn.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 cli/bench/http/deno_http_flash_spawn.js (limited to 'cli/bench/http/deno_http_flash_spawn.js') diff --git a/cli/bench/http/deno_http_flash_spawn.js b/cli/bench/http/deno_http_flash_spawn.js new file mode 100644 index 000000000..eb827b34b --- /dev/null +++ b/cli/bench/http/deno_http_flash_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.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); -- cgit v1.2.3