Infrastructure Economics: Slashing Burn Rate by 65%
The Challenge
A portfolio of SaaS applications was bleeding budget across fragmented VPS instances. The infrastructure was over-provisioned for safety yet inefficient, wasting 20GB of RAM on idle processes. The goal was to consolidate this into a single, intelligent system without risking downtime during resource-heavy tasks.
1. Context: Operational Leverage
The partner ran a diverse suite of full-stack applications, ranging from resource-intensive art generation tools to standard data dashboards. The objective was straightforward: scale the portfolio without infrastructure costs scaling linearly. The existing setup was rigid—six separate servers costing over $77/mo, largely paying for idle CPU cycles and unused RAM. The vision was to transform this into a cost-elastic ecosystem.
2. Technical Constraints: The RAM Bottleneck
The core friction wasn't code capability, but resource efficiency. The legacy infrastructure consumed over 20GB of RAM across fragmented instances.
- Resource Hungry: Tools like Playwright (headless browsers) and SharpJS (image processing) created massive, unpredictable memory spikes.
- Consolidation Risk: Moving these onto a single, leaner server created a "noisy neighbour" risk. If a user generated art whilst a background scrape ran, the combined pressure would trigger an Out of Memory (OOM) crash, taking down the shared database.
3. Hardware Selection
To solve this, we selected a hybrid approach that treats resources as a dynamic commodity.
I. The Core (Stateful)
Role: Database, Redis, Background Workers.
Selection Logic: Raw, consistent performance for the database and workers.
| Component | Specification | Purpose |
|---|---|---|
| Instance | OVH Dedicated | Fixed cost stability for constant workloads. |
| RAM | 8 GB | Sufficient for DB + constrained worker queues. |
| Storage | NVMe SSD | High IOPS for database transactions. |
| Cost | ~$14.70 / month | Replaces multiple VPS instances. |
II. The Shell (Stateless)
Role: Frontends, API Layer.
Selection Logic: Traffic is spiky. Paying for 24/7 uptime for a frontend visited sporadically is waste.
| Component | Specification | Purpose |
|---|---|---|
| Service | Google Cloud Run | Scale-to-zero capability. |
| Cost | ~$5.00 / month | Pay only for active request processing. |
4. Implementation: The Queue as a Shock Absorber
We moved away from raw provision to orchestration.
The legacy architecture: fragmented and inefficient.
Hybrid State Management
We decoupled the stack. Stateless frontends now live on Cloud Run, scaling to zero when unused. This eliminates "paying for air".
Intelligent Queuing
For the heavy backend processes, we implemented BullMQ (Redis-based queuing) to manage the processes without crashing the server.
- Concurrency Limits: Jobs are serialised. The system never attempts to run more tasks than the 8GB RAM can handle.
- Smart Reuse: Browser instances for automation are kept "warm" for 5 hours. New requests reuse the existing instance, saving the massive CPU cost of booting a browser, but the instance is killed if idle to free RAM for the database.
The optimised architecture: stateless loads offloaded, stateful loads serialised.
Data Continuity
The legacy model relied on a fragmented backup policy—premium servers had 7-day retention, while budget nodes held only 24 hours of snapshots, creating a critical risk window. We replaced this with a unified strategy using Google Cloud Storage (Archive Class).
- Protocol: Daily incremental backups from the core server are pushed to GCS.
- Retention: Extended from 24h/7d to 90 days for all data.
- Cost Impact: Negligible (~$0.0012/GB/month) for vastly superior disaster recovery capability.
5. Results: Resilience & Stability
The transformation was validated through stress testing against the exact scenarios that made the old setup necessary.
- Peak Load: Simultaneous requests for image processing and browser automation were fired.
- Outcome: The queue held pending jobs, keeping RAM usage flat at ~6GB (leaving a safety buffer). The old architecture would have attempted immediate execution and crashed.
- Uptime: Zero downtime during migration and subsequent load tests.
6. Unit Economics and ROI
The project successfully converted a fixed, high-overhead burn into a lean, variable model.
- Previous Burn: $77.20 / month
- New Burn: ~$26.70 / month
- Reduction: 65%
By optimising the logic rather than upgrading the hardware, we secured an annual saving of ~$600—capital that can now be reinvested into growth rather than maintenance.
7. Future Roadmap: Scale by Exception
This infrastructure is designed for the long term.
- Storage: Integration of Google Cloud Storage to offload static assets from the main server, enabling cheaper long-term retention.
- Protocol: We established a "Scale-by-Exception" rule. If a specific service fills its queue consistently, only that service is ejected to a micro-VPS. The core infrastructure remains lean, ensuring costs only grow if revenue-generating activity grows.
The Impact
We architected a hybrid solution decoupling stateless frontends (Cloud Run) from stateful services (Dedicated). By replacing raw compute power with intelligent queuing (BullMQ), we fitted the entire workload into a streamlined 8GB environment, reducing monthly burn by 65% whilst improving peak-load reliability.
Run this measurement against your own system.
Deployment Audit: £500, fixed scope. Credited in full against the next stage.
What this costs