So last year, we ventured into the crazy world of Cloudflare workers because GrowthBook released its dedicated Cloudflare Edge SDK. We immediately recognised the SDK’s potential and were drawn to Cloudflare workers’ cost-effective pricing model, so we decided to give it a go.
Our first priority was estimating the average monthly cost of running GrowthBook on a Cloudflare Worker to demonstrate its affordability compared to other server-side rendering alterntives like, for example, SiteSpect.
Technical Overview
Here’s a simplified technical diagram (from Cloudflare’s blog) showing how the Worker operates:
- Positioned between the client (e.g., desktop/mobile browser) and the website’s origin server (added possessive apostrophe).
- Modifies responses before delivering them to the client, eliminating the need for client-side experimentation tools.
With GrowthBook on the Worker, experiments render directly at the edge, bypassing traditional client-side steps like initializing tools, checking for active experiments, or modifying pages post-load.
Understanding Cloudflare worker pricing
Since the worker processes all site traffic, costs scale with usage.” Even if you are not running any experiments, the worker is processing traffic. However the traffic is always there, increasing the number of experiments will decrease the cost per experiment from a worker’s perspective (assuming average traffic remains the same). The more you scale your experimentation program the cheaper the running costs get (now compare this to the other experimentation tools where you pay per visit/visitor).
Alright, so a worker has to go through every network request and then has to do something which requires CPU time. So these are the variables that are used by Cloudflare to calculate the cost.On Cloudflare’s worker pricing page you can see the following:
Users on the Workers Paid plan have access to the Standard usage model. Workers Enterprise accounts are billed based on the usage model specified in their contract.
Requests1, 2 | Duration | CPU time | |
---|---|---|---|
Free | 100,000 per day | No charge for duration | 10 milliseconds of CPU time per invocation |
Standard | 10 million included per month +$0.30 per additional million | No charge or limit for duration | 30 million CPU milliseconds included per month +$0.02 per additional million CPU milliseconds Max of 30 seconds of CPU time per invocation Max of 15 minutes of CPU time per Cron Trigger or Queue Consumer invocation |
1 Inbound requests to your Worker. Cloudflare does not bill for subrequests you make from your Worker.
2 Requests to static assets are free and unlimited.
Example pricing
A Worker that serves 15 million requests per month, and uses an average of 7 milliseconds (ms) of CPU time per request, would have the following estimated costs:
Monthly Costs | Formula | |
---|---|---|
Subscription | $5.00 | |
Requests | $1.50 | (15,000,000 requests – 10,000,000 included requests) / 1,000,000 * $0.30 |
CPU time | $1.50 | ((7 ms of CPU time per request * 15,000,000 requests) – 30,000,000 included CPU ms) / 1,000,000 * $0.02 |
Total | $8.00 |
Estimating Your Costs
Okay, now that we understand the pricing, let’s go ahead and get a rough estimate for your situation. I recommend going to a page with quite a bit of traffic, such as your product page if you run an online store. Go into the developer tools of the browser and click on the tab Network. Refresh the page again for good measure and then at the bottom check for the number of network requests.
In this example, we have 239 network requests. It’s important to note that the GrowthBook Edge SDK doesn’t need to process all these requests. If your site is structured correctly, i.e., images and static content are served from a subdomain, then many of the requests can be ignored. This can lead to huge cost savings on worker request costs. We’ve seen examples where we could ignore up to 80% of the network requests.
If you need help getting an accurate estimate on worker costs, please feel free to contact us and consider working with us.
Next, go into analytics and check the number of event counts for the event page_view for an average month.
Finally, we need to know the average CPU time a worker takes to process a request. You won’t know this until you have a worker running, so it will be an off-the-cof estimate. However, since we already have a worker running at one of our clients, we can say that our worker at this client has an average CPU time of 2.87 ms.
Now that you know where to find the variables you need to enter into our calculator, feel free to estimate the potential costs of running a Cloudflare Worker with the GrowthBook Edge SDK.
Cloudflare Worker Cost Calculator
Results:
Monthly Worker Requests: 0
Worker Request Costs: $0
Worker CPU Time Costs: $0
Total Monthly Worker Cost: $0
Feel free to reach out if you need help getting a more detailed cost analysis for your site.
Get in touch
- +31 53 234 0444
- [email protected]
You will have a meeting with our CRO expert Rudger de Groot