Repository navigation
docs(contrail): measure the first zxcvbn call's CPU on Cloudflare - #171
Merged
Merged
Conversation
The owner reopened D-023 to check the Cloudflare cpuTime of the first strength check, the one figure #170 left as a local proxy. This records it, and changes no behaviour. On Cloudflare, with the #146 harness (a tail consumer writes cpuTime to KV), the first zxcvbn call in a fresh isolate costs a median 60.5 ms of CPU above a cold start of about 25 ms (95% interval 54.5 to 64.0). A warm check is 1 to 2 ms. 666 requests over 18 fresh Workers, two requests that are both refused before any hashing, three arms (baseline build, variant build, variant build with zxcvbn); all six variant-Z rounds lie above all twelve S rounds. The 2 MiB bigger module costs a cold start nothing measurable (cold medians 26 and 25 ms). That misses the bar set before measuring (no more than one argon2 hash, about 45 ms p50) by about 15 ms at the median. A first call blocks its isolate, so concurrent requests start more isolates and each builds the dictionaries again. The local figures understated the platform by 2 to 8 times. One control did not behave as pre-registered: the first request of a same-connection sequence on the S arms cost 0 to 45 ms where 0 was expected, because the new connection sometimes reaches a fresh isolate. The sequences are therefore not used for the figure, and the note says why. A first pilot also showed that a redeploy leaks traffic to the previous version for seconds, so the run uses a new Worker per round. The 19 Workers and the KV namespace were deleted and checked. The D-023 row and the doc comment on password_is_strong carry the figure. D-023 is not changed: the rule stays as confirmed until the owner decides. Refs: #44 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Nov 15, 2026
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The owner reopened D-023 to check the Cloudflare
cpuTimeof the first strength check, the one figure #170 left as a local proxy. Thisrecords it and changes no behaviour.
.agents/plans/contrail/research/0015-zxcvbn-worker-cost.md: section 4.2 (the method, the figures, the controls, the caveats) and thefigures in sections 0, 4, 5 and 6.
.agents/plans/contrail/DEVIATIONS.md, D-023: the "not measured on Cloudflare" clause is replaced by the figure, and the row says the ownerreopened it for this. The rule stays as confirmed.
crates/thrust-core/src/auth.rs: the doc comment onpassword_is_strongcarries the figure. Comment only.Findings (Cloudflare,
cpuTime, the Woven account)How it was measured: two requests to
POST /internal/operator/users, both refused with 400 before any hashing (so no argon2 is in the figure),short(zxcvbn never runs) andabcdefghijkl(zxcvbn refuses it, so the dictionaries are built); three arms (baseline build + S, variant build +S, variant build + Z), six rounds each, rotated; each round a new Worker. A request above 10 ms is a cold one (warm ones cost 1 to 4 ms in every arm;
the result is the same at 5, 10 and 15 ms). The first call is
median(vZ cold) - median(S cold). Every one of the six variant-Z rounds has a cold median aboveevery one of the twelve S rounds (76.5 to 91 ms against 41 or less).
A first call blocks its isolate for about 85 ms, so concurrent requests go to new isolates and each builds the dictionaries again: 94 of 222
variant-Z requests were cold against 49 and 61 of 222 for the S arms. After a deploy or a scale-out, concurrent sign-ups pay the first call once per
isolate. The local figures (30 ms on workerd, 8 ms native) understated the platform by 2 to 8 times.
Left open on purpose
research/0012), and asign-up that passes the check pays the hash as well; the cost is latency and CPU on the first check in each isolate, multiplied by concurrency.
check-deps.shconflict from docs(contrail): measure what the zxcvbn crate would cost the Worker #170 (it needs a port and an adapter crate). Size is not the obstacle.4.4 ms for 72 characters) are not measured.
token in
--secrets-file, and a preflight that refuses to run over an existing name. It can be added underscripts/if the owner wants it kept.Checks and what went wrong on the way
(bS: 21, 45, 0, 26, 40, 25; vS: 0.5, 0, 0, 21, 26, 37.5) where I expected about 0: the new connection sometimes reaches a fresh isolate, which pays a cold
start that is not zxcvbn. So the sequences are not used for the figure (the variant-Z sequences' median of 75.8 contains a cold start), and the note says
so. The figure comes from the cold-cluster comparison, in which both sides pay the cold start.
(builds were mixed), and the second burst was not warm (concurrent requests keep creating isolates). The full run uses a new Worker per round.
baseline's wasm lacks the dictionary and the variant's has it (the run refuses to start otherwise).
had before. The run refused to start if any of those names or the KV title existed, because a deploy on an existing name overwrites that Worker.
cpuTimehas a resolution of 1 ms; the bootstrap resamples requests, so its interval is alittle narrower than it should be (the per-round comparison does not have that problem); one 12-character password; the memory adapter set.
cargo check -p thrust-coreafter the comment edit. The variant code was throwaway and is not in this PR.Refs: #44. Closes nothing: #44 is already closed.
🤖 Generated with Claude Code