Announcing Cloudflare Workers Unbound for General Availability
Announcing Cloudflare Workers Unbound for General Availability

Announcing Cloudflare Workers Unbound for General Availability

Since the Workers Unbound beta announcement last year, we’ve been hard at work tuning our systems to prepare for the public launch for Workers Unbound. We’ve seen enormous demand from developers, customers, and the Cloudflare community at large. We’ve been inspired to see our users develop a wide range of use cases, from enterprise features to entirely new applications and unlock creativity with personal projects.

Announcing Cloudflare Workers Unbound for General Availability

Workers Unbound is intended for applications that need long execution times. Today, we are making our extended CPU limits of up to 30 seconds for HTTP requests generally available to customers on the Workers Paid plan. Please note that you will still be able to access Bundled Workers, which are capped at 50 milliseconds, by toggling your Workers at a per script level.

In addition, we are offering a private beta for Cron Triggers of up to 15 minutes for those who need even longer execution times. HTTP Workers are triggered by HTTP requests as part of the Fetch API, whereas Cron Workers are scheduled jobs invoked by Cron Triggers. Our aim with this release is to allow customers to bring all of their intensive workloads to Workers and access the benefits of our edge network, without having to worry about computation limits.

Announcing Cloudflare Workers Unbound for General Availability

The feedback has been fantastic and we’re excited to see that our work to extend compute limits to unlock new use cases is resonating with our community (please join our Discord server here)!  We want Workers Unbound to be the choice that developers turn to for any workload that might otherwise be run on traditional serverless platforms like AWS Lambda  — and we’re thrilled to see that the message is resonating.

Announcing Cloudflare Workers Unbound for General Availability

Slashing egress pricing

Workers Unbound aims to be the cheapest general purpose computing platform, and we’ve made changes to our pricing plan to solidify that position. As announced during the beta, the Workers Unbound pricing model includes charges for duration and egress as well as requests, but we will not include any additional charges as other providers do, such as API Gateway or CloudFront.

Over the course of development, we also heard your feedback on the cost of egress. We know that these costs are top of mind for developers who need to do intensive storage and transfer operations. In response to that, we have cut our egress in half from $0.09 per GB to $0.045 per GB.

Furthermore, we increased the usage that is included in our $5 a month cost, detailed below. Now, as a part of the Workers Paid plan, we will give you more usage for the same rate.

We know that cost can be a major pain point for other serverless providers, and we want to make sure that developers using Workers Unbound can spend more time building applications with cutting edge technologies and less time worrying about their bill. You can read more about our pricing in these docs.

Announcing Cloudflare Workers Unbound for General Availability

Serverless as a building block for application development

Back in 2017, when we launched the Workers platform, we opted to tackle the lower latency use cases first. This approach helped us serve our existing customers, who wanted to modify Cloudflare products they were already using, like WAF and who usually required little time to execute. We retained the ability to adjust the CPU time limit in special cases. Sometimes we did this for customers with specific needs, and often those customers were our own teams at Cloudflare building on Workers. As these requests became more and more frequent, we began to see the real-world practicality of offering higher compute limits to the general market. Our beta program has helped validate this hypothesis.

We’ve seen some of our early access Unbound testers use the platform for more complex compute use cases like genomic analysis. Dr. Robert Aboukhalil, a software engineer and bioinformatics specialist, used Workers Unbound to build an API that simulates DNA sequencing data, requesting subsets of a reference genome and streaming it back to the user. To power those simulations, he compiled wgsim, an open source genomics tool for simulating sequence reads from a reference genome, from C to WebAssembly using biowasm. Next, he used the human genome referenced hosted on the public repo of the 1,000 Genomes Project as a starting point to apply random modifications to simulate errors introduced during the experiment. You can read more about his explorations in this blog.

Announcing Cloudflare Workers Unbound for General Availability

