Native Rust Support on Cloudflare Workers
blog.cloudflare.com
blog.cloudflare.com
Or is this allowing actual Rust code to run natively on the Cloudflare Workers environment?
I ask because there is a significant difference in performance between native Rust and Web ASM.
EDIT: I found this benchmark [0]. It appears you can run Rust 3 different ways. 1. Natively (fastest), 2. Node with Rust Bindings (2x slower than native), or 3. wasm (8x slower than native).
I wonder if this announcement is Cloudflare supporting the #2 configuration above (Node with Rust Bindings).
[0] https://github.com/PSeitz/wana_kana_rust/tree/master/bench_c...
> Introducing the worker crate, available on GitHub and crates.io, which makes Rust developers feel right at home on the Workers platform by running code inside the V8 WebAssembly engine.
It seems like this is still WASM. I wonder if this is "Node with Rust bindings" as my EDIT comment alludes too.
See https://developers.cloudflare.com/workers/learning/how-worke...
Edit: "Native" does seem misleading in the title. "Streamlined Rust Support on Cloudflare Workers" would have been more straightforward.
If there's anyone from CloudFlare here, I have a question: does this support WebSockets? At first glance over the docs I don't see an equivalent to WebSocketPair from the JS interface.
A sample app app of cloudflare workers ( a status page with pings in multiple regions): https://github.com/eidam/cf-workers-status-page
And the framework on top of cloudflare workers, inspired on next.js : https://flareact.com/
I'm in the camp "use Rust if you need it". Supporting Rust natively here makes a lot of sense for compute heavy applicatons. There's still some 30 ms latency, so some single digit microseconds don't really matter, but getting in the region of saving 2 digit microseconds in compute, the performance benefits of Rust start paying off (of course depending on the number of requests). So, I guess this is a great examples for choosing Rust.
The combo Cloudflare Workers and Rust is probably the fastest you can get for worldwide delivery of dynamic content. Really interesting stuff.
All GETs result in a KV lookup. A PUT uses a signed payload and a set of public keys in another KV store to check that the caller is allowed to store the new page contents.
I can re-deploy a site in a matter of milliseconds and it is only loosely cached (updates are reflected within a minute or so), free for up to 100k requests a month, and serves content in a matter of milliseconds.
The idea is what Worker Sites [1] do via KV Asset Handler [2].
Would love to see your code for signed Payload / auth. Or, just hear how you do it. My auth is a bit... weak.
Cheers.
[1] https://developers.cloudflare.com/workers/platform/sites
Being able to do this in the CDN infra was pretty powerful.
[0]: https://dev.to/joe8bit/shipping-web-components-in-2020-2h54
We see more and more customers building applications around Cloudflare workers our compute platform. A high-profile new economy delivery company signed a $1.3 million three-year deal. They use a number of our products, but increasingly are building their application using Workers in order to get fast scalable performance. They appreciate the flexibility it provides, as they literally deliver for their geographically distributed customer base.
A financial services software provider signed a three-year $3.3 million deal for a number of our products. They're using Workers as a hyper programmable middleware to stitch together multiple vendor solutions. They love how easy it is for developers on their team to get up and running on the platform, because of the broad programming language support and rich developer tools that have been honed and battle tested in production since Workers launched nearly four years ago.
An Asian fintech provider expanded their use of Cloudflare by $0.5 million, making their annual spend now $1.3 million. They are using Workers to accelerate their development cycle and replace spend with some of the traditional hyperscale compute providers.
So, more than 50,000 developers wrote their first Workers script or code this time [this quarter]. And that's not signed up for an account. That's actually wrote code and deployed an application.
We're increasingly seeing startups that are building entire applications from scratch on the Workers platform.
well if that doesn't stir excitement I don't know what does!
I have found that to be quite tricky. There is some data for a site I'd like to be able to update dynamically, without redeploying the whole site (as that may contain draft pages / content).
How do you handle this scenario?
https://github.com/eidam/cf-workers-status-page
A status page pinging from multiple regions.
Has anyone here managed to deploy multiple workers sites as part of one worker?
Using KV storage, it should technically be possible to have one worker addressing multiple domains, so then, if you wanted to deploy multiple websites using one worker to serve static assets to multiple domains, could that be doable?
I am only mentioning this, as it still doesn't seem possible to just buy additional workers. You are still limited to 30 sites on workers sites. Which seems quite prohibitive, if you wanted to build a bunch of sites for clients for example.