Running function runners
Functions are first-party code that the platform runs for you. The platform stores and versions them; runners execute them. This page is about deploying and operating runners. For what a function is, see functions; for the runtime’s internals, see functions runtime.
Which runtime runs where
Section titled “Which runtime runs where”| Runtime | Artifact | Runs in |
|---|---|---|
wasm |
A WebAssembly module (ABI v1), from the Go or Rust function SDKs | The function runner in fc-server (wazero) |
js |
A bundled script, from the TypeScript function SDK | The same runner, in an embedded JavaScript engine |
jvm |
A jar, from the Java function API | The ingestor runtime’s function host |
A function keeps the runtime of its first version: publishing a jar for a function that has Wasm or
JavaScript versions, or the reverse, is refused with RUNTIME_MISMATCH.
Runner pools
Section titled “Runner pools”Every function belongs to a runner pool (default unless it says otherwise). A runner process
serves exactly one pool, and loads only that pool’s functions. Pools let you isolate functions with
different needs (memory-hungry ones, a noisy team’s) on separate deployments.
The platform reaches a pool through a URL template:
| Variable (platform side) | Default | Meaning |
|---|---|---|
FC_FUNCTIONS_RUNNER_URL |
http://127.0.0.1:8095 |
The runner URL; {pool} is replaced by the pool name, for example http://fn-{pool}.functions.svc:8095 |
FC_FUNCTIONS_RUNNER_URL_<RUNTIME> |
unset | A per-runtime override with the same templating, <RUNTIME> being the runtime tag upper-cased. FC_FUNCTIONS_RUNNER_URL_JVM is how deliveries reach JVM functions in the ingestor |
The platform appends /fn/<address><path> to build each delivery target when a function is promoted
or dispatched to. Its own runner URLs are exempt from the outbound guard.
Deploying a runner pool
Section titled “Deploying a runner pool”Runners run from the same fc-server image with only the runner switched on. A runner-only process
needs no database.
| Variable | Value |
|---|---|
FC_PLATFORM_ENABLED |
false |
FC_FUNCTIONS_ENABLED |
true |
FC_FUNCTIONS_POOL |
The pool this deployment serves (default default) |
FC_FUNCTIONS_PLATFORM_URL |
The platform’s internal base URL (control plane and token endpoint). Required for a runner-only process |
FC_FUNCTIONS_CLIENT_ID, FC_FUNCTIONS_CLIENT_SECRET |
A service account holding platform:function-runner. Required |
FC_FUNCTIONS_PORT |
8095: the private entry (/fn/..., /metrics, /healthz, /readyz) |
FC_FUNCTIONS_PUBLIC_PORT |
0 (off): the public entry for public routes |
FC_FUNCTIONS_MEMORY_LIMIT_MB |
0: detect from the cgroup, then physical memory |
FC_FUNCTIONS_MEMORY_RESERVE_MB |
0: the larger of 128 MiB and 10 % of the limit, at most half |
FC_FUNCTIONS_CACHE_DIR |
A writable directory for downloaded artifacts (use a volume with a read-only root file system) |
Without a platform URL or credentials the runner logs an error and does not start; the rest of the process keeps running. Without a detectable memory limit and no explicit one, it does not start.
On the platform side, set FC_FUNCTIONS_ARTIFACT_STORE (an s3:// URL, or a shared file://
directory) on the API tier. With an S3 store the runner downloads artifacts through presigned URLs;
with a file store, through the platform.
Memory
Section titled “Memory”Function instances live outside the Go heap. The runner budgets them from limit − reserve, charges
each instance’s memory against that budget, and refuses a call it cannot fit (503 FUNCTION_UNAVAILABLE, “no capacity”) rather than overcommitting. When the runner is the only
subsystem in its process it also sets the Go memory limit to the reserve. Compiled code of versions
nobody has called for FC_FUNCTIONS_IDLE_EVICT_SECONDS (1800) is dropped, and a version marked
warm keeps its live instance loaded.
Watch fc_fn_memory_used_bytes against fc_fn_memory_budget_bytes, and
fc_fn_memory_refused_total.
Scaling
Section titled “Scaling”Run several replicas of a pool behind one internal service address and point the URL template at it. Each replica loads the pool’s functions independently.
- Limits are per process. A function’s concurrency limit (16 by default) and its memory are enforced by each runner on its own: three replicas allow up to three times the concurrency.
- Busy is a deferral. A call over the concurrency limit gets
429 FUNCTION_BUSY; deliveries treat that as “try again later” and spend no attempt. - Platform-to-runner traffic is the platform’s delivery callback calling the runner, so runner load follows dispatch volume to functions.
Health and restarts
Section titled “Health and restarts”GET /healthzfails (503) when four or more calls are stuck past their deadline plus grace: those calls cannot be killed, so the process should be replaced. Use it as the liveness probe.GET /readyzfails until the runner has loaded its desired state, during shutdown, and while unhealthy. Use it as the readiness probe.- Shutdown marks the runner not ready, answers new calls
503 FUNCTION_UNAVAILABLE(callers retry), lets calls in flight finish for up to 45 seconds, then unloads. Give the container a stop timeout of at least 50 seconds and roll one replica at a time. - Loading retries. A version whose artifact cannot be fetched for a transient reason stays
preparing and is retried with backoff (1 to 30 seconds, for up to
FC_FUNCTIONS_LOAD_RETRY_BUDGET_SECONDS, 300) before it is reportedFAILED. Permanent problems (missing artifact, digest mismatch, invalid module, compile error) are reportedFAILEDat once.
The public entry
Section titled “The public entry”A function’s public routes map a plain hostname and path prefix to a function, so that, for example,
https://api.example.com/webhooks/orders reaches a function without the /fn/... form. The runner
serves them on FC_FUNCTIONS_PUBLIC_PORT (off by default), routing by Host header. To use them:
- Set
FC_FUNCTIONS_PUBLIC_PORTon the pool’s runners. - Put a load balancer or ingress in front of that port, and point the hostnames’ DNS at it.
- Set
FC_FUNCTIONS_TRUSTED_PROXIESto the addresses of that proxy, soX-Forwarded-Foris believed only from it.
Keep the private port private: it is the platform’s delivery path.
JVM functions in the ingestor
Section titled “JVM functions in the ingestor”Functions written in Java run in the ingestor runtime’s function host, one instance per published version, each call on its own virtual thread. To enable them:
- On the platform, set
FC_FUNCTIONS_RUNNER_URL_JVMto the ingestor fleet’s address, for examplehttp://ingestor.internal:8091({pool}is substituted as usual). - Give the ingestor’s service account
platform:function-runneras well asplatform:ingestion-runtime. - On the ingestor,
INGEST_FUNCTIONS_ENABLED=true(the default) andINGEST_FUNCTIONS_POOLnaming the pool. A functions-only ingestor setsINGEST_INGESTION_ENABLED=false.
Host settings: INGEST_FUNCTIONS_DB_MAX_POOLS (32), INGEST_FUNCTIONS_DB_MAX_CONNS (4 per pool) and
INGEST_FUNCTIONS_DB_IDLE_TTL (PT10M) bound the database pools functions open; each function
address may log INGEST_FUNCTIONS_LOG_RATE (100) lines a second with a burst of
INGEST_FUNCTIONS_LOG_BURST (1000), beyond which lines are dropped and counted. The ingestor’s own
request-body limit (5 MiB by default) caps every function’s request body. See
running ingestor runtimes.
Platform settings that affect functions
Section titled “Platform settings that affect functions”| Variable | Default | Effect |
|---|---|---|
FC_FUNCTIONS_ARTIFACT_STORE |
file store at a fixed path | Where artifacts are kept; set it in every deployment |
FC_FUNCTIONS_KEEP_VERSIONS |
20 | Untagged versions kept per function |
FC_FUNCTIONS_TRACE_MAX_MINUTES, FC_FUNCTIONS_TRACE_HTTP_MAX_MINUTES |
60, 15 | Longest trace window |
FC_FUNCTIONS_TRACE_RETENTION_DAYS |
30 | Trace record retention |
FC_FN_TRACE_QUEUE, FC_FN_TRACE_QUEUE_BYTES (runner) |
5000, 32 MiB | Trace records buffered before shipping; the oldest are dropped when full |