🖥️
Sunil Notebook
Interview Preparation
  • 📒Notebook
    • What is this about ?
  • System Design
    • 💡Key Concepts
      • 🌐Scalability
      • 🌐Latency Vs Throughput
      • 🌐Databases
      • 🌐CAP Theorem
      • 🌐ACID Transactions
      • 🌐Rate limiting
      • 🌐API Design
      • 🌐Strong Vs eventual consistency
      • 🌐Distributed tracing
      • 🌐Synchronous Vs asynchronous Communication
      • 🌐Batch Processing Vs Stream Processing
      • 🌐Fault Tolerance
    • 💎Building Blocks
      • 🔹Message
      • 🔹Cache
      • 🔹Load Balancer Vs API Gateway
    • 🖥️Introduction to system design
    • ⏱️Step By Step Guide
    • ♨️Emerging Technologies in System Design
    • ☑️System design component checklist
      • 🔷Azure
      • 🔶AWS
      • ♦️Google Cloud
    • 🧊LinkedIn feed Design
    • 🏏Scalable Emoji Broadcasting System - Hotstar
    • 💲UPI Payment System Design
    • 📈Stock Broker System Design - Groww
    • 🧑‍🤝‍🧑Designing Instagram's Collaborative Content Creation - Close Friends Only
    • 🌳Vending Machines - Over the air Systems
    • Reference Links
  • DSA
    • Topics
      • Introduction
      • Algorithm analysis
        • Asymptotic Notation
        • Memory
      • Sorting
        • Selection Sort
        • Insertion Sort
        • Merge Sort
        • Quick Sort
        • Quick'3 Sort
        • Shell Sort
        • Shuffle sort
        • Heap Sort
        • Arrays.sort()
        • Key Points
        • Problems
          • Reorder Log files
      • Stacks and Queues
        • Stack Implementations
        • Queue Implementations
        • Priority Queues
        • Problems
          • Dijkstra's two-stack algorithm
      • Binary Search Tree
        • Left Leaning Red Black Tree
          • Java Implementations
        • 2-3 Tree
          • Search Operation - 2-3 Tree
          • Insert Operation - 2-3 Tree
        • Geometric Applications of BST
      • B-Tree
      • Graphs
        • Undirected Graphs
        • Directed Graphs
        • Topological Sort
      • Union Find
        • Dynamic Connectivity
        • Quick Find - Eager Approach
        • Quick Find - Lazy Approach
        • Defects
        • Weighted Quick Union
        • Quick Union + path comparison
        • Amortized Analysis
      • Convex Hull
      • Binary Heaps and Priority Queue
      • Hash Table vs Binary Search Trees
  • Concurrency and Multithreading
    • Introduction
    • Visibility Problem
    • Interview Questions
    • References
      • System design
  • Design Patterns
    • ℹ️Introduction
    • 💠Classification of patterns
    • 1️⃣Structural Design Patterns
      • Adapter Design Pattern
      • Bridge Design Pattern
      • Composite Design Pattern
      • Decorator Design Pattern
      • Facade Design Pattern
      • Flyweight Design Pattern
      • Private Class Data Design Pattern
      • Proxy Design Pattern
    • 2️⃣Behavioral Design Patterns
      • Chain Of Responsibility
      • Command Design Pattern
      • Interpreter Design Pattern
      • Iterator Design Pattern
      • Mediator Design Pattern
      • Memento Design Pattern
      • Null Object Design Pattern
      • Observer Design Pattern
      • State Design Pattern
      • Strategy Design Pattern
      • Template Design Pattern
    • 3️⃣Creational Design Patterns
      • Abstract Factory Design Pattern
      • Builder Design Pattern
      • Factory Method Design Pattern
      • Object Pool Design Pattern
      • Prototype Design Pattern
      • Singleton Design Pattern
    • Java Pass by Value or Pass by Reference
  • Designing Data-Intensive Applications - O'Reilly
    • Read Me
    • 1️⃣Reliable, Scalable, and Maintainable Applications
      • Reliability
      • Scalability
      • Maintainability
      • References
    • 2️⃣Data Models and Query Languages
      • Read me
      • References
    • Miscellaneous
  • Preparation Manual
    • Disclaimer
    • What is it all about?
    • About a bunch of links
    • Before you start preparing
    • Algorithms and Coding
    • Concurrency and Multithreading
    • Programming Language and Fundementals
    • Best Practices and Experience
  • Web Applications
    • Typescript Guidelines
  • Research Papers
    • Research Papers
      • Real-Time Data Infrastructure at Uber
      • Scaling Memcache at Facebook
  • Interview Questions
    • Important links for preparation
    • Google Interview Questions
      • L4
        • Phone Interview Questions
      • L3
        • Interview Questions
      • Phone Screen Questions
  • Miscellaneous
    • 90 Days Preparation Schedule
    • My Preparation for Tech Giants
    • Top Product Based Companies
  • Links
    • Github
    • LinkedIn
Powered by GitBook
On this page
  • Functional Requirements
  • Non Functional Requirements
  • Envelope Calculations
  • Capacity Estimations
  • Components
  • Tech Stack
  • References

Was this helpful?

Edit on GitHub
  1. System Design

UPI Payment System Design

As per the recent data from the economic times, In 2023 number of UPI transactions are around 117.6 Billion transactions with total value of 182 lakh crore.

PreviousScalable Emoji Broadcasting System - HotstarNextStock Broker System Design - Groww

Last updated 10 months ago

Was this helpful?

