Key idea
Autoscaling changes the spherelet count for you. When the average CPU across a service's spherelets stays above your target, ComputeSphere adds spherelets, up to your maximum; when it falls, it removes them, down to your minimum.
The three numbers
- Target (the console's CPU utilization threshold): the average CPU you want each spherelet to run at, as a percentage of its shape's vCPU. The default is 80.
- Minimum (Min spherelets): the count at quiet times. It never goes lower.
- Maximum (Max spherelets): the ceiling, and so the most it can cost.
The service keeps its shape. Autoscaling adds more Flex spherelets to a Flex service; it never moves it to Standard.
Choosing them
Target. A new spherelet takes time to start and pass its health check, and the others carry the load until it does. A target of 50 to 70% leaves them room to absorb that wait. At 90%, they're already saturated before help arrives. On the Metrics tab, the Avg view of the CPU chart (titled CPU · avg) shows the per-spherelet figure the autoscaler works from.
Minimum. 1 is the cheapest. 2 keeps the service up if one spherelet fails, which the next module covers.
Maximum. Set it from what you can afford, not from hope. Every spherelet counts against your account's capacity and is billed. Don't count on the console's slider to stop at the spherelets you have free: work that number out yourself, and set the maximum at or below it. On a trial account, with two Flex spherelets, that's 2, and only if nothing else is using them.
How it behaves
Adding is quick: on a test run, a second spherelet came about a minute after CPU crossed the target. Removing is deliberately slow: the load has to stay low first, and the same run dropped back about six minutes after the load ended, so a short lull doesn't throw away spherelets you're about to need.
Autoscaling looks at CPU only. It won't add spherelets for a memory-hungry app, and it won't help when requests are slow because a database is slow: more copies just send it more queries.
Turning it on
Open the service, then Settings. On the Spherelets card choose Edit, turn on Enable Auto-Scaling, and set the three numbers. Choose Save, then Save & redeploy: spherelet and autoscaling changes apply on the next deploy, and Save only waits for one. The card then shows Auto scaling Enabled, the CPU target, and the range, such as 1 — 2, under a second Spherelets label.
Why not csph or computesphere.yaml?
csph has no autoscaling settings: csph deployments autoscale is another name for scale, which sets a fixed count. A manifest's autoscaling_enabled, autoscaling_min, autoscaling_max and autoscaling_cpu_target fields apply when a service is created, but re-applying them doesn't change an existing service yet. Use the console to change them.
Check yourself