DEV Community

Discussion on: Cloudflare Workers are the future! 🏗

Collapse
 
johncarroll profile image
Info Comment hidden by post author - thread only visible in this permalink

Edit:

This comment is no longer applicable

Original:

So, this article largely contains incorrect information.

The term Web Worker is part of the HTML spec and has a specific, defined meaning. The API for Web Workers is built into your web browser and has been for over 10 years. I expect many web developers, like myself, expected this article to be about Web Workers. Instead, this article is talking about Cloudflare Workers and other types of cloud based, proprietary serverless functions.

I imagine you're conflating the names of two different things because "Cloudflare Worker" seems semantically similar to "web worker" (even though they are unrelated) and also because Cloudflare chose to mimic the service worker API when creating their Cloudflare Worker product (even though the two are unrelated and, in general, do not overlap in use cases).

Service workers are an on-demand serverless resource: they only run when requested. And since they run at the edge, this mean caching is baked-in!

This is incorrect. While Cloudflare Workers do this, service workers do not and cloudflare workers are not service workers. Service workers run inside the web browser and not "at the edge" (unless you're using the term "edge" facetiously here). The Github Action you linked to is deploying your code to a Cloudflare Worker which is unrelated to a service worker.

I imagine all of this confusion stems from the fact that Cloudflare chose to mimic the service worker API in their product. But that is where the similaries end. They do not have the same use cases. One runs on a server and the other runs in the browser. One is not a replacement for the other. Importantly, Cloudflare Workers should not be referred to as "service workers" since, again, they are different (and unrelated) things.

Collapse
 
bryce profile image
Info Comment hidden by post author - thread only visible in this permalink
Bryce Dorn

Thanks for your comment - I updated the references to web workers to "Cloudflare Workers" to avoid confusion (the "worker" namespace is a bit crowded 😅).

Some comments have been hidden by the post's author - find out more