In Dr. Aboukhalil’s own words: “Cloudflare Workers Unbound and KV are well-suited for complex workloads such as powering genomics analysis. For example, I was able to build an API that simulates DNA sequencing data. Workers was well suited as it features 0 ms initialization time (i.e. no “cold starts”), runs at the edge (i.e. in a data center close to your users), and has a pricing model that doesn’t require a degree in quantum physics to understand.”

We’ve also seen that Workers Unbound can be a critical part of scaling applications at large enterprise companies. Thomson Reuters used Workers Unbound to build EverCache, a cache implementation designed to improve efficiency and load times across thousands of their partner websites.

According to Randy Kleinhuizen, an architect at Thomson Reuters, “We use Cloudflare Workers Unbound and Workers KV to reduce the burden on our origin servers and pre-populate our cache. We are early users of Unbound’s long running Workers, and the simple integration with Workers KV has made it easy to use, with consistent performance and reliability.”

Furthermore, our testers have taught us that Workers Unbound is a powerful environment for sandboxing and experimentation. Customers who originally used our platform for more simple use cases are able to expand by testing out ideas, prototyping and building out optimizations with Unbound.

As we heard from Kenn North, principal product manager at National Instruments, “Workers has been our go-to tool for scaling and tuning ni.com. We first started using Workers for redirects, and then began using Workers Unbound once we realized it could be a powerful tool for other features such as detecting the location of users and adjusting the experience accordingly. We started experimenting with using includes for deploying common header and footer HTML across the site, and currently we are improving routing, image optimization, and page caching. Our development team loves having the ability to experiment with building new features on top of Workers.”

Getting Started with Workers Unbound

Starting today, Workers Unbound is available to anyone with a Cloudflare Workers Paid subscription. Navigate to the Workers dashboard, click “Change” under the Default Usage Model section, and follow the prompts to enable Unbound on your account. You can also change the Usage Model for individual Workers under the Settings tab of each Worker.

Once enabled, Unbound can also be used through wrangler, the command-line tool for deploying Workers. First, make sure to update wrangler to release 1.15.1 or later. Then, configure the usage model of your Worker by setting the usage_model field in your wrangler.toml to either “bundled” or “unbound”.

As a reminder, the “bundled” usage model gives you access to our original Workers model with up to 50ms of compute time. The model “unbound” opts you into the higher execution limits with the pricing listed above. If you don’t specify a usage model, new Workers scripts will use the default usage model set through the dashboard.

If you want to try Workers Unbound today, please take a look at this template, licensed under the MIT license, and give it a whirl!

// Try running this script first with Usage Model: Bundled
// see how far it can count.
//
// Then update the script's Usage Model to Unbound to see
// how much further it can go!
//
// note: 1st requests on a connection in Bundled mode
// might get higher cpu allocation than average requests.
 
addEventListener('fetch', event => {
 event.respondWith(handleEvent(event))
})
 
async function handleEvent(event) {
 let { readable, writable } = new TransformStream()
 let countingIsDone = countToOneTrillion(writable)
 event.waitUntil(countingIsDone)
 
 // start streaming response while still counting
 return new Response(readable, {
   status: 200,
   headers: {
     'Content-Type': 'text/plain; charset=utf8',
     'X-Content-Type-Options': 'nosniff',
   },
 })
}
 
async function countToOneTrillion(writableStream) {
 // This is an example of a cpu-heavy long running task.
 //
 // Try your own example here instead!
 // Fractal Generator? ML model training?
 
 const million = 1000000
 const intro = `Hello World!
Let's count to one trillion:
(we'll stop when cpu limits are exceeded)
 
`
 const writer = writableStream.getWriter()
 const encoder = new TextEncoder()
 await writer.write(encoder.encode(intro))
 
 for (let i = 1; i <= million * million; i++) {
   if (i % (2 * million) == 0) {
     // send an update to client every 2M cycles
     const count = i / million
     const line = `${count} millionn`
     await writer.write(encoder.encode(line))
   }
 }
 await writer.close()
 return
}

We hope you give Workers Unbound a try – and if you have any feedback or questions please let us know on our Discord server here! If you are interested in signing up for the beta program for 15 minute Cron Workers, please contact us with this form.

By admin