I put "edge compute" in quotations because I think it's a flexible definition, but it's a fascinating area of software development.
We've been early in this game with DEV in a way, since we use logic at the edge via Fastly to make certain choices about content, and often don't have to go all the way to the origin. But since we established our process, the options within this field are becoming more and more interesting.
Cloudflare workers and the recently announced Compute@Edge by Fastly represent pretty darn cool options. Lambda@Edge is another interesting one.
This really is one of the coolest trends IMO. It's hard to argue with the benefits of cutting down latency and running performant code nearer to the end user.
Top comments (14)
I used Cloudflare workers last year to help control the crazy cache rules on a site that had never been put behind a CDN before. Worked great, but in realizing how powerful it was, I also realized how limiting it was as a toolset so far.
Can you expand?
Cloudflare provides a single JS editor window with which to work with. I don't know if there is the ability to work with source control and/or a dev environment, but that would have made life much easier as the logic got more complex.
You can use their cli tool wranger or serverless.com also can also handle CF workers
At work our 'edge compute' is hardware at locations in our supply chain to run kubernetes services that communicate with our cloud clusters. Most of the locations are running at a low network speed and we don't want to take it down trying to run some of our applications (example - video streaming with ML model inference at the edge).
when a request comes, our worker makes simultaneous requests to multiple servers, gathers all the info and serves the users. We found the response times are way better than going all the way to the server. And then there is a lesser need to worry about scaling. Debugging things are pretty hard though, it gives random errors in JS which are hard to replicate
CDN is already established and mainstream of course, I can imagine that adding computing to the "edges" is a logical next step. And (following this line of thinking) the ultimate destination would then be to completely decentralize (peer to peer, block chain driven etc), no central server anymore.
By the way it looks like Cloudflare Workers has an org account with content from @signalnerve . We are on Fastly at the moment but I wholeheartedly hope they keep it up and post to DEV. I think they have a lot of interesting things going on.
Cloudflare Workers
Hey Ben! I'm a big fan of dev.to and advocate for it a lot internally as a place for us to share Workers content :) hope to have more people writing on here soon, there's a couple folks on the team that I know are very interested... just gotta get them to start a draft!
I think, at least CloudFlare workers sound interesting.
It couls be used to sprinkle stuff on your frontend that usually would need a backend for security reasons, but since it has the WebWorker API, it doesn't need Node.js shenanigans.
Like payment etc.
I use Lambda@Edge for a variety of things:
We ended up choosing Stackpath over Fastly due to price.
Used one of CF sample workers to self-host third party scripts. Adds a bit of TTFB time but overall improved start render for us
Dynamic image processing and url rewrites (basically pushing nginx proxy_pass-type logic to the edge).