Performance and resource limits
Budgets, limits and large templates. Advanced topics in the DocStudio developer reference.
Every function that handles untrusted input is bounded, so a hostile or accidental huge input cannot exhaust memory or time.
Core limits
DEFAULT_LIMITS holds the defaults and normalizeLimits accepts overrides up to the ceilings in LIMIT_CEILINGS. Limits count work instead of measuring time, so results are deterministic.
| Limit | Default | Ceiling |
|---|---|---|
maxTemplateNodes |
5,000 | 1,000,000 |
maxRepeaterRows |
100,000 | 10,000,000 |
maxExpressionDepth |
32 | 256 |
maxExpressionNodes |
2,000 | 100,000 |
maxEvaluationSteps |
1,000,000 | 1,000,000,000 |
maxCompositeDepth |
8 | 64 |
maxDiagnostics |
500 | 100,000 |
maxJsonDepth |
128 | 1,024 |
maxJsonChars |
16,777,216 | 536,870,912 |
Exceeding a limit is a LIMIT_EXCEEDED diagnostic, not a crash.
Designer budgets
The designer is tested against measured budgets in Chromium: a template of 1,000 flat nodes must load in under 5 seconds with a command p95 under 150 ms and a selection under 1 second. A template of 10,000 nodes must load in under 30 seconds with a command p95 under 1 second. At the default limit a 10,000 node template is refused with LIMIT_EXCEEDED and the page stays responsive.
PDF service limits
| Limit | Default |
|---|---|
| Concurrent jobs | 2 |
| Queue size | 16 (more is refused with 429) |
| Job timeout | 60 seconds |
| Request size | 20 million characters |
| PDF size | 200 MB |
Tips
- Keep templates well below the node limit by using repeaters and tables for repeated content.
- Pass only the data a document needs.
- Reuse one evaluator and one binder for many rows instead of creating them per row.
- Keep one PDF service per process.