Skip to content

docs(self-hosting): explain how Edge Functions workers are reused across requests - #53996

Merged
alexisintech merged 2 commits into
masterfrom
tedd/docs-1799
Nov 25, 2026
Merged

alexisintech merged 2 commits into
masterfrom
tedd/docs-1799

Conversation

@supabase-vercel-tedd

@supabase-vercel-tedd supabase-vercel-tedd Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The self-hosted Functions guide lists worker timeouts and idle cleanup, but never says that a running worker serves later requests. The Docker guide says the main worker loads each function from disk per request, which suggests top-level setup runs on every request.

Related to FDBKIN-22732
Closes DOCS-1799

Solution

A new "Worker lifecycle" section on the self-hosted Functions guide explains that the default per_worker policy sends requests to a function's running workers. Concurrent cold requests can start up to one worker per CPU, and later requests rotate across them. It says that top-level code runs once per worker, so heavy setup belongs there. It also lists the events that stop a worker from taking new requests, including retirement at half of workerTimeoutMs, links to the existing timeout and cleanup sections, and names the settings that keep workers alive longer. The Docker guide's sentence now says that a restart stops running workers, so the next request picks up changed code.

How to verify

  1. Open https://docs-git-tedd-docs-1799-supabase.vercel.app/docs/guides/self-hosting/self-hosted-functions#worker-lifecycle and https://docs-git-tedd-docs-1799-supabase.vercel.app/docs/guides/self-hosting/docker#accessing-edge-functions.
  2. The Worker lifecycle section says that requests go to a running worker for the function, that concurrent cold requests might each start a worker up to the number of CPUs, and that later requests rotate across those workers.
  3. It says that top-level code runs once per worker, that heavy setup goes at the top level, and that top-level state belongs to one worker.
  4. It lists reaching half of workerTimeoutMs, no requests, idle-worker cleanup, an error or resource limit, and a service restart as events that stop a worker from taking new requests, and says a new worker starts when the function has none left. The links to Timeout errors, Idle-worker cleanup, Per-worker memory limit, and Container memory budget go to those sections.
  5. It names requestAbsentTimeoutMs and workerTimeoutMs as the settings to raise to keep workers alive longer.
  6. The Docker guide no longer says functions load from disk per request, and still says a restart picks up new or changed function code.

Checks

Ran pnpm turbo run lint typecheck on the changed packages and pnpm exec oxfmt --check on the changed files. Checked the facts against docker/volumes/functions/main/index.ts and docker/docker-compose.yml in this repo, and against supabase/edge-runtime at v1.79.2 (the compose image tag): cli/src/flags.rs (--policy default), crates/base/src/worker/pool.rs (worker reuse, rotation, concurrent creation, and retirement), crates/base/src/worker/supervisor/strategy_per_worker.rs (early retirement at half of the wall-clock limit), and ext/workers/user_workers.js (forceCreate default). Docs tests need Docker and were skipped. Reuse wasn't tested against a running stack.

Checklist

  • I have read the Contributing Guidelines
  • I have checked that the change follows the docs style guide
  • I have checked that the change works in the preview deployment

Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on DOCS-1799. Tedd doesn't read comments on this PR.

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview, v0 Nov 25, 2026 2:48am UTC
7 Skipped Deployments
Project Deployment Actions Updated
studio Ignored Ignored Nov 25, 2026 2:48am UTC
design-system Skipped Skipped Nov 25, 2026 2:48am UTC
kb Skipped Skipped Nov 25, 2026 2:48am UTC
studio-self-hosted Skipped Skipped Nov 25, 2026 2:48am UTC
studio-staging Skipped Skipped Nov 25, 2026 2:48am UTC
ui-library Skipped Skipped Nov 25, 2026 2:48am UTC
zone-www-dot-com Skipped Skipped Nov 25, 2026 2:48am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@supabase

supabase Bot commented Nov 25, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added documentation Improvements or additions to documentation self-hosted Related to self-hosted Supabase labels Nov 25, 2026
@alexisintech
alexisintech marked this pull request as ready for review November 25, 2026 01:52
@alexisintech
alexisintech requested a review from a team as a code owner November 25, 2026 01:52
@alexisintech
alexisintech marked this pull request as draft November 25, 2026 02:22
@alexisintech
alexisintech marked this pull request as ready for review November 25, 2026 02:22
@alexisintech
alexisintech merged commit 528e2d0 into master Nov 25, 2026
44 of 45 checks passed
@alexisintech
alexisintech deleted the tedd/docs-1799 branch November 25, 2026 03:02
alexisintech added a commit that referenced this pull request Nov 25, 2026
…DOCS-1805) (#54080)

## Problem

The self-hosted docs have an owner on the self-hosted team, but
`.github/CODEOWNERS` gives all of `/apps/docs/` to `@supabase/docs`
alone. A change to a self-hosted page doesn't request a review from the
people who own that content.
[#53996](#53996) merged that
way, and [#54013](#54013)
followed up on it.

Closes
[DOCS-1805](https://linear.app/supabase/issue/DOCS-1805/request-a-self-hosted-review-on-each-self-hosted-docs-pr)

## Solution

The self-hosted docs pages are owned by `@supabase/docs` and
`@supabase/self-hosted`, the team that already owns `/docker/`. Two
patterns cover them:

- `apps/docs/content/guides/self-hosting*`: the `self-hosting/` folder
and `self-hosting.mdx`
- `apps/docs/content/guides/**/*self-hosted*`: any guide whose file name
contains `self-hosted`, such as `grafana-self-hosted.mdx` and
`expose-self-hosted-queues.mdx`, in `.mdx` or `.md`

The last matching line in CODEOWNERS wins, so the new lines sit after
`/apps/docs/` and keep `@supabase/docs` as an owner. A PR that changes
one of these pages requests a review from both teams.

## Review instructions

1. Check that GitHub reports no CODEOWNERS errors: `gh api
"repos/supabase/supabase/codeowners/errors?ref=alexisa/DOCS-1805"`
returns `"errors": []`.
2. Check which files the two patterns match. They follow `.gitignore`
rules, so `git check-ignore` can list the matches:

   ```bash
printf
'/apps/docs/content/guides/self-hosting*\n/apps/docs/content/guides/**/*self-hosted*\n'
> /tmp/co.ign
git ls-files apps/docs | git -c core.excludesFile=/tmp/co.ign
check-ignore --no-index --stdin
   ```

The list has 25 files: the `self-hosting/` pages, `self-hosting.mdx`,
and the guides with `self-hosted` in the name.
3. After merge, open a PR that changes a self-hosted page, and check
that GitHub requests a review from `@supabase/self-hosted`.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide).
Doesn't apply: this PR changes only CODEOWNERS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation self-hosted Related to self-hosted Supabase

Projects

Development

Successfully merging this pull request may close these issues.

1 participant