Blocks
You buy capacity on CTRL in blocks. One block is 1 vCPU, 2 GB of RAM and 30 GB of storage, for $5 a month. That's about six small apps.
Buy as many as you need. Your apps share them: give an app a fraction of a block, exactly one, or several.
Sizing an app#
Every app has a size: a CPU share, memory and disk. You pick it when you deploy, and you can change it later from the app's settings tab (see Resizing).
The dashboard has four presets:
| Preset | Share of a block | vCPU | Memory | Disk |
|---|---|---|---|---|
| XS | ⅙ | 0.15 | 320 MB | 5 GB |
| S | ½ | 0.5 | 1 GB | 15 GB |
| M | 1 | 1 | 2 GB | 30 GB |
| L | 2 | 2 | 4 GB | 60 GB |
Or set your own. The minimums are:
- CPU: 0.1 vCPU, in steps of 0.05. The API calls this
cpu_millis: 1000 is one vCPU, so the minimum is 100, in steps of 50. - Memory: 256 MB (
mem_size_mb). - Disk: 5 GB (
disk_size_mb, at least 5120).
An app gets exactly its size, and never bursts past it.
In the API you can also give vcpu_count instead of cpu_millis, as whole vCPUs. If you send both, cpu_millis wins.
{ "cpu_millis": 500, "mem_size_mb": 1024, "disk_size_mb": 15360 }
Allocated and really used#
CTRL tracks two numbers against your blocks:
- Allocated is what your apps are sized to. Each running app counts its size, and an app in high availability counts it twice. Volumes and volume snapshots count their size.
- Really used is what your apps use right now: CPU and memory from each node's latest report (every 30 seconds), and the disk your apps, volumes and snapshots actually take up.
The billing page and the ctrl top panel on your account settings page show both. The settings page refreshes what's in use every 10 seconds while you have it open.
A stopped app uses nothing and isn't counted. Managed databases are free and never count.
Over-allocating is allowed#
Your apps' sizes can add up to more than you own. That's allowed, because they share your blocks and what they really use is capped (see below). The billing page shows a warning when you're over-allocated, so you know.
Two limits still apply:
- One app can't be bigger than all your blocks. With 2 blocks, no single app can be sized above 2 vCPU, 4 GB of memory or 60 GB of disk. For an app in high availability, both copies together count.
- Nothing new starts once real use reaches your blocks. When your apps really use about all of your blocks' CPU, memory or disk, these are refused: new apps, starting a stopped app, previews, and turning on high availability. New volumes are refused once real disk use is at your blocks. The error says how much is in use, for example:
your apps really use 2 of 2 vCPU -- add blocks on your account page, or stop an app
Apps that are already running keep running, and you can still redeploy or resize them.
How the cap works on a node#
On each node, all of an account's apps run inside one shared allowance. CTRL splits your blocks across the nodes your apps run on, in proportion to how much is allocated on each. Across all your nodes, the allowances add up to your blocks.
- CPU is throttled at the allowance. Your apps slow down; nothing is killed.
- Memory above the allowance is reclaimed and throttled. Your apps are never killed for it.
- Disk is measured: what your root disks, volumes and snapshots really take counts toward the limit above.
These caps need agent version 0.1.30 or newer on the node. On an older node, your apps there run uncapped and report no real disk until the node is updated.
Resizing#
Change an app's size from settings → ctrl resources on its page, or with the API:
curl -X PATCH https://api.getctrl.dev/v1/apps/$APP_ID/resources \
-H "Authorization: Bearer $CTRL_API_KEY" \
-H "Content-Type: application/json" \
-d '{"cpu_millis": 1000, "mem_size_mb": 2048}'
- A running app restarts at the new size, with no downtime where the node has room for both VMs. An app with a volume is briefly down while it restarts. If the restart fails, the app keeps its old size.
- A stopped app keeps the new size for its next start.
- If the app's node has no room for the new size, the resize is refused, and you can try a smaller one.
Buying blocks#
See Billing.