1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-05-26 20:06:13 +02:00

Enable zram on build servers (with size 1/4 * RAM)

This commit is contained in:
Evangelos Foutras 2019-03-22 09:46:09 +02:00
parent 8c313fe035
commit 00a18bdff1
6 changed files with 28 additions and 12 deletions

View File

@ -0,0 +1,2 @@
---
enable_zram_swap: true

View File

@ -4,7 +4,7 @@
pacman: name="appstream-generator" state=present
- name: install archbuild
pacman: name=systemd-swap,devtools,zsh,git,subversion,mercurial,bzr,xdelta3,ruby,tig,colordiff state=present
pacman: name=devtools,zsh,git,subversion,mercurial,bzr,xdelta3,ruby,tig,colordiff state=present
- name: install archbuild scripts
copy: src={{ item }} dest=/usr/local/bin/{{ item }} owner=root group=root mode=0755
@ -40,13 +40,9 @@
- mkpkg@.timer
- mkpkg@.service
- name: install systemd-swap config
copy: src=swap.conf dest=/etc/systemd/swap.conf owner=root group=root mode=0644
- name: start and enable archbuild mounts
service: name={{ item }} enabled={{"yes" if archbuild_fs == 'tmpfs' else "no"}} state={{"started" if archbuild_fs == 'tmpfs' else "stopped"}}
with_items:
- systemd-swap.service
- var-lib-archbuild.mount
- name: start and enable archbuilddest mount

View File

@ -1,5 +1,6 @@
---
configure_network: false
enable_zram_swap: false
network_interface: "e*"
dns_servers:
- 8.8.8.8

View File

@ -14,10 +14,10 @@
# Zswap create compress cache between swap and memory for reduce IO
# https://www.kernel.org/doc/Documentation/vm/zswap.txt
zswap_enabled=1
zswap_enabled=0
zswap_compressor=lz4 # lzo lz4
zswap_max_pool_percent=25 # 1-99
zswap_zpool=z3fold # zbud z3fold
zswap_zpool=zbud # zbud z3fold
################################################################################
# ZRam
@ -26,7 +26,7 @@ zswap_zpool=z3fold # zbud z3fold
# Zram compression streams count for additional information see:
# https://www.kernel.org/doc/Documentation/blockdev/zram.txt
zram_enabled=0
zram_enabled=1
zram_size=$(($RAM_SIZE/4)) # This is 1/4 of ram size by default.
zram_streams=$NCPU
zram_alg=lz4 # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4
@ -37,11 +37,11 @@ zram_prio=32767 # 1 - 32767
# Allocate swap files dynamically
# For btrfs fallback to swapfile + loop will be used
# ex. Min swap size 512M, Max 8*512M
swapfc_enabled=1
swapfc_enabled=0
swapfc_force_use_loop=0 # Force usage of swapfile + loop
swapfc_frequency=60s # How often check free swap space
swapfc_chunk_size=10G # Allocate size of swap chunk
swapfc_max_count=1 # 0 - unlimited, note: 32 is a kernel maximum
swapfc_frequency=1s # How often check free swap space
swapfc_chunk_size=512M # Allocate size of swap chunk
swapfc_max_count=8 # 0 - unlimited, note: 32 is a kernel maximum
swapfc_free_swap_perc=15 # Add new chunk if free < 15%
# Remove chunk if free > 15+40% & chunk count > 2
swapfc_path=/var/lib/systemd-swap/swapfc/

View File

@ -11,3 +11,6 @@
- name: restart syslog-ng
service: name=syslog-ng@default state=restarted
- name: restart systemd-swap
service: name=systemd-swap state=restarted

View File

@ -98,6 +98,20 @@
notify:
- systemd daemon-reload
- name: install systemd-swap
pacman: name=systemd-swap state=present
when: enable_zram_swap
- name: install systemd-swap config for zram
copy: src=zram-swap.conf dest=/etc/systemd/swap.conf owner=root group=root mode=0644
notify:
- restart systemd-swap
when: enable_zram_swap
- name: start systemd-swap
service: name=systemd-swap state=started enabled=yes
when: enable_zram_swap
- name: install logrotate
pacman: name=logrotate state=present