⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 54 of 54 in Databases & Storage
Senior Cloud Engineer (L2) Database Cloud Migration & RDS Performance L2 Cloud Screen

Q: After migrating an application to AWS, the RDS instance is running very slowly. How would you troubleshoot the performance issue and identify the root cause?

Root cause analysis runbook for database query degradation after migrating an on-premises database to AWS RDS.

#Database #AWS #RDS #Performance Insights #Cloud Migration #IOPS #PostgreSQL
🎙️ Candidate Opening & Architectural Context
"When a newly migrated database on RDS performs significantly worse than on-premises, the degradation is rarely caused by the AWS cloud itself. It is caused by architectural mismatches: ungathered post-migration optimizer statistics, undersized storage IOPS, missing parameter group tuning, network latency across AZs, or missing indexes that were omitted during dump/restore."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

1

Analyze AWS Performance Insights & Database Load (AAS)

Open RDS **Performance Insights**. Inspect Average Active Sessions (AAS) against the Max vCPU line. Break down load by: - **Wait States**: Are sessions waiting on `io/table/scan`, `Lock:row`, `CPU`, or `Client:ClientRead`? - **Top SQL**: Identify the top 3 queries consuming 80% of database time.

Enable Performance Insights→Inspect Wait States vs vCPU→Identify Top SQL Queries→Analyze EXPLAIN Query Plan→Tune Storage & Parameters
2

Check Table Statistics & Execute VACUUM / ANALYZE

During standard database migrations (pg_dump/restore or AWS DMS), table data is imported but query optimizer statistics are empty. Without updated histogram statistics, the query planner chooses catastrophic Sequential Scans instead of Index Scans.

-- For PostgreSQL: Immediately re-analyze all tables post-migration
ANALYZE VERBOSE;
-- For MySQL:
ANALYZE TABLE orders, customers, transactions;
Advertisement
3

Verify Storage IOPS & gp2/gp3 Volume Bottlenecks

Check CloudWatch metrics: `ReadIOPS`, `WriteIOPS`, `ReadLatency`, `WriteLatency`, and `DiskQueueDepth`. If average read latency exceeds 10ms, storage is bottlenecking. Upgrade storage to gp3 with provisioned 12,000 IOPS or io2.

# Check CloudWatch RDS Latency
aws cloudwatch get-metric-statistics \
  --namespace AWS/RDS \
  --metric-name ReadLatency \
  --dimensions Name=DBInstanceIdentifier,Value=prod-db \
  --start-time $(date -u -v-2h +%Y-%m-%dT%H:%M:%SZ) \
  --end-time $(date -u +%Y-%m-%dT%H:%M:%SZ) \
  --period 300 --statistics Average
4

Audit Network Placement (Multi-AZ & Application Colocation)

Ensure the application EC2/EKS pods are located in the **same AWS Region and Availability Zone** as the primary RDS instance. If the app is in `us-east-1a` and primary RDS is in `us-east-1b`, every database round-trip incurs 1-2ms of cross-AZ network latency.

💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Slow RDS performance post-migration is primarily caused by missing optimizer statistics (run ANALYZE immediately), insufficient storage IOPS, default parameter group limits, or cross-AZ network latency."
⚡ 60-Second Elevator Pitch Talking Points
  • Use RDS Performance Insights to analyze Average Active Sessions and dominant wait events.
  • Run ANALYZE immediately: newly restored databases lack optimizer statistics and default to table scans.
  • Inspect storage read/write latency in CloudWatch to detect IOPS throttling.
  • Verify that application servers and the primary database reside in the same Availability Zone.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →