Thursday, August 27, 2026

What is an Real Time payments (RTP)

 For an SRE interview, think of an RTP (Real-Time Payments) system as a highly available distributed system where a payment must move through multiple services within seconds without being duplicated or lost.

End-to-end RTP payment flow

Suppose A sends ₹10,000 to B:

Mobile App → API Gateway → Authentication → Payment Service → Fraud/Risk → Account/Ledger → RTP Network → Receiver Bank → Confirmation

The important stages are:

  1. Payment request — Customer submits amount and beneficiary information. The system creates a unique transaction/payment ID.

  2. Authentication — The bank verifies the customer using credentials, PIN, token, MFA, etc.

  3. Validation — Check account status, beneficiary details, transaction limits and available balance.

  4. Fraud/Risk check — Rules or models evaluate whether the transaction looks suspicious.

  5. Payment processing — The payment service records the transaction and coordinates the debit.

  6. RTP network — The sending institution sends the payment instruction through the relevant real-time payment rail/network.

  7. Receiving bank — The receiving institution validates the request and credits the beneficiary.

  8. Confirmation — Success/failure status travels back to the sender, and the transaction records are reconciled.

What an SRE needs to worry about

Imagine the customer taps Pay, but a network timeout occurs. The app doesn't know whether the bank actually processed the ₹10,000.

The customer taps Pay again.

You must prevent:

₹10,000 + ₹10,000 = ₹20,000 accidentally debited.

This is why idempotency is extremely important in payment systems. The same payment request should not create multiple financial transactions.

For example:

Payment ID: PAY-12345

Request #1 → timeout
Request #2 → same Payment ID

The payment service recognizes PAY-12345 and returns the existing transaction result instead of processing another debit.

Another important concept is transaction state:

CREATED
   ↓
VALIDATING
   ↓
PROCESSING
   ↓
SENT
   ↓
SUCCESS

Failures could lead to states such as:

FAILED
REJECTED
TIMED_OUT
PENDING

A PENDING transaction is particularly important. You cannot simply assume it failed, because the receiver may actually have been credited.

SRE monitoring

For RTP, I'd expect dashboards/alerts around:

Availability → latency → transaction success rate → error rate → pending transactions → timeout rate → duplicate attempts → queue lag → database health → downstream-bank/network failures.

Example SLO:

99.99% of payment API requests successfully processed, with 99% completing within the agreed latency target.

Very common interview question

Interviewer: "A customer says money was debited, but the beneficiary didn't receive it. How would you investigate?"

A strong SRE approach is:

Transaction ID → API logs → payment service → ledger/debit record → outbound message → RTP network response → receiving-bank response → transaction state → reconciliation

You should not immediately retry the payment, because that could create a duplicate.

This connects several important SRE topics you've been learning: SLA/SLO/SLI, load balancing, caching, Kubernetes, Prometheus, Elasticsearch and Kibana. RTP is a good system to use for practicing all of them together.

