guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/06: hydra: Adjust Btrfs balance jobs.


From: Maxim Cournoyer
Subject: 01/06: hydra: Adjust Btrfs balance jobs.
Date: Sun, 25 Sep 2022 22:29:10 -0400 (EDT)

apteryx pushed a commit to branch master
in repository maintenance.

commit 88ba60b97eb3c9943c5925fc060e9cab663a68a4
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Sep 23 08:13:29 2022 -0400

    hydra: Adjust Btrfs balance jobs.
    
    Balancing metadata is not recommended, so do not do it.  Reduce
    balance usage filter threshold to 5%, which is more reasonable for a
    balance running often and require less free blocks.
    
    * hydra/modules/sysadmin/overdrive.scm (btrfs-job): Rename to:
    (btrfs-balance-job).  Use the same snippet as used in
    'deploy-node-129.scm'.
    (overdrive-system) [services] <mcron-service-type>: Adjust for job rename.
    * hydra/milano-guix-1.scm: Likewise.
    * hydra/monokuma.scm: Likewise.
---
 hydra/milano-guix-1.scm              | 17 ++++++++++-------
 hydra/modules/sysadmin/overdrive.scm | 18 +++++++++++-------
 hydra/monokuma.scm                   | 17 ++++++++++-------
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/hydra/milano-guix-1.scm b/hydra/milano-guix-1.scm
index da7be51..bfb6144 100644
--- a/hydra/milano-guix-1.scm
+++ b/hydra/milano-guix-1.scm
@@ -38,12 +38,15 @@
   ;; Run 'guix gc' at 3AM every day.
   #~(job '(next-hour '(3)) "guix gc -F 350G"))
 
-(define btrfs-job
-  ;; Run 'btrfs balance' every three days to make free space.
-  #~(job (lambda (now)
-           (next-day-from now (range 1 31 3)))
-         (string-append #$btrfs-progs "/bin/btrfs balance "
-                        "start -dusage=50 /")))
+(define btrfs-balance-job
+  ;; Re-allocate chunks which are using less than 5% of their chunk
+  ;; space, to regain Btrfs 'unallocated' space.  The usage is kept
+  ;; low (5%) to minimize wear on the SSD.  Runs at 5 AM every 3 days.
+  #~(job '(next-hour-from (next-day (range 1 31 3)) '(5))
+         (lambda ()
+           (execl #$(file-append btrfs-progs "/bin/btrfs") "btrfs"
+                  "balance" "start" "-dusage=5" "/"))
+         "btrfs-balance"))
 
 ;; The actual machine
 
@@ -130,7 +133,7 @@
 
             (service mcron-service-type
                      (mcron-configuration
-                      (jobs (list gc-job btrfs-job))))
+                      (jobs (list gc-job btrfs-balance-job))))
 
            (service guix-build-coordinator-agent-service-type
                     (guix-build-coordinator-agent-configuration
diff --git a/hydra/modules/sysadmin/overdrive.scm 
b/hydra/modules/sysadmin/overdrive.scm
index 2a18b4d..ee879d1 100644
--- a/hydra/modules/sysadmin/overdrive.scm
+++ b/hydra/modules/sysadmin/overdrive.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016-2018, 2020-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org>
 ;;; Copyright © 2022 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;;
 ;;; This program is free software: you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
@@ -68,12 +69,15 @@
   ;; Run 'guix gc' at 3AM every day.
   #~(job '(next-hour '(3)) "guix gc -F 50G"))
 
-(define btrfs-job
-  ;; Run 'btrfs balance' every three days to make free space.
-  #~(job (lambda (now)
-           (next-day-from now (range 1 31 3)))
-         (string-append #$btrfs-progs "/bin/btrfs balance "
-                        "start -dusage=50 -musage=70 /")))
+(define btrfs-balance-job
+  ;; Re-allocate chunks which are using less than 5% of their chunk
+  ;; space, to regain Btrfs 'unallocated' space.  The usage is kept
+  ;; low (5%) to minimize wear on the SSD.  Runs at 5 AM every 3 days.
+  #~(job '(next-hour-from (next-day (range 1 31 3)) '(5))
+         (lambda ()
+           (execl #$(file-append btrfs-progs "/bin/btrfs") "btrfs"
+                  "balance" "start" "-dusage=5" "/"))
+         "btrfs-balance"))
 
 (define* (overdrive-system name #:key wireguard-ip)
   (operating-system
@@ -119,7 +123,7 @@
       (service dhcp-client-service-type)
       (service mcron-service-type
                (mcron-configuration
-                (jobs (list gc-job btrfs-job))))
+                (jobs (list gc-job btrfs-balance-job))))
 
       (service agetty-service-type
                (agetty-configuration
diff --git a/hydra/monokuma.scm b/hydra/monokuma.scm
index 7809073..f4f3b70 100644
--- a/hydra/monokuma.scm
+++ b/hydra/monokuma.scm
@@ -26,12 +26,15 @@
   ;; Run 'guix gc' at 3AM every day.
   #~(job '(next-hour '(3)) "guix gc -F 200G"))
 
-(define btrfs-job
-  ;; Run 'btrfs balance' every three days to make free space.
-  #~(job (lambda (now)
-           (next-day-from now (range 1 31 3)))
-         (string-append #$btrfs-progs "/bin/btrfs balance "
-                        "start -dusage=50 -musage=70 /")))
+(define btrfs-balance-job
+  ;; Re-allocate chunks which are using less than 5% of their chunk
+  ;; space, to regain Btrfs 'unallocated' space.  The usage is kept
+  ;; low (5%) to minimize wear on the SSD.  Runs at 5 AM every 3 days.
+  #~(job '(next-hour-from (next-day (range 1 31 3)) '(5))
+         (lambda ()
+           (execl #$(file-append btrfs-progs "/bin/btrfs") "btrfs"
+                  "balance" "start" "-dusage=5" "/"))
+         "btrfs-balance"))
 
 ;; The actual machine.
 
@@ -75,7 +78,7 @@
                    (service dhcp-client-service-type)
                    (service mcron-service-type
                             (mcron-configuration
-                             (jobs (list gc-job btrfs-job))))
+                             (jobs (list gc-job btrfs-balance-job))))
 
                    (service agetty-service-type
                             (agetty-configuration



reply via email to

[Prev in Thread] Current Thread [Next in Thread]