Skip to content

Commit

Permalink
Document smart placement with assets impact
Browse files Browse the repository at this point in the history
  • Loading branch information
WillTaylorDev committed Dec 18, 2024
1 parent 72684c6 commit 24e7a54
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/content/docs/workers/static-assets/binding.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
pcx_content_type: concept
title: Configuration and binding
title: Configuration and Bindings
sidebar:
order: 7
head: []
Expand Down Expand Up @@ -133,3 +133,23 @@ export default {
## Routing configuration

For the various static asset routing configuration options, refer to [Routing](/workers/static-assets/routing/).

## Smart Placement

[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.

### Smart Placement with serve_directly=false

If you desire to run your [Worker code ahead of assets](/workers/static-assets/routing/#invoking-worker-script-ahead-of-assets) by setting `serve_directly=false`, all requests must first travel to your Smart-Placed Worker. As a result, you may experience increased latency for asset requests.

Use Smart Placement with `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.

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).

### Smart Placement with serve_directly=true

Enabling Smart Placement with `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).

Use Smart Placement with `serve_directly=true` when prioritizing fast asset delivery.

This will not impact the [default routing behavior](/workers/static-assets/routing/#default-behavior).

0 comments on commit 24e7a54

Please sign in to comment.