Payment Tech Key words

 RTP - real time payments

  • Payment rails: RTP, UPI, IMPS, NEFT, RTGS, ACH, SWIFT, SEPA, FedNow
  • Card payments: Issuer, Acquirer, Merchant, Payment Gateway, Payment Processor, Card Network, Authorization, Capture, Clearing, Settlement
  • Transaction lifecycle: Initiation, Authentication, Authorization, Processing, Clearing, Settlement, Reconciliation, Refund, Reversal, Chargeback
  • Payment messaging: ISO 8583, ISO 20022, SWIFT messages, pacs.008, pacs.002, pain.001
  • Security: PCI DSS, Tokenization, Encryption, HSM, TLS, 3-D Secure (3DS), MFA, CVV, Fraud Detection
  • Reliability/SRE: Idempotency, Retry, Timeout, Circuit Breaker, Rate Limiting, High Availability, Disaster Recovery, RTO, RPO
  • Distributed systems: Kafka, Event-driven architecture, Message Queue, API Gateway, Microservices, REST API, Eventual Consistency, Distributed Transactions
  • Observability: Prometheus, Grafana, Elasticsearch, Kibana, Distributed Tracing, Correlation ID, Transaction ID
  • Important payment states: Initiated, Pending, Authorized, Declined, Completed, Failed, Reversed, Refunded
  • Important metrics: TPS (Transactions Per Second), Success Rate, Decline Rate, P95/P99 Latency, Timeout Rate, Error Rate, Queue Lag
  • Saturday, August 10, 2019

    Dev Ops fundamental for beginners

    What is DevOps :-

    Case study :-

    1. Evaluation of software over the years.
    2. How Facebook uses devops ?
    3. What is devops ?
    4. Different DevOps tool.

    Traditional waterfall model :-

    1. Requirement gathering phase.
    2. Architecture designing phase
    3. Coding
    4. Testing and debug phase


    Then, the software get delivered, But over the period people start thinking this method is very slow. By the time the software get developed the requirement of the client has been changed. So agile methods come into the picture where a small chunks of features is being delivered every week or interval of time. This not only give confidence to the end user, but also allow the developer to change the features based on the feedback. Thereby lots of time and money can be saved by changes. Even though it reduced the time of development , but it lack the agility in operation.That's how devops come into the picture.

    Waterfall vs Agile


    What is devops :-

    It brings agility between development and operation.
    All the big companies has started this model agility between development and operation should go to hand on hand to deliver a full phase software.

    Facebook user case :-

    Back in 2011 Facebook has music and timeline. They have started deploying globally and that leads to trouble for Facebook. Facebook had 500M active user. So when all user came to know about exciting features about music and timeline, all the users started jumping to Facebook to explore the features.This lead to high usage of server and eventually it got down.It was a catastrophic situation for a company like Facebook. They got mixed feeling about newly added features like music and timeline, but some didn't like at all. So they have a tough time to incorporate the features and feedback. There they decided that they need a change the way the software get deployed. Post that they came with a process called DARK LAUNCHING TECHNIQUE. Many company still using this technique - Google, Facebook, Netflix. 

    What is Dark Launching Technique:-

    1. The new features are first deployed on a smaller & specific base.
    2. They are continuously monitor and the feedback are continuously developed and tested.
    3. Once the features are stable and they are deployed on other user bases in multiple released

    • Continuous Development
    • Continuous Testing
    • Continuous Integration
    • Continuous Deployment
    • Continuous Monitoring


    1. GIT or SVN (versioning)
    2. Puppet
    3. Jenkins
    4. Ansible
    5. Docker
    6. JIRA
    7. Gradle
    8. Selenium
    9. JUnit
    10. Vacant
    11. CHEF
    12. Saltstack
    13. Stack
    14. Nagios
    15. Splunk

    Saturday, May 4, 2019

    How To Reverse A String ?

    Java Code Example - 1 :-

    import java.io.*;
    import java.util.*;
    
    public class reverseString {
        public static void main(String[] args) {
            String input="";
            System.out.println("Enter the input string");
            try
            {
                BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
                input = br.readLine();
                char[] try1= input.toCharArray();
                for (int i=try1.length-1;i>=0;i--)
                System.out.print(try1[i]);
            }
            catch (IOException e) {
                e.printStackTrace();
            }
    }}
    
    

    Java Code Example - 2 :-

    package coreJava;
    
    public class StringRev2 {
    
     /**
      * @param args
      */
     public static void main(String[] args) {
      // TODO Auto-generated method stub
        String input="AliveisAwesome";
        StringBuilder input1 = new StringBuilder();
        input1.append(input);
        input1=input1.reverse(); 
        System.out.print(input1);  
     }
    }

    String in Java

    Java string :-

    • String is a final in java.lang package and not a keyword.
    • There are two ways to create string objects in java. One is using new operator and another one is using string literals. The objects created using new operator are stored in the heap memory and objects created using string literals are stored in string constant pool.
    String s1 = new String("abc");          //Creating string object using new operator

    String s2 = "abc";        //Creating string object using string literal

    1. Is String immutable in java?

    Yes, String class is immutable in java. Immutable means once the object is created, its value can not be changed.

    2. How many objects are created using new keyword?

    String str = new String("JavaHungry");

    Two objects are created by the above statement. One object in the heap memory and one object in the String constant pool.

    3. How to convert String to char Array?

    You can convert String to char Array using toCharArray() method.

    4. Are String thread-safe in java?

    As we know String objects are immutable. It means they are thread-safe also.

    5. Which class is final among String,StringBuilder and StringBuffer?

    String class is the only class which is final.

    6.  Is String primitive type or object (derived) type in java?

    String is object(derived) type in java.

    7. Can we use String in switch statement?

    Yes, you can use String in switch statement in java 7. Prior to java 7 , you had to use if-else statements to achieve the task.

    8. What is the difference between StringBuilder and StringBuffer in java?

    Below are the main differences between StringBuilder and StringBuffer in java.

    1. StringBuilder is not thread-safe. StringBuffer is thread-safe.
    2. StringBuilder is not synchronized and StringBuffer is synchronized.
    3. StringBuilder is faster while StringBuffer is slower as it is thread-safe.

    9. What is the difference between below statements ?

    String str = new String("abc");
    String  str =  "abc";

    In the first statement, String str = new String("abc");
    JVM will create one object in the heap memory. Another object in the String constant pool, if the object is not present. Otherwise,if present in the String constant pool ,it will return the reference to it.

    In the second statement, String str = "abc";
    JVM checks for the string "abc" in the String constant pool. If the string is not present in the constant pool then it will create a new String object and stores it in pool.
    If the string "abc" is found in string constant pool , then it simply creates a reference to it but does not create a new object. 

    what is Java

    What is Java

    • Java is a object oriented programming language.
    • It is platform independent.
    • Java is secure due to public key encryption.
    • Java is portable, robust, multi-threaded language.

    History of Java :-

    • James Gosling initiated Java language project in June 1991
    • On 13 November, 2006, Sun released much of Java as free and open source software under the terms of the GNU General Public License (GPL).
    • On 8 May, 2007, Sun finished the process, making all of Java's core code free and open-source, aside from a small portion of code to which Sun did not hold the copyright.

    What is object oriented programming:-

    Java supports Polymorphism, Inheritance, Encapsulation, Abstraction.

    Objects :- Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors – wagging the tail, barking, eating. An object is an instance of a class.

    Class :- A class can be defined as a template/blueprint that describes the behavior/state that the object of its type support.

    Example :-
    public class Dog {
       String breed;
       int age;
       String color;
    
       void barking() {
       }
    
       void hungry() {
       }
    
       void sleeping() {
       }
    }

    Local variables − Variables defined inside methods, constructors or blocks are called local variables.

    Instance variables − Instance variables are variables within a class but outside any method

    Class variables − Class variables are variables declared within a class, outside any method, with the static keyword.

    what is constructors :-

    • Every class has a constructor. If we do not explicitly write a constructor for a class, the Java compiler builds a default constructor for that class.
    • Each time a new object is created, at least one constructor will be invoked. 
    • The main rule of constructors is that they should have the same name as the class.
    • A class can have more than one constructor.
    public class Puppy {
       public Puppy() {
       }
    
       public Puppy(String name) {
          // This constructor has one parameter, name.
       }
    }


    Monday, February 23, 2015

    Java Tutorial

    Java was originally a programming language invented by Sun Microsystems (Sun was acquired by Oracle in January 2010). Since Java's invention it has become more than just a language. It is also a platform with a set of standard APIs and standard tools. Just exactly what Java has evolved into is covered in more detail in the next text in this tutorial, about what Java is today.
    This Java tutorial trail (set of articles) describes the Java programming language. The intention of this tutorial is mostly to be a compressed introduction to Java for developers who already know a bit about programming and object oriented concepts. I will try to explain the various different concepts as I use them, but a bit of programming background will helpful.

    Java Versions Covered in This Tutorial

    The Java language and platform is constantly evolving, and is currently at version 8 (Java 8). Oracle intends for new Java versions to be released every 2 years. Thus, Java 9 is planned to be released in 2016, and Java 10 in 2018.
    The Java versions covered in this Java tutorial trail are Java 6 + 7 + 8. Not all Java features are covered yet, but I keep adding to the tutorials.
    This particular tutorial trail only covers the core Java language features. It does not cover the Java APIs. Many of the Java APIs are covered elsewhere on this tutorial site.

    Get Started Learning Java

    This page is merely an introduction to the Java tutorial trail. The real explaining starts from the next text (page) in the trail,What is Java? . You can see all the articles in this tutorial on every page, in the top left part of each page.
    As you read the tutorials I would recommend that you play around with code examples etc. Personally, I learn better when I type in examples and run them. In order to do this, you need to:
    • Write the Java code
    • Compile the Java code
    • Execute the compiled Java code
    The easiest way to do these three steps is to use a Java IDE (Integrated Development Environment). You can edit the Java code, compile it and execute it, all from within the IDE. There are three popular Java IDE's available:
    Both Eclipse and Netbeans are free, and IntelliJ IDEA has a free community edition which is just fine when you start learning Java. Personally I use IntelliJ IDEA, but I have used all three IDEs from time to time. All of them will be fine for you to start out with.
    If you do not want a full IDE, you can write Java code in a standard text editor, like Notepad (on Windows) or Notepad++ (free text editor). Java file names have to end with the .java extension. You can then compile the Java files into Java byte code, and use the java command to run the compiled byte code.
    In order to compile and execute Java code this way, you need to download and install the Java SDK (Java Software Development Kit). Just click on this link: Java 8 from Oracle. Download the SDK, and install it. Once the Java SDK is installed, you can compile and run Java programs. How all this is done is explained in more detail in later texts.