Problem
Core computations were pushed into PostgreSQL while the application tier used only a small fraction of available CPU. Scaling the existing design increased infrastructure cost without fixing the execution model.
Redesign
- moved the critical computation into an in-memory execution layer,
- used parallel CPU-bound processing for scoring workloads,
- kept the database for durable state rather than treating it as a compute engine,
- measured the machine as a whole rather than tuning a single query in isolation.
Outcome
Processing dropped from minutes to roughly one or two seconds, CPU resources were used effectively and infrastructure expenditure fell from approximately $70k to $7k.