On Sunday morning at JSConf EU in Berlin, Cloudflare’s Ashley Williams announced a number of changes to Cloudflare workers, including adopting Wrangler as the official CLI, providing the ability to deploy without bringing your own domain, and offering a free tier that allows anyone to deploy globally on Cloudflare’s infrastructure.
Cloudflare Workers provides a lightweight JavaScript execution environment built on top of Chrome’s V8 JavaScript engine (leveraging V8 Isolates). Workers is a serverless solution that allows developers to augment existing applications (or create entirely new ones) and deploy code to Cloudflare’s application edge without configuring or maintaining infrastructure. Cloudflare infrastructure supports a global AnyCast Network of 175+ data centers.
Isolates is a form of virtual machine built by the Google Chrome team to power "V8, the Javascript engine in the Chrome browser." Isolates are lightweight contexts which group variables with the code allowed to mutate them. A single process running in an isolate can run hundreds or thousands of workers and seamlessly switch between them. Williams used the following slide in her presentation to discuss the difference between VMs, Containers, and Isolates.
While Serverless itself is not a new idea, the ability to easily deploy global logic to your application edge is. Use cases around traffic shaping, localization, server-side rendering, data aggregation, and machine learning can all be enabled with lower latencies by moving application logic from cloud providers closer to your users. Cloudflare is a hardware provider which (among other things) offers a global Content Delivery Network (CDN). The addition of Cloudflare workers to this stack allows custom logic to be deployed without the need to worry about regions, VMs, servers, containers, or load balancers.
Commenting on what this means to developers, Williams said, "The classic client-server dichotomy- a constant source of tension for web developers- is being challenged by both serverless and the edge. With the release of our CLI tool, a free tier, and http://workers.dev subdomains, we've made our v8 powered global serverless platform of 180 data centers available and usable to more developers than ever before. This means faster websites and applications for every one in the world- not just users in the US and Europe."
Citing benchmarks comparisons between gh-pages and cloudflare worker deployed functions, Williams demonstrated impressive performance gains in places like Doha, Qatar (591 ms to 143ms), Melbourne, AU (624ms to 208ms), and Reykjavik, IS (170ms to 34ms). Details on the benchmarks are available on the cloudflare blog.
Several months ago, Williams open sourced Wrangler as a CLI tool in order to ease the developer experience of developing and deploying a Rust toolchain Web Assembly serverless solution. Today, Wrangler graduated into being the official Workers CLI, and now supports all Workers deployment needs. Details on installing from NPM, generating a project, and publishing to Cloudflare’s infrastructure can be found on a blog posted to go along with Williams' announcement. Wasm (or Web Assembly) can be deployed leveraging Cloudflare workers.
Additionally, Workers now allows custom third-level domain names to be built off of the workers.dev
domain, so you don’t have to bring your own domain when deploying your code. As previously mentioned, Workers doesn’t require you to declare regions, VMs, servers, containers, or load balancers, so developers can simply deploy global serverless functions using a familiar command line interface.
To enable adoption and experimentation, Cloudflare is providing a free tier for developers to use. The Workers free tier allows up to 100,000 requests per day across the global anycast network.
Several other related announcements were made, including new docs, a new UI, and a commitment that this is just the beginning of offerings from Cloudflare.
Laurie Voss, the NPM co-founder & chief data officer, described NPM’s move to Workers this way: “Cloudflare Workers has changed the way we build our apps. We don’t have to think about regions, we just deploy code and it runs seamlessly around the world.”
To learn more about Cloudflare’s announcement, visit the Cloudflare developer’s blog, look for the video when it’s released from JSConf EU, or sign up for a half-day workshop on Cloudflare workers at QCon New York June 27th later this month.