Articles

How to change an app’s CPU limit without redeploying

Change a Gregale app’s host CPU cap, verify the compute node applied it, and confirm the same deployment and process keep serving.

Updated

On Gregale, you can change a running app's CPU cap without rebuilding or redeploying it. The important part is verifying that the compute node applied the change, not just that the dashboard saved it. In a disposable production test, we lowered a live app from 500 to 250 millicores, then restored 500. The same deployment and app process served all three phases.

A CPU cap limits how much CPU time the process can consume. It does not change the number of virtual CPUs the guest sees. This guide does not test changing RAM, changing the guest vCPU count, or moving an instance to another machine.

Run the drill on a disposable app

Download the CPU cap starter and extract it into a clean directory. Use Python 3.9+, the Gregale CLI, and an account-level FAAS_TOKEN from a disposable Pro or Scale workspace. The fixture keeps one instance warm, which uses compute allowance while it runs. Never reuse an existing app.

bash
python3 drill.py

The script creates a new public synthetic app with 256 MB RAM and a separate random demo bearer. It saves baseline receipts at 500m, sets 250m, then restores 500m with gregale app update "$APP" --cpu-millicores 500 (where $APP is the disposable app slug). The Gregale credential goes only to the Gregale API and CLI, never to the deployed fixture.

Prove the new cap reached the running process

The saved CPU setting tells you what the control plane was asked to apply. The drill uses /v1/apps/{slug}/policy/status to check what reached the serving node. At baseline and after each change it requires:

  • An active CPU policy with at least one serving node, all serving nodes applied, and zero pending or stale nodes. Each change must advance the policy revision.
  • The same app ID and sole deployment, with that deployment still live at 100% traffic before and after sampling.
  • The same process marker from /ready and all three measurements. Each measurement must finish approximately 250 ms of CPU work, not merely hit the wall-time cutoff.

The drill saves baseline.json, lowered.json, and restored.json in the printed receipts directory. If any condition fails, the drill stops without reporting a pass. The timing is a sanity check from a tiny fixture, not the test for whether the cap was applied.

What we verified on Gregale

We ran this fixture on a single warm production test instance with 256 MB RAM. Each wall-time value below is the median of three tiny measurements, not a general performance benchmark.

CPU capMedian wall time for about 250 ms of CPU workDeployment and process
500m0.482 sSame
250m0.948 sSame
500m0.447 sSame

Both changes reported a new active CPU-policy revision with one serving node applied. The deployment ID, deployment list and process marker stayed unchanged. No RAM change or application redeploy was used to apply either cap.

Clean up or recover after an interruption

The drill deletes the disposable app and confirms it is absent even if verification fails. If the run was interrupted before cleanup finished, use the same workspace token and the printed directory:

bash
python3 drill.py cleanup /path/to/receipts

Cleanup checks the workspace and the exact app ID saved at creation. It refuses to delete by slug alone. If only intent.json exists, creation was not confirmed: inspect that recorded slug in the recorded workspace before deciding whether anything needs removal.

Questions

Can I change an app’s CPU limit without redeploying?

Gregale can apply a CPU cap to a live instance. Update cpu-millicores and check the CPU policy status. In the documented test, the node applied 500m to 250m and back without a new deployment or process.

How do I tell whether the CPU limit took effect?

Read the cpu_limit policy status and require a newer active revision with all serving nodes applied. The saved app setting alone is not a runtime confirmation.

Does changing a CPU cap change RAM or the guest vCPU count?

No. A CPU cap controls available CPU time. The walkthrough does not cover changing the memory size or the number of virtual CPUs assigned to the guest.