From be897ed6c54f27ac36789f95bfa563fbcb05812e Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 14 Apr 2025 11:18:40 +1000 Subject: [PATCH] chore(gateway): require 4 cores to spawn more TUN threads (#8775) By default, we spawn 1 TUN send and 1 TUN receive thread on the Gateway. In addition to that, we also have the main processing thread that encrypts and decrypts packets. With #7590, we will be separating out the UDP send and receive operations into yet another thread. As a result, we will have at a minimum 4 threads running that perform IO or important work. Thus, in order to benefit from TUN multi-queue, we need more than 4 cores to be able to efficiently parallelise work. Related: #8769 --- rust/gateway/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/gateway/src/main.rs b/rust/gateway/src/main.rs index f2f2582e9..a32d98de9 100644 --- a/rust/gateway/src/main.rs +++ b/rust/gateway/src/main.rs @@ -261,7 +261,7 @@ struct NumThreads(pub usize); impl Default for NumThreads { fn default() -> Self { - if num_cpus::get() < 2 { + if num_cpus::get() < 4 { return Self(1); }