Turn it on
1
Install Knative
Scale to zero runs on Knative. An Admin installs it once per infrastructure from the App Store.
2
Set the service's scaling
In
inframan.yaml, use the concurrency scaling type with a minimum of zero:inframan.yaml
3
Deploy
Push the change. Once the service has had no requests for a while, its replicas stop.
min_replicas defaults to 1, so a service only scales to zero when you ask for it.
What a cold start looks like
While a service is at zero, Knative’s activator holds an incoming request, starts a replica, and passes the request on once the replica is ready. Nothing is dropped, but that first request waits for your container to start. Keep cold starts short with a small image and a fast start-up. The Cold Start Latency chart in Metrics shows how long requests waited, at the 50th, 95th and 99th percentiles.Where it applies
- Web services on non-production infrastructures. Production infrastructures keep at least one replica of every Knative service, so production traffic never waits for a cold start.
- Not workers. A worker with
min_replicas: 0runs one replica. - Not
hpaservices. A Deployment always keeps at least one replica.