diff --git a/deployer/src/deployment/queue.rs b/deployer/src/deployment/queue.rs index 93503e9ee..a90ca5183 100644 --- a/deployer/src/deployment/queue.rs +++ b/deployer/src/deployment/queue.rs @@ -318,8 +318,8 @@ async fn run_pre_deploy_tests( // recompiled in debug mode for the tests, reducing memory usage during deployment. compile_opts.build_config.requested_profile = InternedString::new("release"); - // Build tests with a maximum of 8 workers. - compile_opts.build_config.jobs = 8; + // Build tests with a maximum of 4 workers. + compile_opts.build_config.jobs = 4; let opts = TestOptions { compile_opts, diff --git a/gateway/src/project.rs b/gateway/src/project.rs index e36f105f0..7e11b3aaa 100644 --- a/gateway/src/project.rs +++ b/gateway/src/project.rs @@ -534,8 +534,12 @@ impl ProjectCreating { "Source": format!("{prefix}{project_name}_vol"), "Type": "volume" }], + // https://docs.docker.com/config/containers/resource_constraints/#memory "Memory": 6442450000i64, // 6 GiB hard limit "MemoryReservation": 4295000000i64, // 4 GiB soft limit, applied if host is low on memory + // https://docs.docker.com/config/containers/resource_constraints/#cpu + "CpuPeriod": 100000i64, + "CpuQuota": 400000i64 }); debug!( diff --git a/service/src/lib.rs b/service/src/lib.rs index a8ecd95a1..aafe1f887 100644 --- a/service/src/lib.rs +++ b/service/src/lib.rs @@ -560,8 +560,8 @@ where F: FnOnce(&mut actix_web::web::ServiceConfig) + Sync + Send + Clone + 'static, { async fn bind(mut self: Box, addr: SocketAddr) -> Result<(), Error> { - // Start a worker for each cpu, but no more than 8. - let worker_count = num_cpus::get().max(8); + // Start a worker for each cpu, but no more than 4. + let worker_count = num_cpus::get().max(4); let srv = actix_web::HttpServer::new(move || actix_web::App::new().configure(self.clone())) .workers(worker_count) diff --git a/service/src/loader.rs b/service/src/loader.rs index d48aceeb3..5d5ee4234 100644 --- a/service/src/loader.rs +++ b/service/src/loader.rs @@ -178,10 +178,10 @@ fn get_compile_options(config: &Config, release_mode: bool) -> anyhow::Result