Generating 10 documents a second is easy. The real test is the spike to 2000.
Invoices, contracts, payslips, quotes: document generation shares one thing with most business systems — it never runs at a constant load. A month-end billing run, a marketing campaign, a back-to-school enrollment period, and the volume of documents you need to generate can jump 10x in a few minutes.
There are two ways to handle that:
- Over-provision for the peak, all the time — and pay around the clock for capacity you only use a few hours a month.
- Scale dynamically — but only if you're scaling on the right signal.
That second part is where most setups get it wrong, and it's the difference between infrastructure you can trust and infrastructure that falls over exactly when the business needs it most.
Why "classic" CPU-based autoscaling isn't enough
Most cloud architectures scale on CPU or memory usage — a generic signal, built for a typical web server. Document generation has a different load signature: a single conversion can pin a CPU core for several seconds while other jobs sit waiting in a queue. Average CPU can look perfectly comfortable while a queue quietly builds up behind it — and the autoscaler only reacts once things are already backed up.
The signal that actually matters for a document engine is the number of jobs waiting to be converted — not the CPU spent converting them.
What Carbone makes possible: scaling on real load
Carbone EE natively exposes a metric for the number of reports currently being processed, along with their status (queued or converting). Self-hosted on AWS, that metric can be wired directly into the cluster's autoscaling:
- Carbone exposes its metrics (Prometheus)
- A collector sidecar relays them to CloudWatch
- CloudWatch exposes a custom "jobs queued" metric
- AWS Application Auto Scaling adjusts the number of running tasks
In practice: once the queue of pending jobs crosses the target threshold per task, a new Carbone task spins up within seconds — before generation times degrade for the end user. When load drops, the cluster scales back down automatically, with no manual intervention.
Carbone Cloud or self-hosted: same engine, your call
If you'd rather not think about any of this, Carbone Cloud already handles the scaling for you: spikes are absorbed on our side, with nothing to deploy or monitor.
But some teams need the engine inside their own infrastructure. That's what Carbone EE self-hosted is for, and why this pattern matters:
- Data residency and compliance: documents and business data never leave your VPC, which is often required by internal policies in finance, healthcare, or the public sector.
- Infrastructure-based cost at very high volume: you pay for the compute you run, which can change the economics when you generate millions of documents a month.
- Your own SLOs: capacity, quotas, and uptime follow your rules and your existing on-call setup.
- Native observability: it plugs into the stack you already run. CloudWatch here, but the same metrics work with Prometheus/Grafana, Datadog, or anything else.
Same templates, same API, same rendering engine. Only where it runs changes.
The deployment behind this pattern runs on AWS ECS Fargate — no servers to patch, EFS or S3 storage for templates and renders, a load balancer in front of multiple Carbone instances, and autoscaling driven by real load. The whole thing is available as ready-to-use Terraform.
The results
- Real elasticity — the cluster follows demand, not the other way around.
- Controlled cost — no "just in case" capacity paid for year-round to cover a monthly spike.
- Production resilience — the queue doesn't quietly build up until generation times blow past what users expect.
- Full autonomy — hosted in your own cloud, under your own security rules, quotas, and billing.
How to deploy it
The full Terraform module — VPC, ECS Fargate, load balancer, EFS/S3 storage, custom-metric autoscaling — is documented in our AWS ECS deployment guide, with the ready-to-use sample available on GitHub.
FAQ
Can Carbone scale automatically in production?
Yes. Carbone exposes load metrics (queued jobs, jobs converting) that can drive any autoscaling system — AWS Application Auto Scaling, Kubernetes HPA, or equivalent.
What's the difference between CPU-based and workload-based autoscaling?
CPU-based autoscaling reacts to resource consumption. Workload-based autoscaling — queue depth, in this case — reacts to the load users are actually experiencing, often before CPU becomes the limiting factor.
Do I need a Kubernetes cluster to scale Carbone?
No. This pattern runs on AWS ECS Fargate, with no servers or Kubernetes cluster to operate.
Can I host Carbone in my own cloud?
Yes — that's the whole point of self-hosting. Carbone EE deploys inside your own VPC, and your data never passes through a third-party service.
Want to see this running on your own AWS account? Talk to our team, and we'll walk you through a self-hosted setup tailored to your workload.