The challenge
Growing transaction volume and resource-heavy reporting queries competed for the same database, affecting application responsiveness and order processing.
Constraints
- Order processing must keep reading its own writes; stale data there causes wrong decisions.
- Reporting needs large, slow queries that should not slow down customers.
- Changes had to land in a live platform, inside the existing .NET and Entity Framework code.
Options and trade-offs
Scaling the single database up buys time but keeps reporting and transactions competing. Separating reads onto a replica removes that contention, but introduces replication lag: a replica can be slightly behind the primary.
We accepted lag only where it is harmless. Writes and consistency-sensitive reads stay on the primary; reporting and eligible read-only queries move to the replica.
What I did and what the team did
I investigated slow queries and execution plans, made the AWS infrastructure changes, and directed, reviewed and deployed the backend changes with the engineering team, who implemented the application-side routing.
The solution
A managed read replica (Amazon RDS for SQL Server Enterprise) takes reporting and read-only workloads away from transactional operations. Separate database contexts route eligible reads to the replica, while writes and consistency-sensitive reads stay on the primary.
Frequently accessed, rarely changing data, such as filters, is cached in application memory with time-based expiry and invalidation on update. The cache later moved to AWS-managed Valkey.
Reliability considerations
- Routing is explicit per database context, so a query cannot drift onto the replica by accident.
- Cache entries expire and are invalidated on update, limiting stale reads.
Outcome
Improved application responsiveness, reporting performance and overall application performance, while reducing competing database load and repeated data access. No quantitative baseline is published.
Lessons
- Decide consistency per query, not per system: most reads tolerate a little lag, a few never do.
- Measure with execution plans before adding hardware.