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.
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).
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:
- Scans
/procfor processes with significant anonymous memory - Marks all pages as idle via the kernel's page_idle bitmap
- Waits 30 seconds, then checks which pages are still idle
- Compresses cold pages into zram using
process_madvise() - 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:
| Workload | Typical Savings |
|---|---|
| 80 .NET (OpenSim) processes | ~17 GB |
| Multiple Electron apps (VS Code, Slack, Discord) | Hundreds of MiB |
| Docker containers from the same image | Significant overlap |
| JVM applications | Shared runtime pages |
Kernel Tuning
On startup, Wolfram optimises kernel memory management (skipped gracefully if not available):
| Parameter | Value | Effect |
|---|---|---|
vfs_cache_pressure | 200 | Reclaim stale file cache faster |
compaction_proactiveness | 0 | Stop wasting CPU building huge pages |
watermark_boost_factor | 0 | No over-reclaim with zram available |
swappiness | 100 | Actively compress cold pages (safe with zram) |
Environment Detection
The installer auto-detects your environment and generates optimised settings:
| Environment | Detection | Tuning |
|---|---|---|
| Proxmox VE | /etc/pve | 5min cycles, 100MB+ processes, excludes Proxmox infrastructure |
| Kubernetes | kubelet | 5min cycles, 100MB+ processes, excludes K8s components |
| Desktop | Running WM | 2min cycles, excludes display server/audio |
| Docker | dockerd | 3min cycles, excludes container runtime |
| Raspberry Pi | /proc/cpuinfo | 5min cycles, 10MB+ threshold |
| Server | Default | 2min 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:
{
"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
}
# 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-runshows what would happen without changes
Configuration
The installer generates /etc/wolfram/config.toml automatically. Edit and restart:
sudo nano /etc/wolfram/config.toml
sudo systemctl restart wolfram
| Option | Default | Description |
|---|---|---|
min_process_anon_mib | 50-100 | Minimum anonymous memory to consider |
min_region_kib | 1024-4096 | Minimum region size to track |
cycle_secs | 120-300 | Seconds between scan cycles |
cold_threshold | 0.5-0.7 | Idle fraction to trigger MADV_COLD |
pageout_threshold | 0.7-0.9 | Idle fraction to trigger MADV_PAGEOUT |
excluded_names | (auto) | Process names to never touch |
enable_hibernation | false | CRIU-based process hibernation |
dry_run | false | Scan and report only |