blog-banner

Brazil's Nubank uses CockroachDB for application resiliency and scale

Last edited on June 25, 2021

0 minute read

    Nubank, a leading Brazilian financial technology company valued at more than $45 billion dollars, needed a scalable SQL database for its critical credit card authorization service. The company initially stored data for this service on-prem using an in-memory data store, but as the business rapidly grew (from 12 million customers in 2019 to 40 million customers in 2021), it needed a more scalable solution that would not rely so much on memory and enable Nubank to keep growing.

    Nubank’s Authorizer team chose CockroachDB due to its ultra-resilience, simple scalability, strong consistency, and easy maintenance. They set up on-prem CockroachDB deployments and migrated their credit card authorization application.

    How to expand into new countries without creating an operational nightmareCopy Icon

    Nubank is a Latin American digital bank with headquarters in Brazil. Founded in 2013, it quickly grew to become the highest valued private digital bank in the world, with over 40 million customers. Nubank was built to address Brazil’s excessively high borrowing rates and poor banking customer experience. The company offers fee-free credit cards, digital savings accounts, personal loans, and life insurance — which are all accessible from mobile devices.

    As Nubank’s business grew and its customer base expanded into Mexico and Colombia, it needed to evolve its application architecture.

    The first iteration of infrastructure was built with Java Heap using an in-memory data store. However, this infrastructure was operationally complex and poorly scalable. For example, the bank’s credit card authorizer service (which decides whether or not to approve transactions) was spread across several instances of Java Heap, and a Kafka message communicated data changes between the instances. The team found that Java Heap was not sufficient to store this kind of data.

    The team decided they needed a more sophisticated database solution that would fit their scaling needs and so began evaluating options.

    An always on, never down experience for their customersCopy Icon

    Nubank’s Authorizer team had several requirements for their new solution.

    • Resiliency was important, as they need to provide always-on service for their customers.

    • A horizontally scalable database that could meet a guaranteed level of consistency, in order to support their large volume of transactions.

    • Nubank also demands simplicity, so the team wanted the new database to improve the efficiency of developer and infrastructure teams.

    • The team also sought a solution with minimal operational upkeep.

    A database that combines consistency, resiliency, and scaleCopy Icon

    The Nubank Authorizer team evaluated multiple databases, including Cassandra and CouchDB. Ultimately, they decided that CockroachDB best met their unique requirements. CockroachDB’s combination of consistency and scalability provides a solid foundation for Nubank’s credit card authorization system.

    CockroachDB was built to achieve strong consistency and guarantee the highest level of isolation (serializable isolation). At the same time, CockroachDB also scales automatically. Data is broken into 64-megabyte chunks called ranges that distribute and balance across nodes. If a user wants to add an additional node, he or she simply spins it up and points it at the cluster. Nubank has initially deployed CockroachDB on-prem in three locations, and if they choose to migrate to the cloud, CockroachDB’s flexibility and scalability will allow them to seamlessly transition.

    Resiliency is also built into CockroachDB, helping Nubank achieve the always-on service it requires. CockroachDB replicates all ranges three times and stores the replicas in a way that maximizes geo-diversity. The replicas are spread across nodes of a cluster, which together forms a single logical database. Depending on the cluster’s topology and how many machines and regions are involved, the replicas could be located across multiple regions, data centers, machines or all of the above. This replication ensures survival in the event of failure.

    In addition, CockroachDB’s standard SQL interface, which is PostgreSQL wire compatible, allows developers to communicate easily with the database. The infrastructure team has benefitted from CockroachDB’s automated backups, automated garbage collection, and rolling upgrades. These features give them more freedom to focus on helping Nubank to keep evolving.

    CockroachDB is the mission-critical database backing Nubank’s unique credit card authorization systemCopy Icon

    CockroachDB is now the mission-critical database backing Nubank’s credit card authorization system. It provides the availability, scale, consistency, and simplicity the Authorization team relies on to keep credit card authorizations flowing while the company itself keeps on growing.

    Additional resources: Copy Icon

    Finance
    Customer
    Customer Story
    Case Study
    Migration
    Distributed SQL
    Multi-Region
    Data Privacy
    Case Study
    Payment System
    System of Record
    Nubank
    Fintech