Vibe Coding Academy Logo Vibe Coding Academy

Why Your OpenClaw VPS Is Sluggish

Drop CPU from 70% to 19% in 5 minutes. Diagnose session bloat, clean up stale files, and fix those annoying lock timeout errors.

Published February 14, 2026 · 6 min read

#OpenClaw #VPS #Performance

Your OpenClaw installation has been running great for weeks. Then suddenly: everything feels slow. Commands take forever. Cron jobs start failing. You check top and see openclaw-gateway eating 60-70% CPU doing... nothing?

I just fixed this exact problem today. Here's what causes it and how to fix it in about 5 minutes.

The Symptoms

You might notice some or all of these:

Error: timeout acquiring session store lock

If you're seeing this error, keep reading — your sessions.json file is almost certainly bloated.

The Root Cause: Session Bloat

Every time a cron job runs in OpenClaw, it creates a new entry in sessions.json with a full copy of the skillsSnapshot field. Each snapshot is about 3.7KB of JSON.

🔍 The Math

4,767 cron runs × 3.7KB = 21MB of redundant data
Every session operation must read/parse this entire 28MB file.

When the file gets too large:

Step 1: Diagnose the Problem

First, confirm this is actually your issue. Run these commands:

1Check CPU usage

top -bn1 | head -20 ps aux | grep openclaw

Look for openclaw-gateway at 60%+ CPU.

2Check sessions.json size

du -h /root/.openclaw/agents/main/sessions/sessions.json

If it's over 10MB, you've found the problem.

3Count session files

find /root/.openclaw/agents/main/sessions/ -name "*.jsonl" | wc -l

Thousands of session files? Time to clean up.

4Check for stale temp files

ls -la /root/.openclaw/agents/main/sessions/*.tmp

If you see .tmp files, these are failed write operations that never completed.

Step 2: The 5-Minute Fix

⚠️ Before You Start

These commands will clean up old session data. Active sessions won't be affected, but you may lose history for sessions older than 7 days.

1Remove stale temp files

rm -v /root/.openclaw/agents/main/sessions/sessions.json.*.tmp

2Delete old session files (>7 days)

find /root/.openclaw/agents/main/sessions/ -name "*.jsonl" -mtime +7 -delete

3Remove skillsSnapshot bloat from cron runs

This is the big one. Run this Node.js script to strip redundant data:

node -e " const fs = require('fs'); const sessionsFile = '/root/.openclaw/agents/main/sessions/sessions.json'; const data = JSON.parse(fs.readFileSync(sessionsFile, 'utf8')); let removed = 0; for (const [key, value] of Object.entries(data)) { if (key.includes(':run:') && value.skillsSnapshot) { delete value.skillsSnapshot; removed++; } } fs.writeFileSync(sessionsFile, JSON.stringify(data, null, 2)); console.log('Removed skillsSnapshot from', removed, 'cron run entries'); "

4Restart the gateway

pkill -f "openclaw-gateway"

The gateway will auto-restart. Give it 10-15 seconds.

5Verify the fix

# Check new file size du -h /root/.openclaw/agents/main/sessions/sessions.json # Check CPU usage ps aux | grep openclaw-gateway | grep -v grep | awk '{print "CPU: "$3"% MEM: "$4"%"}'

The Results

Here's what happened when I ran this fix today:

Metric Before After
CPU Usage 60-70% 19%
Memory 20% (1.6GB) 4.5% (360MB)
sessions.json 28MB 2.5MB
Load Average 0.81 0.31
Response Time Slow Instant

✅ That's It

Your OpenClaw should now be running fast again. The whole fix takes about 5 minutes.

Quick Health Check Command

Save this as a script for easy monitoring:

echo "=== OpenClaw Health Check ===" && \ echo "CPU/MEM:" && ps aux | grep openclaw-gateway | grep -v grep | awk '{print " CPU: "$3"% MEM: "$4"%"}' && \ echo "sessions.json:" && du -h /root/.openclaw/agents/main/sessions/sessions.json && \ echo "Session files:" && find /root/.openclaw/agents/main/sessions/ -name "*.jsonl" | wc -l && \ echo "Temp files:" && ls /root/.openclaw/agents/main/sessions/*.tmp 2>/dev/null | wc -l

Prevention: Keep It Clean

To prevent this from happening again:

📋 Signs You Need Cleanup

Want More OpenClaw Tips?

Join Vibe Coding Academy for troubleshooting guides, performance tips, and a community of builders running AI agents.

Join the Academy

Key Takeaways

Abdul Khan
Written by
Abdul Khan