Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions apps/demo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ const FOLD_CONFIG = {

export class FoldDemo extends Container {
defaultPort = 8080;
// The uptime monitor pings every 5 minutes, so in practice this never
// sleeps; the timeout is the backstop if monitoring stops.
// This is now the only thing bounding what the container costs. It used to
// be a backstop — the uptime monitor pinged every 5 minutes, so in practice
// the container never slept — but that monitor is undeployed, so an idle
// hour after one visitor is an hour of provisioned memory and disk on the
// bill. Shorten it to trade a ~1.7s cold start for that tail.
sleepAfter = '1h';
enableInternet = true; // fold dials the public upstreams
envVars = { FOLD_CONFIG: JSON.stringify(FOLD_CONFIG) };
Expand Down
15 changes: 14 additions & 1 deletion apps/demo/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@
{
"class_name": "FoldDemo",
"image": "./Dockerfile",
"instance_type": "basic",
// Memory and disk are billed on what is *provisioned*, for every awake
// second; only CPU is billed on what is used. An oversized instance
// therefore costs full price to sit idle, which is most of what a
// gateway does. `lite` is 256 MiB / 2 GB / (1/16) vCPU, and that is
// measurably enough: under exactly those limits, fold v1.13.0 on this
// config boots in 1.65s and idles at 9.7 MiB, peaking at 12.1 MiB across five concurrent federated sessions. There is
// no dial between this and `basic` and nothing below it — a custom
// instance type needs a minimum of 1 vCPU and 3 GiB per vCPU, so the
// smallest one that can be configured is larger than `basic`. Because
// CPU bills on utilization, `lite` and `basic` cost the same to compute
// with; the 1/16 vCPU is a ceiling on bursts, not a saving. That ceiling
// is what to watch if fan-out gets slow with many upstreams, and going
// back to `basic` is this one line.
"instance_type": "lite",
"max_instances": 1
}
],
Expand Down
5 changes: 3 additions & 2 deletions apps/enterprise/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,9 @@ const FOLD_CONFIG = {

export class FoldEnterprise extends Container {
defaultPort = 8080;
// The uptime monitor keeps this warm the same way it does the demo; the
// timeout is the backstop if monitoring stops.
// The same billing lever as the demo's, and the same caveat: the uptime
// monitor that used to keep this warm is undeployed, so this timeout alone
// decides how long an idle container stays on the bill.
sleepAfter = '1h';
enableInternet = true; // fold dials the public upstreams and the issuer's JWKS
envVars = { FOLD_CONFIG: JSON.stringify(FOLD_CONFIG) };
Expand Down
15 changes: 14 additions & 1 deletion apps/enterprise/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,20 @@
{
"class_name": "FoldEnterprise",
"image": "./Dockerfile",
"instance_type": "basic",
// Memory and disk are billed on what is *provisioned*, for every awake
// second; only CPU is billed on what is used. An oversized instance
// therefore costs full price to sit idle, which is most of what a
// gateway does. `lite` is 256 MiB / 2 GB / (1/16) vCPU, and that is
// measurably enough: under exactly those limits, fold v1.13.0 on this gateway's larger
// config boots in 1.75s and idles at 11.0 MiB, under 5% of the cap. There is
// no dial between this and `basic` and nothing below it — a custom
// instance type needs a minimum of 1 vCPU and 3 GiB per vCPU, so the
// smallest one that can be configured is larger than `basic`. Because
// CPU bills on utilization, `lite` and `basic` cost the same to compute
// with; the 1/16 vCPU is a ceiling on bursts, not a saving. That ceiling
// is what to watch if fan-out gets slow with many upstreams, and going
// back to `basic` is this one line.
"instance_type": "lite",
"max_instances": 1
}
],
Expand Down
Loading