Cost of worker-to-worker calls

The pricing doc for workers says that:

Service bindings cost the same as any normal Worker. Each invocation is charged as if it is a request from the Internet with one important difference. You will be charged a single billable duration across all Workers triggered by a single incoming request.

iiuc, this means that worker-to-worker call will be charged as additional invocation ($0.50/million requests), but will not be charged for additional duration which is only counted once in the “main” worker.

I feel that this pricing model goes against good practices of architecture.
In essence, I’d want to break my code into small modular workers, so each worker is easy to maintain and complexity remains low.
For example, I’ll have one worker that sends analytics events, one that does api-keys and session-keys validations, one that handles logging (can’t use logpush because my log-provider is not supported :man_shrugging: ), etc.
With current pricing model, each of my requests may be charged X4 because of that model.
This is despite the code being actually bundled into a single deployable and runs only once on CF servers.
I can write my code differently and make each of these modules a library instead of a worker, and then bundle those libraries into my “real” workers.
I don’t think this will change much to cloudflare in terms of my resources-footprint, but it will affect my pricing.

Ideally, imo, service calls should not have any additional cost.
Any thoughts on this?

1 Like