r/linuxadmin • u/ardaolmezsoy • 1d ago
My Hostinger VPS kept getting CPU-limited, so I wrote an open-source daemon that budgets the CPU credits for me
I've been trying to get as much work as possible out of my Hostinger VPS, a KVM 8 that runs CI, builds and AI agents around the clock. Every time I pushed it hard, the CPU got limited: 13 times in 10 days, with CPU steal peaking at 69%. Once that happens it's hard to keep working at all.
What bothered me most is that the limit feeds on itself. Hostinger meters VPS CPU in credits: you earn a baseline of 60% of your vCPUs, you spend whatever you use, and the bank holds at most three hours of full use. When it hits zero, the whole VPS drops to a fraction of its CPU (30% on KVM 2, 4 and 8) until the balance rebuilds. On a KVM 8 that's 2.4 cores, against a 4.8-core baseline. While your work keeps pressing against that limit, you earn nothing, so a busy server can stay limited for as long as the load lasts.
So I built Hostinger Governor. It runs on the VPS, estimates your credit balance from the kernel's CPU counters, and sets one CPU ceiling for everything in `user.slice`: every login, plus any services and Docker containers you move there. While the balance is high you get every core. As it drops, the ceiling tightens so the balance settles on a 20% floor. In a week-long simulation it never hit zero and used about 97% of the credits earned, though that's a simulation built on assumptions about Hostinger's billing.
If a limit hits anyway, it tries to tell Hostinger's limit apart from noisy neighbors (both show up as steal), then cuts demand so the VPS starts earning again.
A few other things it does:
- `governor exec -- your-job` runs a cron job under the quota, and skips it while the VPS is limited (or waits, with `--wait`).
- `governor report` shows credits, CPU, steal and each user's share.
- Scripts can check an `accepting` flag before starting heavy work, and hooks run when a limit starts or ends.
The latest release (v0.2.3) adds an optional broker so Governor never holds your Hostinger API token. A separate system account keeps it encrypted, and Governor can only ask for CPU readings and basic details about its own VPS. A setup wizard installs it with hidden token entry and rolls back if anything fails.
It needs systemd with cgroup v2 (Ubuntu 22.04+ or Debian 12+), ships as a single binary for x86_64 and ARM64, and is MIT-licensed. Install on the VPS:
curl -fsSL https://github.com/olmezsoy/hostinger-governor/releases/latest/download/install.sh | sudo bash -s -- --vm-id <your VM id> --token-file /root/hostinger-token
Repo: https://github.com/olmezsoy/hostinger-governor
I'm not affiliated with Hostinger. Governor works within their published credit rules and only controls how fast your own work spends the credits. The estimate is conservative on purpose: a fresh install starts at zero because it can't know your real balance. If you try it, I'd like to hear which plan you're on and whether the limits behaved the way the model expects.