PF research library · 6 min read
r34 shared capacity settings
r34 documentation · shared-capacity.md
On this page
Current public-service and schema-10 upgrade instructions: r34 public service deployment. This includes both 2026-10-09 lifecycle packages. Large active-user capacity requires the measured qualification described there.
These hosted controls are part of the complete release, independently of whether
HF uses native persistence or optional external PostgreSQL. Use the actual
runtime settings in pf_saas/settings.py as the configuration contract. Names
below all have the PF_SAAS_ prefix. The scope matters: a per-process cap does
not become a whole-fleet cap by adding replicas. Standalone does not read these
hosted settings.
Database connections and deadlines
Setting (after PF_SAAS_) |
Default | Scope and meaning |
|---|---|---|
DATABASE_POOL_SIZE |
5 | Main SQL pool per database client |
DATABASE_MAX_OVERFLOW |
5 | Bounded extra main connections per client |
DATABASE_LEASE_POOL_SIZE |
1 | Lease engine connections; no overflow |
DATABASE_ASSISTANT_POOL_SIZE |
2 | Assistant SQL engine pool |
DATABASE_ASSISTANT_MAX_OVERFLOW |
0 | Assistant overflow |
DATABASE_POOL_TIMEOUT_SECONDS |
5 | Wait to acquire a pooled connection |
DATABASE_CONNECT_TIMEOUT_SECONDS |
5 | PostgreSQL connection establishment |
DATABASE_STATEMENT_TIMEOUT_MS |
30000 | PostgreSQL statement timeout |
DATABASE_LOCK_TIMEOUT_MS |
10000 | PostgreSQL lock wait; cannot exceed statement timeout |
DATABASE_IDLE_TRANSACTION_TIMEOUT_MS |
60000 | PostgreSQL idle-in-transaction timeout |
DEPLOYMENT_API_PROCESSES |
1 | Whole deployment's API process count |
DEPLOYMENT_WORKER_PROCESSES |
0 | Whole deployment's additional worker process count; set to actual count |
DATABASE_FLEET_MAX_CONNECTIONS |
100 | Configured service budget ceiling, within the database's real capacity |
DATABASE_RESERVED_CONNECTIONS |
10 | Administration/migration/other clients outside declared service pools |
Linux/Docker and managed PostgreSQL profiles use session advisory resource locks and SQL generation checks. Use direct or session-affine connections; transaction/statement pooling is unsupported for those service clients. The on-host reference already uses a direct local connection.
Native HF retains local per-resource filesystem locks on its single controller, with its global durable ownership/WAL fencing still enforced. It does not add SQL generation writes solely to coordinate these local resource operations. This native exception does not authorize a second controller or remove durable publication acknowledgement.
For PostgreSQL profiles other than native HF, the main pool plus overflow must
total at least four connections for shared resource-lock, publication and
callback work. Optional managed HF requires at least WORKER_SLOTS + 4.
Native HF retains its original per-pool bounds and combined connection ceiling;
the additional SQL resource-lock minimum does not apply to its local lock path.
The ordinary 5+5 main/overflow defaults satisfy all profiles at one worker slot.
The conservative validation budget is:
(main pool + overflow + lease pool + enabled assistant pool + assistant overflow) * (API processes + worker processes) + reserved connections.
The reference host and local Compose explicitly declare one API plus one worker;
with enabled assistant defaults their conservative budget is 36 connections.
The distributed example also declares one API plus one worker; with assistant
disabled it is 32. Update the counts before growing the fleet. Different pool
sizes across replicas require an equivalent conservative fleet calculation;
use identical settings in the supplied topology. A runtime declaration does
not change the PostgreSQL server's max_connections or reserve sockets itself.
Native HF additionally limits its combined main/lease/assistant configured pools
to 25, leaving headroom for its local PostgreSQL control and WAL services.
Connection, lock and statement limits bound different operations; they are not one end-to-end request deadline. Batch migration/backfill time must be qualified on a copy of the actual database. For a large migration, use an explicitly reviewed temporary migration-only statement limit; retain the application limit when normal services restart. No service should run mixed schema versions.
HTTP and browser work
| Setting | Default | Meaning |
|---|---|---|
API_MAX_INFLIGHT_REQUESTS |
64 | Concurrent requests per API process, including streams |
API_MAX_INFLIGHT_UPLOADS |
2 | Concurrent large uploads within that request cap |
API_USER_REQUESTS_PER_MINUTE |
600 | Authenticated account request rate; native HF uses its single-controller memory counter, other hosted profiles use shared SQL; 0 disables in profiles that permit it |
API_RATE_LOCAL_MAX_ACCOUNTS |
10000 | Maximum active account counters in the native HF memory limiter |
MAX_PARALLEL_EXPORTS |
2 | ZIP preparation/delivery operations per API process |
MAX_REQUEST_BYTES |
8388608 | Ordinary request body limit |
WORKFLOW_MAX_REQUEST_BYTES |
25165824 | Workflow request limit |
MAX_UPLOAD_BYTES |
104857600 | Uploaded asset limit |
MAX_ARTIFACT_BYTES |
536870912 | Artifact limit |
UI_POLL_ACTIVE_MS |
5000 | Active-work polling |
UI_POLL_IDLE_MS |
30000 | Idle polling |
UI_POLL_HIDDEN_MS |
60000 | Hidden-tab polling |
UI_POLL_MAX_BACKOFF_MS |
120000 | Error backoff ceiling |
UI_POLL_QUALIFICATION_MS |
60000 | Qualification refresh interval |
Native HF uses a bounded in-memory account limiter on its single controller so
ordinary authenticated reads do not create a durable SQL/WAL write solely to
count HTTP requests. It uses monotonic one-minute windows, resets its rate
counters on controller restart, and returns 429 when an account exhausts its
minute allowance or a new account cannot fit the active-counter bound. This
counter is intentionally not a durable quota/billing ledger. Native HF must
still have one controller; it is not a shared counter across replicas.
Linux/Docker and managed/distributed profiles retain atomic SQL account counters for requests across their service processes. Authentication throttling, authorization, native ownership fencing and durable job/provider/usage accounting remain in place. The native limiter does not bypass those checks.
Polling intervals must be 1,000..600,000 ms and increase from active through idle, hidden and maximum backoff. Shared browser scheduling adds jitter and avoids overlapping polls; stale selections are ignored. Authorized list routes use cursor pages (default 100, maximum 500), and the UI offers further pages. These reduce unnecessary work without changing project authorization.
Assistant and provider admission
| Setting | Default | Meaning |
|---|---|---|
ASSISTANT_BACKGROUND_WORKERS |
4 | Background threads per service process |
ASSISTANT_BACKGROUND_QUEUE_SIZE |
32 | Bounded pending background work per process |
ASSISTANT_TENANT_QUEUE_SIZE |
16 | Tenant queue bound within that executor |
ASSISTANT_CLEANUP_WORKERS |
2 | Cleanup executor bound |
ASSISTANT_ATTACHMENT_MAX_BYTES |
4194304 | Assistant attachment limit |
ASSISTANT_SNAPSHOT_MAX_BYTES |
268435456 | Assistant snapshot limit |
AI_ADMISSION_ENABLED |
true | Enable durable shared hosted provider admission |
AI_MAX_CONCURRENT_REQUESTS |
8 | Deployment provider-request concurrency |
AI_TENANT_MAX_CONCURRENT_REQUESTS |
2 | Per-tenant provider-request concurrency |
AI_PROVIDER_MAX_CONCURRENT_REQUESTS |
4 | Per-provider concurrency |
AI_REQUESTS_PER_MINUTE |
120 | Deployment provider-request rate |
AI_TENANT_REQUESTS_PER_MINUTE |
30 | Tenant provider-request rate |
AI_PROVIDER_REQUESTS_PER_MINUTE |
120 | Provider request rate |
AI_TOKENS_PER_MINUTE |
1000000 | Deployment estimated token admission |
AI_TENANT_TOKENS_PER_MINUTE |
250000 | Tenant estimated token admission |
AI_PROVIDER_TOKENS_PER_MINUTE |
1000000 | Provider estimated token admission |
AI_MONTHLY_COST_MICRO_USD |
0 | Deployment estimated cost cap; 0 disables this cap |
AI_TENANT_MONTHLY_COST_MICRO_USD |
0 | Tenant estimated cost cap |
AI_PROVIDER_MONTHLY_COST_MICRO_USD |
0 | Provider estimated cost cap |
AI_INPUT_COST_PER_MILLION_MICRO_USD |
0 | Conservative input-token tariff needed for a cost cap |
AI_OUTPUT_COST_PER_MILLION_MICRO_USD |
0 | Conservative output-token tariff needed for a cost cap |
Tenant/provider concurrency cannot exceed deployment concurrency. A positive cost ceiling requires both positive conservative tariffs. Zero cost ceilings are explicit absence of that particular cost cap, not free provider use. These are application estimates and admissions, not provider invoices. BYOK and operator credentials remain private; institution and project disclosure policy still applies. Ambiguous external outcomes retain accounting until reconciled; a timeout alone does not authorize duplicate requests or refund a reservation. Scientific execution capacity is separately admitted even when initiated by AI.
Jobs, maintenance and state
| Setting | Default | Meaning |
|---|---|---|
WORKER_SLOTS |
1 | 1..64 scientific execution slots per worker host/native HF controller |
SCHEDULER_BATCH_SIZE |
100 | Bounded queue candidate selection (maximum 1000) |
USER_MAX_CONCURRENT_JOBS / USER_MAX_QUEUED_JOBS |
0 / 0 | Single-profile unset per-user caps; distributed/managed require positive values |
MAX_CONCURRENT_JOBS / MAX_QUEUED_JOBS |
1 / 20 | Default organization plan caps |
DEPLOYMENT_BUDGET_ENABLED |
false | Optional single-host, mandatory distributed/HF execution admission |
DEPLOYMENT_MAX_CONCURRENT_JOBS / DEPLOYMENT_MAX_QUEUED_JOBS |
1 / 10000 | Shared admitted execution/queued caps |
DEPLOYMENT_MONTHLY_COMPUTE_SECONDS |
36000 | Shared execution reservation allowance when enabled |
MONTHLY_COMPUTE_SECONDS |
36000 | Default organization allowance |
MAX_JOB_SECONDS |
3600 | Scientific execution limit |
JOB_PREPARE_SECONDS / JOB_TRANSFER_SECONDS / JOB_COLLECT_SECONDS |
300 / 300 / 300 | Independent lifecycle phase limits |
JOB_SUBMIT_SECONDS |
60 | Submission phase limit |
LEASE_SECONDS |
60 | Job lease interval |
PROGRESS_INTERVAL_SECONDS |
5 | Coalesced progress interval |
MAINTENANCE_INTERVAL_SECONDS |
5 | Bounded maintenance cadence |
JOB_MEMORY_MB / JOB_CPUS / JOB_PIDS_LIMIT |
4096 / 2 / 128 | Scientific execution resource bounds |
Retain existing explicit organization/deployment storage and cost settings when upgrading; defaults are not a quota reset. See the distributed guide for worker host scaling, drain/termination settings and measured-capacity acceptance, and the native guide for native encrypted quota/persistence controls. Optional managed HF has additional TLS, readiness, state-migration and process settings in its own guide. Shared settings do not imply replicated native HF writers or a change to the scientific model.