Wolfram

Proactive memory compression daemon for Linux. Wolfram identifies cold memory pages across all processes, compresses them in RAM using zram, deduplicates identical pages with KSM, and tunes kernel parameters — all automatically. No disk I/O. Applications keep running normally and never know it's happening.

Hot Pages (actively used)
Untouched — applications run normally
KSM Deduplication
Identical pages merged across processes
zram Compression
Cold pages compressed in RAM — no disk I/O
Free RAM (reclaimed)
Available for applications and cache

Features

  • zram compression — Dynamic compressed swap entirely in RAM. Starts small, grows on demand, shrinks when idle. Zero disk I/O.
  • KSM deduplication — Automatically enables Kernel Same-page Merging. Merges identical pages across all processes. Saves 17+ GB on servers running many .NET/Java instances.
  • Idle page tracking — Uses kernel page_idle bitmap to identify which pages haven't been touched, then compresses only the cold ones.
  • Kernel tuning — Optimises cache pressure, compaction, watermark boost, and swappiness on startup.
  • Lowest CPU priority — Runs at nice 19 / SCHED_IDLE / ionice idle. Never competes with real workloads.
  • Environment auto-detection — Automatically configures for Proxmox, Kubernetes, Docker, Raspberry Pi, or desktop.
  • Process hibernation (opt-in) — CRIU-based checkpoint/restore for completely idle processes with transparent wake-on-connect.

Installation

One command. Works on any Linux distribution — x86_64, ARM64, and ARMv7 (Raspberry Pi).

bash
curl -fsSL https://raw.githubusercontent.com/wolfsoftwaresystemsltd/wolfram/master/install.sh | sudo sh

The installer automatically:

  • Detects your platform and downloads the correct static binary
  • Detects your environment (Proxmox, K8s, Docker, Desktop, Pi) and generates an optimised config
  • Loads the zram kernel module
  • Enables and starts the systemd service

💡 No Rust toolchain needed — Pre-built static binaries for all platforms. Zero dependencies.

🕐 Wolfram is gentle by design. It runs at the lowest possible CPU priority and deliberately takes its time. Don't expect instant results — it identifies cold pages over multiple cycles, gradually compressing more as it learns what your applications aren't using. On a busy server, expect to see meaningful savings within 30–60 minutes and full effect after a few hours. This is intentional — Wolfram will never disrupt your running applications to save memory faster.

How It Works

Each cycle, Wolfram:

  1. Scans /proc for processes with significant anonymous memory
  2. Marks all pages as idle via the kernel's page_idle bitmap
  3. Waits 30 seconds, then checks which pages are still idle
  4. Compresses cold pages into zram using process_madvise()
  5. Adjusts zram pool — grows if >80% full, shrinks if <40% used

Dynamic zram

Wolfram creates and manages zram compressed swap devices entirely in RAM:

  • Starts at 3% of RAM, grows on demand, caps at 50%
  • lz4 compression — typically 2-4x ratio
  • Sets swappiness=100 (safe with zram — same approach Android uses on every phone)
  • Kernel load-balances across multiple devices automatically

KSM Deduplication

Wolfram auto-enables KSM (Kernel Same-page Merging) to find and merge identical pages across all processes. Massive savings when running many instances of the same runtime:

WorkloadTypical Savings
80 .NET (OpenSim) processes~17 GB
Multiple Electron apps (VS Code, Slack, Discord)Hundreds of MiB
Docker containers from the same imageSignificant overlap
JVM applicationsShared runtime pages

Kernel Tuning

On startup, Wolfram optimises kernel memory management (skipped gracefully if not available):

ParameterValueEffect
vfs_cache_pressure200Reclaim stale file cache faster
compaction_proactiveness0Stop wasting CPU building huge pages
watermark_boost_factor0No over-reclaim with zram available
swappiness100Actively compress cold pages (safe with zram)

Environment Detection

The installer auto-detects your environment and generates optimised settings:

EnvironmentDetectionTuning
Proxmox VE/etc/pve5min cycles, 100MB+ processes, excludes Proxmox infrastructure
Kuberneteskubelet5min cycles, 100MB+ processes, excludes K8s components
DesktopRunning WM2min cycles, excludes display server/audio
Dockerdockerd3min cycles, excludes container runtime
Raspberry Pi/proc/cpuinfo5min cycles, 10MB+ threshold
ServerDefault2min cycles, standard defaults

Containers & VMs

Install Wolfram on the host, not inside containers.

The kernel interfaces Wolfram uses operate on physical page frames at the host level. Running on the host means one Wolfram instance compresses cold pages across all containers and VMs simultaneously.

Works with Docker, LXC (including unprivileged), Kubernetes pods, and QEMU/KVM guests.

💡 Proxmox users — The installer automatically detects Proxmox and configures exclusions for pvedaemon, pveproxy, qemu-system, lxc-start, and ceph.

Stats & Monitoring

Wolfram writes current savings to /var/lib/wolfram/stats.json once per cycle:

json
{
  "compression_backend": "zram",
  "original_bytes": 8589934592,
  "compressed_bytes": 3435973836,
  "saved_bytes": 5153960756,
  "compression_ratio": 2.5,
  "zram_devices": 2,
  "ksm_pages_sharing": 4490362,
  "ksm_saved_mib": 17430,
  "total_saved_mib": 22345
}
bash
# Check total savings
jq .total_saved_mib /var/lib/wolfram/stats.json

# Watch live
watch -n 60 cat /var/lib/wolfram/stats.json

# View logs
journalctl -u wolfram -f

Safety

  • Non-destructive — Never modifies process memory, code, or state
  • Transparent — Compressed pages decompressed by the kernel on access in microseconds
  • Low priority — nice 19 / SCHED_IDLE / ionice idle — never competes with real workloads
  • Smart exclusions — systemd, sshd, dockerd, kubelet, etcd, pvedaemon and more excluded by default
  • Graceful shutdown — Cleans up zram devices and restores hibernated processes
  • Dry-run mode--dry-run shows what would happen without changes

Configuration

The installer generates /etc/wolfram/config.toml automatically. Edit and restart:

bash
sudo nano /etc/wolfram/config.toml
sudo systemctl restart wolfram
OptionDefaultDescription
min_process_anon_mib50-100Minimum anonymous memory to consider
min_region_kib1024-4096Minimum region size to track
cycle_secs120-300Seconds between scan cycles
cold_threshold0.5-0.7Idle fraction to trigger MADV_COLD
pageout_threshold0.7-0.9Idle fraction to trigger MADV_PAGEOUT
excluded_names(auto)Process names to never touch
enable_hibernationfalseCRIU-based process hibernation
dry_runfalseScan and report only
Esc