Confused about workers

I’m not sure how a plan I select (e.g. Pro) for a given site is linked to the workers in terms of CPU limit per request. It says with Free I get 5ms limit on CPU time per request. With Pro I get 10ms and so on. But my Pro plan is associated with just one of my sites. Does that mean if that site uses a worker that I create on workers.dev then it automatically gets 10ms CPU limit per request while my other Free sites get 5ms?

Also confusing is not seeing a tutorial for how to create a Worker KV that will be invoked from my Cloudflare-enabled site. Do I just send a requests via HTTPS to my-worker.my-worker-domain.workers.dev ? Is that it in a nutshell?

Respectfully,

–Not A Bot

Pricing is simple, free or unlimited, account wide. I believe is taking some time for Cloudlfare to update the info. They are aware of the divergent information.

I bet the CPU time per request limit is determined by the domain (route) the worker is tied to.

So to answer the second question, to activate a worker, you need to hit the Route the worker is tied to (as described above). So if you want some magic to happen, you create a Workers script. Use KV (key value pairs) if desired, but this has no impact on your questions. Then you assign that Worker to a Route (which is really a URL).

A free worker is accessed at example.workers.dev
A Pro Paid worker is accessed at example.com

Docs state. For workers only two plans now. There an internal ticket for this issue already.

Plan CPU
Free 10ms
Unlimited (Paid) 50ms

https://workers.Cloudflare.com/docs/reference/runtime/limits/

2 Likes

Thank you for explaining that.

I’m paying the $5/mo for Workers, and I have a Pro plan for one of my sites where I want to run workers. The question is how do I assign a worker that I create to a route on my own domain (for said site)? Do I simply go thru “Create a Worker” and configure it on the Cloudflare site?

Thank you.

I hope they update the docs ASAP. Not helpful for new comers.

The question is how do I assign a worker that I create to a route on my own domain (for said site)?

Hey @marc.fawzi – to assign a Worker to a domain that you host on Cloudflare, we recommend using our command-line tool Wrangler (find install instructions at that link, too) to build and deploy any scripts.

Specifically, for deploying to a site (I’ll use my personal site, signalnerve.com, as an example):

  1. Given an existing Wrangler project (or start a new one, with wrangler generate)…
  2. Set the project’s route in wrangler.toml:
route = "https://www.signalnerve.com/*"
  1. Publish the project using the publish command, passing the --release flag to deploy it to your domain on Cloudflare, instead of the default of deploying to workers.dev:

wrangler publish --release

Let me know if you have any issues, happy to help!

1 Like

One question I have is: what about when I want multiple routes for the same Worker?

Good question! You can definitely do this in the UI - even if you publish from wrangler, you can still go into the UI after the deploy and attach the script to other routes. Just to be clear, can you give me an example of what you’re looking for? I want to make sure we’re talking about the same thing :slight_smile:

Basically what this user asks here since I tried to help him, but I redirected to the UI where I knew it was possible (maybe merging the various pages or something can help, but it’s out of the scope of this discussion).

1 Like

Good to know. Thank you.