Cloudflare Dynamic Workers Makes Sandboxes 100x Faster

6:446분 읽기Better Stack2026. 03. 28.AI/미래기술 · 창업/스타트업 · 컴퓨터/소프트웨어

핵심 요약

Cloudflare Dynamic Workers provide an incredibly fast, scalable, and cost-effective way to run programmatically-created sandboxes, enabling high-performance execution of AI-generated code and custom automations.

하이라이트

  • Cloudflare Dynamic Workers are a new low-level primitive that can be programmatically created by existing workers.

  • They are 100x faster and more memory-efficient than traditional containers because they utilize V8 isolates instead of full operating systems.

  • Users can potentially spawn up to 1 million dynamic workers per second for tasks like AI-generated code execution and custom automations.

  • Dynamic workers allow for granular control, including custom bindings, NPM dependency bundling, and intercepting outbound requests.

  • While they lack a native file system, they can interact with Cloudflare R2 buckets to store and retrieve persistent data like images or SVGs.

  • The technology is already being implemented in production by platforms like Cloudflare's Code Mode and Zite for running LLM-generated applications.

타임라인

  1. Introduction to Cloudflare Dynamic Workers

    Cloudflare has introduced dynamic workers, a low-level worker primitive that can be programmatically created by another worker. These workers are 100x faster and far more memory-efficient than standard containers because they operate on V8 isolates rather than full Linux operating systems. Because they are so lightweight, they are ideal for running AI-generated code, development previews, and custom automations. The speaker notes that users can potentially spawn up to one million of these workers per second if needed. This section establishes the high performance and low overhead that makes dynamic workers a powerful new tool in the Cloudflare ecosystem.

  2. Comparison with Traditional Sandboxes

    The speaker compares dynamic workers to Cloudflare's existing sandbox solution, which uses short-lived Linux containers running on durable objects. While the traditional sandbox is perfect for full OS capabilities, file systems, and running any binary, dynamic workers offer a significantly faster and lighter alternative. Dynamic workers allow for unlimited concurrent sandboxes within the same limits as a regular worker, providing a more streamlined execution environment. This section explains when to choose a dynamic worker over a full container, highlighting the trade-offs between speed and OS-level features. It sets the stage for the technical setup and configuration steps that follow in the demonstration.

  3. Technical Setup and Basic Implementation

    Setting up a dynamic worker involves adding a worker loaders array with a binding, such as "loader", to the Wrangler configuration file. This binding allows a parent worker to create and control nested workers using code that looks remarkably similar to standard worker functions. The speaker demonstrates how to define compatibility dates and the specific JavaScript code that the dynamic worker will run, such as responding with a simple "hello world". A crucial feature mentioned is the ability to assign names to workers, allowing developers to reuse specific sandboxes across multiple requests. This section provides a practical look at how the loader binding facilitates the programmatic instantiation and persistence of these high-speed workers.

  4. Advanced Features and Custom Bindings

    Beyond simple execution, dynamic workers support advanced capabilities like defining custom bindings and using NPM dependencies like Hono. The speaker explains that dependencies can be bundled using the create worker function, providing flexibility for complex application logic. Additionally, developers can intercept outbound requests from the dynamic worker to inject credentials or manage security protocols. The section also mentions the use of Cap'n Proto for communication between the worker and other services. These features illustrate that despite being a "lower-level primitive", dynamic workers are highly extensible and capable of handling production-grade application requirements. This flexibility is a key selling point for developers building complex serverless architectures.

  5. Running AI-Generated Code and File Storage

    A major use case for dynamic workers is executing code generated by AI agents, such as those using the Anthropic SDK. The speaker demonstrates this by having an agent generate code to calculate the value of pi and produce a visual representation. Although dynamic workers do not have a native file system, the speaker shows how to work around this by using Cloudflare R2 buckets for storage. In the example, the AI agent generates SVG code which is then saved to R2 and displayed on a web page. This highlights the synergy between Cloudflare's various services and how they can be combined to create a complete AI application environment. The section concludes with a verification that the generated output from Claude Sonnet is accurate and accessible.

  6. Scalability Testing and Future Outlook

    To showcase the extreme scalability of the platform, the speaker performs a test spawning 10,000 unique dynamic workers on Cloudflare's infrastructure. The workers are created almost instantly, and the speaker demonstrates that they can communicate with a specific worker ID immediately after creation. While this power is impressive, the speaker cautions that while currently free, these workers will eventually have a cost associated with them. The video mentions that companies like Zite are already using this technology for running LLM-generated applications. Finally, the speaker points viewers toward additional resources on Cloudflare's open-source VIVE SDK for building app generators. This closing section reinforces the scale at which this technology can operate while offering a pragmatic view of its future commercial release.

설명

Cloudflare's new Dynamic Workers let you programmatically create sandboxed workers on the fly, and they're 100x faster and more memory efficient than traditional containers. In this video, I'll show you how to set them up from scratch, run AI-generated code using the Claude SDK, spin up concurrent sandboxes in milliseconds, and even push it to 1 million dynamic workers running simultaneously. No matter if you're building AI agents, dev previews, or custom automations, this could be the fastest sandbox you've ever used. 🔗 Relevant Links Dynamic Workers Blog post - https://blog.cloudflare.com/dynamic-workers/ ❤️ More about us Radically better observability stack: https://betterstack.com/ Written tutorials: https://betterstack.com/community/ Example projects: https://github.com/BetterStackHQ 📱 Socials Twitter: https://twitter.com/betterstackhq Instagram: https://www.instagram.com/betterstackhq/ TikTok: https://www.tiktok.com/@betterstack LinkedIn: https://www.linkedin.com/company/betterstack

커뮤니티 글

모든 글 보기
이 영상에 대해 글쓰기