Repository navigation
fix(worker): cut CPU per request below the free plan limit - #100
Open
ajithakdev wants to merge 1 commit into
Open
ajithakdev wants to merge 1 commit into
ajithakdev wants to merge 1 commit into
Conversation
… worker and packages
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.
The worker was using more CPU per request than the Cloudflare free plan allows (10 ms). Over the last 30 days, the 99th percentile reached 28 to 77 ms. Nothing has failed yet at today's traffic, but under load Cloudflare can cut those requests off mid-test.
Two causes, both fixed:
Content-Lengthis now refused up front if it's over the 16 MB cap, and otherwise read in one nativearrayBuffer()call. Bodies without a length (chunked) still go through the old counting loop. The extension always sends a length, and never more than 8 MB.Measured on Cloudflare with
wrangler versions uploadpreview versions (production untouched), using the same 25 MB downloads and 5 MB uploads:d6779235)afe4630d)Also: CI now lints and type-checks the worker,
@meterx/sharedand@meterx/reports(#86 asked for this). All three pass with no new findings.Deploys with the next release (
cd services/worker && npx wrangler deploy). Nothing in the API changes, so the extension needs no update.