Skip to content

Commit acd1df9

Browse files
Document smart placement with assets impact (#18780)
1 parent 4f9650c commit acd1df9

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/content/docs/workers/static-assets/binding.mdx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
pcx_content_type: concept
3-
title: Configuration and binding
3+
title: Configuration and Bindings
44
sidebar:
55
order: 7
66
head: []
@@ -156,3 +156,23 @@ export default {
156156
## Routing configuration
157157

158158
For the various static asset routing configuration options, refer to [Routing](/workers/static-assets/routing/).
159+
160+
## Smart Placement
161+
162+
[Smart Placement](/workers/configuration/smart-placement/) can be used to place a Worker's code close to your back-end infrastructure. Smart Placement will only have an effect if you specified a `main`, pointing to your Worker code.
163+
164+
### Smart Placement with Worker Code First
165+
166+
If you desire to run your [Worker code ahead of assets](/workers/static-assets/routing/#invoking-worker-script-ahead-of-assets) by setting `experimental_serve_directly=false`, all requests must first travel to your Smart-Placed Worker. As a result, you may experience increased latency for asset requests.
167+
168+
Use Smart Placement with `experimental_serve_directly=false` when you need to integrate with other backend services, authenticate requests before serving any assets, or if your want to make modifications to your assets before serving them.
169+
170+
If you want some assets served as quickly as possible to the user, but others to be served behind a smart-placed Worker, considering splitting your app into multiple Workers and [using service bindings to connect them](/workers/configuration/smart-placement/#best-practices).
171+
172+
### Smart Placement with Assets First
173+
174+
Enabling Smart Placement with `experimental_serve_directly=true` lets you serve assets from as close as possible to your users, but moves your Worker logic to run most efficiently (such as near a database).
175+
176+
Use Smart Placement with `experimental_serve_directly=true` when prioritizing fast asset delivery.
177+
178+
This will not impact the [default routing behavior](/workers/static-assets/routing/#default-behavior).

0 commit comments

Comments
 (0)