From d522086e04aa44408c2f03c428a3445724dac892 Mon Sep 17 00:00:00 2001 From: Mateusz Charytoniuk Date: Fri, 5 Jun 2026 15:20:23 +0200 Subject: [PATCH 1/2] cap http server worker counts to bound open file descriptors --- paddler_balancer/src/compatibility/openai_service/mod.rs | 4 ++++ paddler_balancer/src/inference_service/mod.rs | 4 ++++ paddler_balancer/src/management_service/mod.rs | 4 ++++ paddler_balancer/src/web_admin_panel_service/mod.rs | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/paddler_balancer/src/compatibility/openai_service/mod.rs b/paddler_balancer/src/compatibility/openai_service/mod.rs index d26fefe1..5466d3c9 100644 --- a/paddler_balancer/src/compatibility/openai_service/mod.rs +++ b/paddler_balancer/src/compatibility/openai_service/mod.rs @@ -70,6 +70,9 @@ use crate::create_cors_middleware::create_cors_middleware; use crate::http_route as common_http_route; use crate::inference_service::configuration::Configuration as InferenceServiceConfiguration; +// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. +const HTTP_WORKERS: usize = 16; + pub struct OpenAIService { pub buffered_request_manager: Arc, pub inference_service_configuration: InferenceServiceConfiguration, @@ -106,6 +109,7 @@ impl Service for OpenAIService { .configure(http_route::post_chat_completions::register) .configure(http_route::post_responses::register) }) + .workers(HTTP_WORKERS) .shutdown_signal(async move { shutdown.cancelled().await; }) diff --git a/paddler_balancer/src/inference_service/mod.rs b/paddler_balancer/src/inference_service/mod.rs index abaa2df5..67955249 100644 --- a/paddler_balancer/src/inference_service/mod.rs +++ b/paddler_balancer/src/inference_service/mod.rs @@ -24,6 +24,9 @@ use crate::inference_service::configuration::Configuration as InferenceServiceCo #[cfg(feature = "web_admin_panel")] use crate::web_admin_panel_service::configuration::Configuration as WebAdminPanelServiceConfiguration; +// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. +const HTTP_WORKERS: usize = 16; + pub struct InferenceService { pub agent_controller_pool: Arc, pub balancer_applicable_state_holder: Arc, @@ -85,6 +88,7 @@ impl Service for InferenceService { .configure(http_route::api::post_generate_embedding_batch::register) .configure(http_route::api::ws_inference_socket::register) }) + .workers(HTTP_WORKERS) .shutdown_signal(async move { shutdown.cancelled().await; }) diff --git a/paddler_balancer/src/management_service/mod.rs b/paddler_balancer/src/management_service/mod.rs index 7316f005..60298965 100644 --- a/paddler_balancer/src/management_service/mod.rs +++ b/paddler_balancer/src/management_service/mod.rs @@ -39,6 +39,9 @@ fn collect_web_admin_panel_cors_allowed_hosts( .collect() } +// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. +const HTTP_WORKERS: usize = 2; + pub struct ManagementService { pub agent_controller_pool: Arc, pub balancer_applicable_state_holder: Arc, @@ -118,6 +121,7 @@ impl Service for ManagementService { .configure(http_route::api::ws_agent_socket::register) .configure(http_route::get_metrics::register) }) + .workers(HTTP_WORKERS) .shutdown_signal(async move { shutdown.cancelled().await; }) diff --git a/paddler_balancer/src/web_admin_panel_service/mod.rs b/paddler_balancer/src/web_admin_panel_service/mod.rs index 25a9592d..40afcd94 100644 --- a/paddler_balancer/src/web_admin_panel_service/mod.rs +++ b/paddler_balancer/src/web_admin_panel_service/mod.rs @@ -16,6 +16,9 @@ use trzcina::ServiceShutdownOptions; use crate::web_admin_panel_service::app_data::AppData; use crate::web_admin_panel_service::configuration::Configuration as WebAdminPanelServiceConfiguration; +// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. +const HTTP_WORKERS: usize = 2; + pub struct WebAdminPanelService { pub configuration: WebAdminPanelServiceConfiguration, pub shutdown_options: ServiceShutdownOptions, @@ -41,6 +44,7 @@ impl Service for WebAdminPanelService { .configure(http_route::static_files::register) .configure(http_route::home::register) }) + .workers(HTTP_WORKERS) .shutdown_signal(async move { shutdown.cancelled().await; }) From 88cfbac514f983e0b02a6e24180c5f413070c577 Mon Sep 17 00:00:00 2001 From: Mateusz Charytoniuk Date: Fri, 5 Jun 2026 15:37:19 +0200 Subject: [PATCH 2/2] drop explanatory comments from http worker consts --- paddler_balancer/src/compatibility/openai_service/mod.rs | 1 - paddler_balancer/src/inference_service/mod.rs | 1 - paddler_balancer/src/management_service/mod.rs | 1 - paddler_balancer/src/web_admin_panel_service/mod.rs | 1 - 4 files changed, 4 deletions(-) diff --git a/paddler_balancer/src/compatibility/openai_service/mod.rs b/paddler_balancer/src/compatibility/openai_service/mod.rs index 5466d3c9..30fb0c7e 100644 --- a/paddler_balancer/src/compatibility/openai_service/mod.rs +++ b/paddler_balancer/src/compatibility/openai_service/mod.rs @@ -70,7 +70,6 @@ use crate::create_cors_middleware::create_cors_middleware; use crate::http_route as common_http_route; use crate::inference_service::configuration::Configuration as InferenceServiceConfiguration; -// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. const HTTP_WORKERS: usize = 16; pub struct OpenAIService { diff --git a/paddler_balancer/src/inference_service/mod.rs b/paddler_balancer/src/inference_service/mod.rs index 67955249..f96f5a70 100644 --- a/paddler_balancer/src/inference_service/mod.rs +++ b/paddler_balancer/src/inference_service/mod.rs @@ -24,7 +24,6 @@ use crate::inference_service::configuration::Configuration as InferenceServiceCo #[cfg(feature = "web_admin_panel")] use crate::web_admin_panel_service::configuration::Configuration as WebAdminPanelServiceConfiguration; -// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. const HTTP_WORKERS: usize = 16; pub struct InferenceService { diff --git a/paddler_balancer/src/management_service/mod.rs b/paddler_balancer/src/management_service/mod.rs index 60298965..a89731db 100644 --- a/paddler_balancer/src/management_service/mod.rs +++ b/paddler_balancer/src/management_service/mod.rs @@ -39,7 +39,6 @@ fn collect_web_admin_panel_cors_allowed_hosts( .collect() } -// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. const HTTP_WORKERS: usize = 2; pub struct ManagementService { diff --git a/paddler_balancer/src/web_admin_panel_service/mod.rs b/paddler_balancer/src/web_admin_panel_service/mod.rs index 40afcd94..6c9915d1 100644 --- a/paddler_balancer/src/web_admin_panel_service/mod.rs +++ b/paddler_balancer/src/web_admin_panel_service/mod.rs @@ -16,7 +16,6 @@ use trzcina::ServiceShutdownOptions; use crate::web_admin_panel_service::app_data::AppData; use crate::web_admin_panel_service::configuration::Configuration as WebAdminPanelServiceConfiguration; -// Capped to bound open file descriptors; macOS defaults to a 256 soft FD limit. const HTTP_WORKERS: usize = 2; pub struct WebAdminPanelService {