38. Scale container apps to zero
Date: 2026-10-12
Status
Proposed
Context
The deployment declares a minimum of one replica for the BFF, the processing service and the publishing service, at 0.75 vCPU and 1.5 GiB each, so all three run around the clock. That is about 5.9 million vCPU-seconds a month against a free grant of 180,000. At West Europe retail prices this costs about 69 US dollars a month at the idle rate and up to 241 at the active rate, several times the 20 euro budget. Unicorn handles about twenty files a month for one owner. Container Apps charges nothing for an app scaled to zero, but an app at zero only starts again if a scale rule can trigger it.
The full analysis, with three options, is in the ArcKit record ARC-001-ADR-006 (projects/001-unicorn/decisions/ in the workspace).
Decision
We will set the minimum replicas to zero for all three apps and keep the maximum at one.
The BFF wakes on HTTP traffic from the front end. The processing service wakes through a Service Bus scale rule on the files queue, authenticated with managed identity (ADR 0033). The publishing service wakes on HTTP when the processing service calls it through Dapr service invocation.
Events wait in the queue while the processing service is at zero. The scale rule gets its own identity, so the application identities keep only their send and receive roles (ADR 0037).
This depends on ADR 0034 (sessions and Google tokens in a state store) and ADR 0033 (a fixed session signing key): without them, every scale-in would sign the owner out.
Consequences
Compute stays within the free grant, about 21 percent of it at today’s volume, so it costs nothing. The first request after an idle period pays a cold start. If it breaks the response time targets, the BFF alone goes back to one smaller replica, for about 6 US dollars a month. The processing service can take up to 30 seconds to wake, well within the 5 minute publication target. The smoke test must start from a cold environment, to show that Dapr service invocation wakes the publishing service. No container or connection changes in the IcePanel model.