Functional Requirements

  • Users can link their bank accounts.

  • Users can send and receive money using UPI IDs.

  • Users can check their transaction history.

  • Users can set a UPI PIN for secure transactions.

  • Users can receive notifications for transactions.

  • Users can receive payments using scanner.

Non Functional Requirements

  • High availability and scalability to handle millions of transactions.

  • Low latency to ensure real-time transaction processing.

  • Strong security measures to protect sensitive financial data.

  • Compliance with regulatory requirements.

Envelope Calculations

In Jun 2024, 13.89 Billion transactions with amount of 20.27 Lakh crore with daily avg of 463 million transaction count.

Estimated Annual Transactions = 13.89 Billion * 12 = 166.68 Billion

We have daily average transaction count of 463 Million. But Lets consider peak situation with 1.3 times the average.

So Estimated Daily transactions per day would be around 463 * 1.3 = 601.9 Million transactions

Number of Transactions per hour: 601.9 / 24 = 25.08 Million

Number of Transactions per Second = 6967 ( Approx )

Capacity Estimations

In this sections we cover mostly about the Database storage requirement, network requirements, Server requirements and Bandwidth calculations.

Lets consider the transaction payload.

{
  "transactionId": "bc5fcc00-f47d-47b9-a424-5ca0bf93580a",
  "timestamp": "2024-07-17T14:30:00Z",
  "status": "SUCCESS",
  "amount": {
    "currency": "INR",
    "value": 1500.00
  },
  "sender": {
    "upiId": "sender@upi",
    "name": "Sunil Gudivada"
  },
  "receiver": {
    "upiId": "receiver@upi",
    "name": "Asish"
  },
  "note": "Payment for services",
  "metadata": {
    "merchantId": "6a107feb-e9cf-4db1-af27-c6a2e4bbff95",
    "transactionType": "P2P",  // P2P: Peer to Peer, P2M: Peer to Merchant
    "appName": "UPIApp"
  }
}

Size of this payload is about 373 B

Transaction storage calculation

Daily Storage: 463 Million * 373 B = 172.7 GB

Monthly Storage: 172.7 * 30 = 5.18 TB

Yearly storage: 172.7 * 365 = 63.04 TB

Network Bandwidth calculation

API Call Size:

Average Request/Response Size: 2 KB (including headers)

Daily API Traffic:

API Calls per Transaction: 3 (initiate, process, notify)

Total API Calls: 463 Million * 3 = 1.389 Billion

Data Transfer per Day: 1.389 Billion * 2 KB = 2.778 TB

Peak API Traffic:

Peak API Calls: 601.9 Million * 3 = 1.8057 Billion

Data Transfer per Day: 1.8057 Billion * 2 KB = 3.61 TB

Lets calculate the number of servers required.

Assume avg time taken by the request to complete around 50 Millisecond (MS)

Number of api calls at peak hours : 463 Million / 86400 = 5358.81 transactions per second

Throughput: 5358.81 * 50 = 267940.5 RPS

Consider one server is accepting 1000 Request per second

Number of servers: 267940.5 / 1000 = 267.9405 = 268 ( API Gateway )

Lets also calculate the number of servers required for the Backend services like User, VPA, Transaction, Bank Integrations.

Assume these microservices can process 200 request per second

Number of servers: 267940.5/ 200 = 1340 Servers

Components

Tech Stack

NPCI partnered with kyndryls cloud services for TARM Stack

Below details about the TARM Stack given by chatGPT. May be incorrect.

The TARM stack is an emerging modern web development stack that consists of:

  1. Tigris: An open-source NoSQL database that supports both key-value and document models. Tigris is designed for high performance and scalability.

  2. Appwrite: An open-source backend-as-a-service platform that provides a set of APIs to handle authentication, databases, storage, and server-side functions. It's a self-hosted Firebase alternative.

  3. Remix: A modern JavaScript framework for building robust, dynamic, and SEO-friendly web applications. Remix emphasizes server-side rendering (SSR) and works seamlessly with modern JavaScript tools and libraries.

  4. Meilisearch: An open-source, fast, and relevant search engine that can be integrated into web applications to provide powerful search functionalities.

Key Features and Benefits of TARM Stack:

  1. Scalability and Performance: Each component in the TARM stack is optimized for high performance and can handle large volumes of data and traffic.

  2. Developer-Friendly: The stack is designed to be easy to set up and use, with extensive documentation and community support.

  3. Open-Source: All components are open-source, which provides transparency, flexibility, and cost-effectiveness.

  4. Full-Stack Capabilities: The stack covers backend, frontend, database, and search functionalities, making it a comprehensive solution for web development.

References

https://drive.google.com/file/d/1qckD_J_v6kRAOTuZT2-rHeZkcHQ5a1wZ/view?usp=sharing
https://economictimes.indiatimes.com/industry/banking/finance/total-upi-transactions-cross-100-billion-mark-in-2023/articleshow/106492755.cms?from=mdr
https://www.npci.org.in/
https://www.itnews.asia/news/indias-npci-modernises-data-centres-using-kyndryls-cloud-services-592061
https://www.tigrisdata.com/
https://www.enterpriseitworld.com/kyndryl-to-target-a-market-size-of-530-billion/
https://www.linkedin.com/posts/kyndryl-india_kyndryl-and-npci-at-bharat-fintech-summit-activity-7029706712915836928-3mIx?utm_source=share&utm_medium=member_desktop
💲
Recent Post by NPCI in linkedIn
UPI Payment Flow
UPI Payment System Design - Component Checklist
Page cover image