Server Operations · about 2 min · 5 steps
zram compressed memory
Adds swap that lives in compressed memory, so a small server copes with memory spikes without slow disk swap.
Runs on
- Debian / Ubuntu: supported
- RHEL / Fedora: supported
- Alpine: supported
What it changes on your server
- Installs zram-tools (Debian, Ubuntu), zram-generator (RHEL, Fedora) or zram-init (Alpine) and starts it at boot.
- Sizes the compressed swap as a share of memory, using zstd, ahead of any disk swap.
What Shellbay asks you
How large should the compressed swap be?
As a percentage of memory. 50 is a good start: data usually compresses to a third of its size, so it costs far less memory than it adds.
- Size (% of memory)
- A whole number from 10 to 100. Default:
50
Example:
50
Steps
- Check the kernel supports zram
- Refresh the package list
- Install the zram service
- Set the size and start it
- Check compressed swap is on
Shellbay checks the server before the first step, and stops at the first step that fails.
When it's done
- Compressed swap is on and starts at boot.