Nubank, a prominent player in the digital banking landscape, has successfully navigated the complexities of scaling its payment infrastructure. With a customer base of approximately 135 million across Brazil, Mexico, and Colombia, Nubank’s digital payment solution, NuPay, faced significant challenges in managing its self-hosted PostgreSQL databases. Queries were taking over 13 minutes to execute, and replication lags often exceeded four minutes during peak periods, all while adhering to stringent regulatory requirements that restricted downtime.
The NuPay team aimed to enhance developer productivity, streamline operations, and ensure reliable performance under fluctuating loads. Managing 7.5 TB of payment data, which encompassed over 31 billion rows, resulted in inefficiencies that hampered both infrastructure teams and developers. Manual deployment, patching, and scaling became burdensome, while regulatory mandates for advance notice of downtime turned routine maintenance into complex coordination efforts. This operational strain led to degraded application performance during traffic spikes and necessitated scheduled downtime for storage expansions, directly affecting service availability.
In response to these challenges, Nubank initiated a thorough evaluation of database solutions, focusing on operational efficiency and developer experience. The team established a framework for assessing potential solutions based on four key dimensions: developer productivity, operational efficiency, performance reliability, and scalability.
Business challenge
The team sought a solution that would maintain PostgreSQL compatibility to leverage existing developer expertise and facilitate seamless integration with current business intelligence tools. They prioritized reducing management complexity through automation, requiring a fully abstracted infrastructure that would allow engineers to concentrate on innovation rather than maintenance.
Performance reliability was another critical criterion, with a need for high availability and consistent database behavior under production workloads. Nubank required a solution that could sustain low-latency responses even during maintenance operations, ensuring an uninterrupted user experience. Scalability considerations focused on cost efficiency and the ability to accommodate future growth without extensive manual intervention.
Database evaluation criteria
After evaluating various database options against their criteria, Nubank selected Amazon Aurora PostgreSQL-Compatible Edition as the preferred solution for its payment infrastructure. This choice was driven by Aurora’s ability to meet Nubank’s specific needs through key capabilities.
Why Nubank chose Aurora
Nubank deployed Aurora PostgreSQL-Compatible Edition 14.17, ensuring compatibility with their existing PostgreSQL version while leveraging Aurora’s unique features such as Query Plan Management and automated storage scaling. The architecture of Aurora was particularly well-suited for handling the massive scale of Nubank’s operations, delivering significant performance improvements.
Meeting payment infrastructure performance requirements
Aurora’s log-based write operations enhance write throughput and reduce latency by sending only redo log records to a distributed storage layer. Its shared storage architecture separates compute and storage, allowing for efficient memory utilization and faster query processing. The introduction of read replicas as automatic failover targets further bolstered availability and performance, minimizing downtime during issues.
Alleviating operational overhead
As a fully managed service, Aurora alleviated the burdens of manual deployment and maintenance. Automated storage scaling and maintenance tasks reduced downtime significantly, allowing Nubank to comply with regulatory requirements while minimizing service disruptions. The PostgreSQL compatibility ensured that developers could transition smoothly without extensive retraining, preserving development velocity.
Achieving cost-efficiency and security compliance
The pay-as-you-go pricing model improved resource utilization and reduced costs. Nubank consolidated its database instances from three to two while maintaining high availability, resulting in a 25 percent cost reduction post-migration. Aurora’s built-in security features aligned with Nubank’s regulatory requirements, ensuring compliance with industry standards.
“Aurora PostgreSQL transformed how we think about database infrastructure. Its fully managed architecture, with automatic storage scaling, built-in Multi-AZ high availability, and fast automatic failover across Availability Zones gave us the resilience and performance our payment application demands at scale.”
“AWS DMS was equally strategic: it reduced our actual cutover time to just over an hour, well within our 5-hour maintenance window. The dedicated support from our AWS Solutions Architect and migration specialist gave us precise guidance on best practices and the confidence to modernize our payment infrastructure with zero data loss and minimal downtime.”
Migration strategy
Nubank’s migration strategy utilized AWS Database Migration Service (AWS DMS) to facilitate a smooth transition from PostgreSQL to Aurora. The approach included Change Data Capture (CDC) for minimal downtime and multiple parallel migration tasks to enhance throughput. The migration was segmented into ten dedicated tasks, each addressing specific tables, which allowed for efficient progress and failure isolation.
Migration results
Upon completion of the migration, Nubank’s engineering team conducted extensive performance testing, validating the improvements across various workload categories. The results were striking, with query performance enhancements reaching up to 1,900 times faster in certain scenarios.
Query performance improvements
For large-scale historical scans, queries that previously took over 13 minutes were executed in mere seconds on Aurora, showcasing the dramatic efficiency gains. Complex join operations and financial aggregation workloads also experienced significant reductions in execution times, confirming the advantages of Aurora’s architecture.
End-to-end service latency comparison
Nubank observed measurable improvements in end-to-end service latency across their entire NuPay system post-migration. The reduction in application-level latency translated to faster payment processing and enhanced customer experience, while database replication consistency improved significantly, minimizing customer-facing issues.
Considerations and limitations
While the migration to Aurora PostgreSQL yielded substantial benefits, it is important to note that results may vary based on workload characteristics. Transactional workloads with frequent point lookups saw the most significant improvements, while complex analytical queries exhibited more incremental gains. For large-scale migrations, careful planning and coordination with AWS support are essential to ensure success.