Commit 00a18bdf authored by Evangelos Foutras's avatar Evangelos Foutras 🐱
Browse files

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

parent 8c313fe0
---
enable_zram_swap: true
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
pacman: name="appstream-generator" state=present pacman: name="appstream-generator" state=present
- name: install archbuild - 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 - name: install archbuild scripts
copy: src={{ item }} dest=/usr/local/bin/{{ item }} owner=root group=root mode=0755 copy: src={{ item }} dest=/usr/local/bin/{{ item }} owner=root group=root mode=0755
...@@ -40,13 +40,9 @@ ...@@ -40,13 +40,9 @@
- mkpkg@.timer - mkpkg@.timer
- mkpkg@.service - 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 - 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"}} service: name={{ item }} enabled={{"yes" if archbuild_fs == 'tmpfs' else "no"}} state={{"started" if archbuild_fs == 'tmpfs' else "stopped"}}
with_items: with_items:
- systemd-swap.service
- var-lib-archbuild.mount - var-lib-archbuild.mount
- name: start and enable archbuilddest mount - name: start and enable archbuilddest mount
......
--- ---
configure_network: false configure_network: false
enable_zram_swap: false
network_interface: "e*" network_interface: "e*"
dns_servers: dns_servers:
- 8.8.8.8 - 8.8.8.8
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
# Zswap create compress cache between swap and memory for reduce IO # Zswap create compress cache between swap and memory for reduce IO
# https://www.kernel.org/doc/Documentation/vm/zswap.txt # https://www.kernel.org/doc/Documentation/vm/zswap.txt
zswap_enabled=1 zswap_enabled=0
zswap_compressor=lz4 # lzo lz4 zswap_compressor=lz4 # lzo lz4
zswap_max_pool_percent=25 # 1-99 zswap_max_pool_percent=25 # 1-99
zswap_zpool=z3fold # zbud z3fold zswap_zpool=zbud # zbud z3fold
################################################################################ ################################################################################
# ZRam # ZRam
...@@ -26,7 +26,7 @@ zswap_zpool=z3fold # zbud z3fold ...@@ -26,7 +26,7 @@ zswap_zpool=z3fold # zbud z3fold
# Zram compression streams count for additional information see: # Zram compression streams count for additional information see:
# https://www.kernel.org/doc/Documentation/blockdev/zram.txt # 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_size=$(($RAM_SIZE/4)) # This is 1/4 of ram size by default.
zram_streams=$NCPU zram_streams=$NCPU
zram_alg=lz4 # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4 zram_alg=lz4 # lzo lz4 deflate lz4hc 842 - for Linux 4.8.4
...@@ -37,11 +37,11 @@ zram_prio=32767 # 1 - 32767 ...@@ -37,11 +37,11 @@ zram_prio=32767 # 1 - 32767
# Allocate swap files dynamically # Allocate swap files dynamically
# For btrfs fallback to swapfile + loop will be used # For btrfs fallback to swapfile + loop will be used
# ex. Min swap size 512M, Max 8*512M # 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_force_use_loop=0 # Force usage of swapfile + loop
swapfc_frequency=60s # How often check free swap space swapfc_frequency=1s # How often check free swap space
swapfc_chunk_size=10G # Allocate size of swap chunk swapfc_chunk_size=512M # Allocate size of swap chunk
swapfc_max_count=1 # 0 - unlimited, note: 32 is a kernel maximum swapfc_max_count=8 # 0 - unlimited, note: 32 is a kernel maximum
swapfc_free_swap_perc=15 # Add new chunk if free < 15% swapfc_free_swap_perc=15 # Add new chunk if free < 15%
# Remove chunk if free > 15+40% & chunk count > 2 # Remove chunk if free > 15+40% & chunk count > 2
swapfc_path=/var/lib/systemd-swap/swapfc/ swapfc_path=/var/lib/systemd-swap/swapfc/
......
...@@ -11,3 +11,6 @@ ...@@ -11,3 +11,6 @@
- name: restart syslog-ng - name: restart syslog-ng
service: name=syslog-ng@default state=restarted service: name=syslog-ng@default state=restarted
- name: restart systemd-swap
service: name=systemd-swap state=restarted
...@@ -98,6 +98,20 @@ ...@@ -98,6 +98,20 @@
notify: notify:
- systemd daemon-reload - 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 - name: install logrotate
pacman: name=logrotate state=present pacman: name=logrotate state=present
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment