From c5ba8e60abb0993f3a5086c58a69e712405790c8 Mon Sep 17 00:00:00 2001 From: Yadunund Date: Tue, 23 Jan 2024 10:12:37 +0800 Subject: [PATCH] Add threads limit to router config Signed-off-by: Yadunund --- .../config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 index 6c05669e..f20b002d 100644 --- a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 +++ b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 @@ -185,6 +185,16 @@ /// Higher values lead to a more aggressive batching but it will introduce additional latency. backoff: 100, }, + // Number of threads dedicated to transmission + // By default, the number of threads is calculated as follows: 1 + ((#cores - 1) / 4) + // We limit the number of threads that the zenoh session can spin to 1. + // Without this limit, applications with multiple zenoh sessions can + // encounter system resource errors when trying to create new threads. + // Once zenoh migrates to relying on tokio for its async runtime, + // see https://github.com/eclipse-zenoh/zenoh/pull/566, we can consider + // removing these flags since with tokio, zenoh can better manage the threads it spins + // with the help of thread pools. + threads: 1, }, /// Configure the zenoh RX parameters of a link rx: {