Skip to content
Snippets Groups Projects
Commit f5b566fa authored by Evangelos Foutras's avatar Evangelos Foutras :smiley_cat:
Browse files

Limit Borg CPU usage on single vCPU servers to 50%

This is meant to address the daily HostHighCpuLoad alert triggered on
lists.archlinux.org, which due to the large number of files it has to
process (around 1.5 million). Machines with more than one virtual CPU
don't need this as Borg is currently single-threaded and thus limited
to one core.
parent 2039efbe
No related branches found
No related tags found
1 merge request!447Limit Borg CPU usage on single vCPU servers to 50%
Pipeline #9509 passed
......@@ -57,12 +57,14 @@
template: src=backup-gitlab.sh.j2 dest=/usr/local/bin/backup-gitlab.sh owner=root group=root mode=0755
when: inventory_hostname == "gitlab.archlinux.org"
- name: install systemd timer and service for backup
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
- name: install systemd services for backup
template: src={{ item }}.j2 dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
with_items:
- borg-backup.timer
- borg-backup.service
- borg-backup-offsite.service
- name: activate systemd timers for backup
- name: install systemd timer for backup
copy: src=borg-backup.timer dest=/etc/systemd/system/borg-backup.timer owner=root group=root mode=0644
- name: activate systemd timer for backup
systemd: name=borg-backup.timer enabled=yes state=started daemon-reload=yes
{% if ansible_processor_vcpus == 1 %}
{# Limit CPU usage to avoid triggering a HostHighCpuLoad alert #}
CPUQuota=50%
{% endif %}
......@@ -5,4 +5,5 @@ Description=Borg backup (offsite)
Type=oneshot
Restart=on-failure
RestartSec=5m
{% include 'borg-backup-cpu-quota.j2' %}
ExecStart=/usr/local/bin/borg-backup-offsite.sh
......@@ -7,4 +7,5 @@ Before=borg-backup-offsite.service
Type=oneshot
Restart=on-failure
RestartSec=5m
{% include 'borg-backup-cpu-quota.j2' %}
ExecStart=/usr/local/bin/borg-backup.sh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment