ScaleArchitect · Scaling RCA · 9 October 2026 · 1 of 4
150 synchronized Role B starts · 50 Role A users · cold-start and authentication RCA
Test window: 6–9 October 2026 · All times UTC · Root causes, proposed fixes and the next scaling gate
Scaling decision
HOLD · Fix scale-out safety New instances accept traffic before PHP is ready. Role A login state is also local to the instance. Adding capacity therefore introduces failures instead of reliably absorbing the surge.
Next move: Gate traffic on PHP readiness and make session state available across instances. Do not treat one clean opening as a pass.
Latest opening failures
60 / 150
9 Oct · 11:58 UTC · first-page HTTP 502
Startup exposure
Up to 24 s
Probe passes before PHP accepts connections
New-instance auth failures
231 × 403
One new Role A instance · 10:16–10:17 UTC
Where the journey breaks
A clean opening does not remove the startup race
150 users per synchronized opening. First-page outcomes, not all HTTP failures. Each repeat uses the same load; the intervening reported change is Cloudflare configuration. E01–E02.
Opening · UTC
Served
First-page 502
All browser 502
All origin-log 502
6 Oct 18:37
84
66
71
71
9 Oct AM 10:12
150
0
18
17
9 Oct PM 11:58
90
60
61
61
The morning repeat has no first-page failures but still has 18 browser-observed 502s. The origin log contains 17 of them. The afternoon repeat again loses 60 first pages: the readiness defect remains reproducible.
Root causes and proposed fixes
F01
The startup probe checks nginx, not the application
Impact. Role B users see a bad-gateway page before they can enter the application. The problem appears when autoscaling starts a container, even though a ready instance serves traffic normally.
Root cause
supervisord starts nginx and PHP-FPM in parallel. The TCP probe passes as soon as nginx listens. Cloud Run releases queued traffic while PHP-FPM is still starting; nginx cannot reach its upstream and returns 502.
Evidence
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
6 Oct · UTC
18:37:10.576 TCP startup probe succeeds
18:37:10.595 nginx: connect() failed (111: Connection refused)
18:37:10.792 PHP-FPM: ready to handle connections
This instance exposes a 216 ms readiness gap. Other instances take up to 24 seconds. All 71, 17 and 61 origin-log 502s across the three runs match new-instance upstream connection refusals.
Proposed fix
Make the startup check reach PHP-FPM itself. Configure a ping route, point the probe at that route, and start nginx only after the PHP backend accepts connections. Keep these settings in deployment configuration.
PHP-FPM + nginx · proposed configuration
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
Separate PHP-FPM and nginx configuration excerpts; not one combined file. Source E01.
Deployment · replace the TCP probe
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
- startup check: TCP port 8080+ --startup-probe=httpGet.path=/health/runtime,httpGet.port=8080,periodSeconds=1,timeoutSeconds=1,failureThreshold=60
Proposed probe flags from E01. Test the route and command syntax in the deployment pipeline before rollout.
Risk and rollout
A misrouted health check can prevent a revision becoming ready. Canary the route first. Warm instances reduce exposure but do not repair a faulty cold-start contract.
Retest and acceptance
Force new instances with the same 150-user opening several times. Require zero startup-related 5xx in page loads and background calls; every instance must pass the PHP-backed probe before receiving user traffic.
F02
Local session files make a new instance reject valid users
Impact. A logged-in Role A user can return to the login screen as soon as a different instance handles a request. More instances are not safe capacity while authentication depends on one container.
Root cause
Sessions are files inside each instance. A new instance does not have the session created at login. Session configuration also runs after session_start() on some entry points, so intended cookie, lifetime and path settings are skipped.
Evidence
Serving instance · 9 Oct 10:16–10:17 UTC
HTTP 200
HTTP 403
Original instance
1681
0
One new instance
108
231
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
{"category":"SESSION_UNAVAILABLE"}
The 403s appear on the new instance; the original has none. This reply differs from the resource-access rejection in F03.
Proposed fix
Move session initialization into one bootstrap that executes before any session starts. Use shared session storage, with explicit expiry and concurrent-write behavior. The application must not rely on session affinity for correctness.
Session ownership · proposed architecture
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
- Session files belong to whichever container handles login- Session settings run only if no earlier entry point starts a session+ Every entry point initializes the same session bootstrap first+ Every instance reads the same shared session store+ Cookie policy, expiry and logout are defined once
Behavioral change specification, not an executable patch. Choose the store and locking model after reviewing session writes.
Risk and rollout
Changing session storage can invalidate existing logins. Concurrent requests must not overwrite authentication or assigned resource changes. Roll out outside active use; review store access, cleanup, connection load and failure behavior. Use a fixed single instance as temporary containment, not a capacity claim.
Retest and acceptance
Exercise login, OTP, assigned resource switching, logout, idle/resume and concurrent requests across several instances, including instance replacement. Require no cross-instance auth loss and consistent cookie and expiry settings.
F03
Login and the first API call disagree on authorization
Impact. The user sees a successful login and a full application screen, then an unexplained return to login. This looks like a capacity failure unless the response is classified correctly.
Root cause
Login checks the user and linked assigned resource, but the data API additionally checks assigned resource activation and type. The same 16 accounts fail with one user and no load. The exact bad assigned resource fields are inferred from the checks, not confirmed by a database query.
Evidence
All 50 login submissions succeed; the first data call rejects 16. Isolated retries reproduce all 16 rejections. In the configuration rerun all 50 accounts now work, so the test-data blocker is cleared; the inconsistent login contract still needs a product fix.
Proposed fix
Apply assigned resource activation/type checks at login and explain rejection there. Preserve the API check as defense in depth; do not remove it to make the test pass.
Login flow · proposed behavior
Adapted, redacted excerpt · application names, fields, paths and response labels are illustrative aliases.
- Accept login, open application, reject first data request+ Reject an inactive or invalid assigned resource at login with a clear message+ Keep authorization enforced on every protected API call
Behavioral specification based on the mismatch in E03; no permission check is weakened.
Risk and rollout
Error wording must not disclose unnecessary account details. Authorized and disabled accounts need separate regression cases.
Retest and acceptance
Authorized users reach the first data response. Disabled or invalid assigned resources receive an immediate, understandable login error. Classify permission rejection separately from missing session state.
The next bottleneck is already visible
Role A response time rises with requests already waiting
6 Oct · 34 working Role A users · median server time by in-flight request group. This is a queueing signal, not proof of CPU saturation. E16.
Release gate for the next load step
Do not scale out until startup and cross-instance authentication pass. Then establish a fully completed single-instance baseline and investigate the work each user generates. More CPU cannot repair a readiness race or a missing session.