Large scale database migration case study on AWS
Sharing super complex database migration.... Firmex, AWS customer, successfully migrated 65,000 on-premises Microsoft SQL Server databases to Amazon Aurora PostgreSQL-Compatible Edition with following interesting highlights:
Why migration:
Firmex managed 65,000 databases across four Microsoft SQL Servers and was approaching the 32,000 database limit per server
How this situation arrived:
They were using Microsoft SQL Server databases to store all their customers' data, with each customer having their own separate database for security. They had about 65,000 of these databases, and they were running into a limit of how many databases they could have on their servers.
Business objectives:
kind of like moving 65,000 filing cabinets to a new building while making sure nothing gets lost and everyone can still access their files. They had to:
* Rewrite all their database instructions to work with the new system
* Move all the data carefully without disrupting their customers
* Make sure everything remained secure and worked faster than before
* The move was successful and ended up saving them a lot of money - over $125,000 Canadian dollars per year - and they no longer had to worry about buying and maintaining their own servers.
Key Insights:
Migration Scale and Scope:
➡️ Firmex migrated 65,000 databases from on-premises SQL Server to Amazon Aurora PostgreSQL
➡️ The entire migration project took 18 months to complete
➡️ Migration was executed in 45 waves over 3 months
Business Drivers:
➡️ Approaching SQL Server's database limit of 32,000 per server
➡️ Need to reduce licensing costs
➡️ Desire to move away from managing physical hardware
➡️ Requirements for better scalability and availability
Technical Achievements:
➡️ Converted 260 stored procedures from T-SQL to PL/pgSQL
➡️ Switched from database-based to schema-based isolation
➡️ Reduced database connections from 4,000-6,000 to 200-300
➡️ Downsized instances from r6g.8xlarge to r6g.2xlarge
Financial Benefits:
➡️ Saved over $125,000 CAD in yearly licensing costs
➡️ Achieved 75% reduction in RDS operating costs
➡️ Eliminated need for hardware purchases
Technical Challenges Overcome:
➡️ AWS DMS endpoint limits and API restrictions
➡️ High database connection counts
➡️ Bandwidth constraints
➡️ Temporary table performance issues
➡️ Complex data isolation requirements
Contrast and compare on before and after Migration
➡️ Database Isolation Approaches: SQL Server's database-based isolation vs PostgreSQL's schema-based isolation.
Recommended by LinkedIn
➡️ PostgreSQL's search_path feature offered better control over object resolution, while SQL Server required code deployment to each schema, making it less efficient.
➡️ Pre-Migration vs Post-Migration Infrastructure:
Before: Four on-premises SQL Servers with physical hardware maintenance
After: Cloud-based Aurora PostgreSQL with managed services Effect: Simplified maintenance, reduced costs, and improved availability
➡️ Database Connection Management:
Initial State: 4,000-6,000 connections with schema-specific connection pools
Optimized State: 200-300 connections with shared connection pooling Effect: Dramatically improved resource utilization and system performance
➡️ Instance Sizing Evolution:
During Migration: r6g.8xlarge instances
Post-Optimization: r6g.2xlarge instances Effect: 75% reduction in RDS operating costs while maintaining performance
➡️ Performance Metrics:
Original Performance: 113ms response time, 2-4 vCPUs usage
Optimized Performance: 27ms response time, <0.5 vCPU usage Effect: 75% improvement in response times with significantly lower resource consumption
Refer this blog for more details:
There are several answer remain answered:
Based on the document, several important questions remain unanswered:
1. Technical Details:
- What specific tools or methodologies were used to test and validate the converted stored procedures?
- How did they handle data validation during and after the migration?
- What was their rollback strategy if something went wrong during migration?
2. Operational Questions:
- What was the total data volume migrated?
- How many staff members were involved in the migration project?
- What was their disaster recovery plan during the transition period?
3. Business Impact:
- What was the total cost of the migration project?
- Were there any customer losses or business impacts during the migration?
- How long did it take to achieve ROI after the migration?
4. Security Considerations:
- How did they maintain security compliance during the migration?
- What specific security measures were implemented in the new PostgreSQL environment?
- How did they handle encryption of data in transit during migration?
5. Performance Metrics:
- What were the specific performance benchmarks before and after migration for all critical operations?
- How did the migration affect their overall system availability metrics?
- What was the actual downtime experienced by customers during their migration window?
I will answer these questions in my subsequent blog.
PostgreSQL expert (DBA) | Founder & CTO at autobase.tech
2moNow calculate how much you can save by migrating from Aurora to regular EC2 with the help of Autobase (autobase.tech) Our solution provides automation for high-availability PostgreSQL clusters, giving you full control over your database infrastructure without the additional costs of managed services.
Technology Leader | Cloud | IT Architecture | Cloud Solution Architect I Consulting | Azure | Kubernetes | Cloud Migration | Cloud Security | DevOps | Digital Transformation | Hybrid Cloud | TDM | Delphix
2mo125k savings for migrating 65000 databases ? How much did it cost to migrate all of them ?