From 735060cfb521d856c6db221103e04eb4c96ab7f1 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 31 Dec 2020 19:01:28 +0000 Subject: Rate limit the agent starting threads to process builds Allow rate limiting new worker threads starting in the agent. Currently if the running jobs is limited by system load, lots of jobs start, the load goes up, then the jobs gradually finish, and once the load decreases, lots of jobs start again, and the cycle repeats. Rate limiting the starting of new threads might help to soften the jobs all starting at once. --- guix-build-coordinator/agent.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'guix-build-coordinator/agent.scm') diff --git a/guix-build-coordinator/agent.scm b/guix-build-coordinator/agent.scm index d5c2031..efa61f6 100644 --- a/guix-build-coordinator/agent.scm +++ b/guix-build-coordinator/agent.scm @@ -21,6 +21,7 @@ (define-module (guix-build-coordinator agent) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) + #:use-module (srfi srfi-19) #:use-module (ice-9 match) #:use-module (ice-9 format) #:use-module (ice-9 futures) @@ -123,7 +124,7 @@ #:log (build-log-procedure lgr build-id)) (let* ((result (perform-build lgr store build-id derivation-name)) ;; TODO Check this handles timezones right - (end-time (localtime (current-time) "UTC"))) + (end-time (localtime (time-second (current-time)) "UTC"))) (agent-submit-log-file lgr uuid coordinator-uri password build-id derivation-name) @@ -160,7 +161,9 @@ (log-msg lgr 'INFO "connecting to coordinator " coordinator-uri) (let-values (((process-job-with-queue count-jobs list-jobs) (create-work-queue current-max-builds - process-job))) + process-job + #:thread-start-delay + (make-time time-duration 0 60)))) (let ((details (submit-status coordinator-uri uuid password 'idle #:log (build-log-procedure lgr -- cgit v1.2.3