Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Sébastien Luttringer
infrastructure
Commits
00a18bdf
Commit
00a18bdf
authored
Mar 22, 2019
by
Evangelos Foutras
🐱
Browse files
Enable zram on build servers (with size 1/4 * RAM)
parent
8c313fe0
Changes
6
Hide whitespace changes
Inline
Side-by-side
group_vars/buildservers.yml
0 → 100644
View file @
00a18bdf
---
enable_zram_swap
:
true
roles/archbuild/tasks/main.yml
View file @
00a18bdf
...
...
@@ -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
...
...
roles/common/defaults/main.yml
View file @
00a18bdf
---
configure_network
:
false
enable_zram_swap
:
false
network_interface
:
"
e*"
dns_servers
:
-
8.8.8.8
...
...
roles/
archbuild
/files/swap.conf
→
roles/
common
/files/
zram-
swap.conf
View file @
00a18bdf
...
...
@@ -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
=
z
3fold
# zbud z3fold
zswap_zpool
=
z
bud
# 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
=
60
s
# How often check free swap space
swapfc_chunk_size
=
10
G
# Allocate size of swap chunk
swapfc_max_count
=
1
# 0 - unlimited, note: 32 is a kernel maximum
swapfc_frequency
=
1
s
# How often check free swap space
swapfc_chunk_size
=
512
M
# 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
/
...
...
roles/common/handlers/main.yml
View file @
00a18bdf
...
...
@@ -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
roles/common/tasks/main.yml
View file @
00a18bdf
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment