Configuration
The pidief server is configured with environment variables.
Environment variables
| Variable | Default | Description |
|---|---|---|
PIDIEF_ADDR | :3000 | listen address |
PIDIEF_API_KEYS | (empty) | comma-separated keys for X-Api-Key; empty disables authentication (development only) |
PIDIEF_MAX_REQUEST_MB | 50 | request body limit |
PIDIEF_CONCURRENCY | min(4, CPUs) | operations running at once |
PIDIEF_QUEUE_SIZE | 100 | requests that may wait for a slot; more get 429 |
PIDIEF_QUEUE_TIMEOUT | 30s | how long a request waits for a slot before 503 |
PIDIEF_MAX_TIMEOUT | 120s | upper bound of the timeout parameter |
PIDIEF_ALLOW_EXTERNAL | false | allow the allowExternal parameter (HTML loading internet resources) |
PIDIEF_JOB_TTL | 15m | how long finished job results are kept |
PIDIEF_MAX_JOBS | 200 | jobs kept in memory |
PIDIEF_METRICS_PUBLIC | true | serve /metrics without a key |
PIDIEF_CHROMIUM_PATH | auto | Chromium path (/usr/bin/chromium-headless-shell in the image) |
PIDIEF_CHROMIUM_NO_SANDBOX | false | true in the image (containers lack user namespaces) |
PIDIEF_CHROMIUM_RESTART_AFTER | 200 | restart Chromium after this many conversions |
PIDIEF_RASTER_WORKERS | 2 | PDFium WebAssembly instances |
PIDIEF_SHUTDOWN_TIMEOUT | 30s | graceful shutdown wait |
PIDIEF_LOG_LEVEL / PIDIEF_LOG_FORMAT | info / json | structured logs (slog) |
Metrics
/metrics exposes Prometheus metrics:
pidief_operations_total{op,status}pidief_operation_duration_secondspidief_input_bytespidief_operations_runningpidief_operations_waiting- plus Go and process metrics
Resource usage
Measured with the repository's scripts/measure.sh pidief:dev 8 40 on Docker Desktop (amd64), PIDIEF_CONCURRENCY=4, with a 300-row table rendered to 10 pages with page numbers:
| Measure | Value |
|---|---|
| Image size (amd64 / arm64) | 256 MiB / 258 MiB |
| Idle memory (Chromium warm) | ~71 MiB |
| Peak memory, 8 concurrent requests | ~191-194 MiB |
| 40 requests, 8 concurrent | 40/40 ok in 8.5 s |
| Latency (10 pages) | p50 0.62-0.75 s, p95 1.2-1.8 s |
Numbers depend on the CPU. In production, a 1 GB memory limit and --shm-size 256m are recommended.
Security defaults
- External network requests from HTML are blocked by default (
allowExternal=false), and the server can forbid the parameter entirely withPIDIEF_ALLOW_EXTERNAL. - The container runs as a non-root user with a read-only root.
- Request size and concurrency are limited.