Legacy Screening Platform Refactor
A screening platform that returned 500s on core screens, spiked two servers, and came with one explanation: "it works on my local". I fixed it by counting first.
Software Engineer, refactor lead
2026, Integrity Asia
Azure, Azure SQL, Application Insights
2 servers → 1, database tier halved
What was actually wrong
Opening two of the platform's core screens ended in an HTTP 500. Everything else was slow, and two production servers of four CPUs and 16 GB each still spiked CPU and memory. When I asked why, the answer was usually the same: "I don't know. It works on my local."
A bug nobody can explain is a bug nobody fixes. So the refactor started with one rule: no fix without a number.
Count first, then cut
Application Insights and the SQL history showed where the time went. It was not the servers. It was the data access layer: one edit flow alone issued 877 SQL statements.
Every fix followed the same steps: count the statements, cut them where they are issued, and prove the output is identical before and after.
Every change has a commit, a source document and a number. A fix that cannot show its before and after is not a fix yet.
The release was planned for mid-November. Performance became critical first, so it went to production in October.
Four issues after release. None came from the refactored queries.
They came from what surrounded the application: a sync job that ran outside it under an ambiguous name, browser code without tests, an outdated report template, and a feature users had not been told how to set up. All four were fixed in production or staged within days.
The lesson I keep: a legacy system's real boundary is never its repository. Inventory the jobs, scripts and habits around it before you change what is inside.
Make the invisible SQL visible
Most of the remaining database load came from manually executed SQL, not from the application. I proposed turning those queries into tracked features, so they can be optimised and audited, and direct database access can be restricted.
The same stability made the next step possible: rebuilding the platform properly, instead of under pressure.
A sales performance dashboard recomputed everything on demand against a legacy system I was not allowed to touch, query directly, or ask for a push feed. Here is what I could change, and what it cost.