DanB
DanB
CDCloudflare Developers
Created by DanB on 5/4/2024 in #general-help
How to control a worker's location
right, there's some mgmt code for auto-scaling, but I guess it shouldn't be too complicated. DOs can count the number of jobs they run per minute, and the workers can use it to decide on the number of active DOs in the pool in subsequent requests. Needs some more thinking, but this is the direction that I have in mind.
10 replies
CDCloudflare Developers
Created by DanB on 5/4/2024 in #general-help
How to control a worker's location
@Chaika, a way to reduce pricing is to create a pool of DOs per location (can be just one, or more, depending on number of monitors that you have in that area) that will handle all monitoring requests of that region. Use Queues to handle the monitoring jobs. A worker will consume from the queue, and send to one of the DO in the pool of the required region. Once a monitoring request was handled, the DO will enqueue the next job with [delay] (https://developers.cloudflare.com/queues/configuration/batching-retries/#delay-on-send) of the number of minutes you want. Workers can consume messages from queues in batches, and call DO in batches. This setup will minimize the number of DOs you have live and you'll pay less for Duration, which is the most expansive part of DO.
10 replies
CDCloudflare Developers
Created by DanB on 5/4/2024 in #general-help
How to control a worker's location
Just read the docs for DO hints. It seems like what I need. One thing that does bother me is this:
Durable Objects do not currently change locations after they are created Dynamic relocation of existing Durable Objects is planned for the future.
I just hope that once dynamic relocation is introduced, it will still respect location hints, assuming they are provided on every request.
10 replies
CDCloudflare Developers
Created by DanB on 5/4/2024 in #general-help
How to control a worker's location
Thanks, @Chaika , I'll check DO hints. I remember looking into smart-placement for workers, but the documentation said it only kicks-in after a while and that they actually want to see that the selected location improves performance.
10 replies