Smart Placement "too smart"?

The docs https://developers.cloudflare.com/workers/configuration/smart-placement/#unsupported-back-end-services mention that smart placement is not supported for globally distributed services, and specifically mentions Google APIs. If I'm connecting to a Cloud Firestore database in a specific region via the Cloud Firestore REST API, will smart placement ignore this? The Firestore database is always located in a specific region. Also based on the following:
If your Worker does less than one subrequest on average, Smart Placement will run the Worker at the data center closest to the user.
Any application has some routes that require multiple round trips to a database, and some routes that do not touch a database (may serve from cache etc, or reach other backends in different regions). Depending on varying usage statistics, what if the routes that do not hit the database have higher usage than the routes that do hit the database... will this cause Smart Placement to run the worker at a data centre that is far from the database, causing a big latency hit for those routes that have multiple round trips to the database? And this could change any day depending on usage statistics of different routes? As a developer I'm wondering if smart placement would be too smart for it's own good. I know where my backend services are located and I'd prefer to tell Workers where to run rather than wondering how request statistics might be affecting the application latency. I'd prefer to say "just locate the Worker here, or fall back to nearby region if that region is down".
Cloudflare Docs
Smart Placement (beta) · Cloudflare Workers docs
Speed up your Worker application by automatically placing your workloads in an optimal location that minimizes latency.
1 Reply
Brett Willis
Brett Willis5mo ago
A workaround for this at the moment is to just set a D1 database binding on the worker (even if it is unused). As per the docs:
Workers with a D1 binding will always be placed in a data center near the location of the D1 database they are bound to. Subrequests to other back-end services are ignored by Smart Placement in this case.
Be sure to specify your desired location hint when creating that D1 database. Then the worker will always run close to that region. Actually, it doesn't "always" run close to that D1 region. A significant portion of requests are placed at the local data centre, particularly for a period of time after each new Worker deployment.
Want results from more Discord servers?
Add your server