Behavioral (5 questions)
Tell me about a time you owned an end‑to‑end service and had to improve its latency.
Answer (STAR – 120 words)
Situation: At Swiftcart Technologies I owned the settlement service built in Go, PostgreSQL and Kafka, which paid 40,000 sellers weekly.
Task: The refund API was a bottleneck with a p95 latency of 800 ms, causing merchant dissatisfaction.
Action: I profiled the code, identified a synchronous ledger read, and replaced it with a hot‑path Redis lookup. I also added Prometheus metrics to monitor latency and created a Grafana dashboard for real‑time visibility.
Result: The p95 latency dropped to 140 ms, dramatically improving merchant experience and reducing support escalations. The new metrics helped the team catch latency regressions early.
Describe a situation where you had to mentor junior engineers through a production launch.
Answer (STAR – 115 words)
Situation: In April 2024 I became SDE II at Swiftcart and was responsible for the settlement service. Two new‑grad engineers joined the payments group.
Task: I needed to bring them up to speed so they could independently ship features without compromising reliability.
Action: I paired with each on their first ticket, walked them through our CI/CD pipeline (GitHub Actions, Docker, EKS), and reviewed their pull requests focusing on idempotency and observability. I also organized a brown‑bag session on writing effective runbooks.
Result: Both engineers successfully launched their first production changes within two sprints, and the runbook I authored is now the team’s reference for double‑settlement incidents.
Give an example of how you handled an on‑call incident that required root‑cause analysis and documentation.
Answer (STAR – 120 words)
Situation: While on‑call for the payments group at Swiftcart (one week in four), a double‑settlement incident caused duplicate payouts.
Task: Resolve the issue quickly, restore correct balances, and prevent recurrence.
Action: I triaged the alert, used Kafka offsets and Redis caches to identify the duplicate processing path, and rolled back the affected transactions. I then wrote a detailed runbook outlining the steps to reproduce, diagnose, and remediate the issue, and added additional idempotency checks in the settlement service.
Result: The incident was resolved within 45 minutes, and the runbook has since reduced mean‑time‑to‑recovery for similar issues by enabling faster triage.
Talk about a time you introduced observability to a service and the impact it had.
Answer (STAR – 110 words)
Situation: The order service at Swiftcart lacked real‑time visibility, leading to delayed detection of outages.
Task: Implement monitoring and alerting to catch problems before customers noticed them.
Action: I added Prometheus instrumentation to key metrics (request latency, error rates) and built Grafana dashboards. I also defined alerting thresholds that triggered Slack notifications.
Result: The new observability layer caught two outages early, allowing the team to remediate before any customer complaints were logged. This proactive approach improved service reliability and boosted stakeholder confidence.
Explain a scenario where you had to say “no” to a rewrite or major architectural change.
Answer (STAR – 115 words)
Situation: A senior manager proposed a complete rewrite of the settlement service to adopt a new microservice framework.
Task: Evaluate the proposal and decide whether to proceed.
Action: I conducted a cost‑benefit analysis, estimating the effort, risk of regression, and impact on the weekly payout schedule for 40,000 sellers. I presented data showing the existing service already met latency SLAs after recent optimizations and that a rewrite would introduce unnecessary downtime.
Result: The leadership accepted my recommendation to defer the rewrite, allowing the team to focus on incremental improvements like the Redis cache addition, which yielded immediate latency gains.
Technical (5 questions)
How would you design an idempotent settlement API in Go that interacts with PostgreSQL and Kafka?
Answer (120 words)
I would expose a POST `/settlement` endpoint that accepts a client‑generated idempotency key. The handler first writes the request to a Kafka topic `settlement-requests`. A consumer reads the event, starts a DB transaction, and checks a dedicated `idempotency_keys` table for the key. If the key exists, the transaction returns the previously stored result; otherwise, it proceeds to insert the settlement record, updates balances in PostgreSQL, and stores the key with the outcome. The transaction commits atomically, guaranteeing exactly‑once semantics. I would use Go’s context for cancellation, add retries with exponential back‑off for transient Kafka failures, and emit Prometheus metrics for success/failure rates.
Explain the trade‑offs between using a relational database (PostgreSQL) versus a key‑value store (Redis) for hot‑path lookups in a refunds service.
Answer (130 words)
PostgreSQL offers strong ACID guarantees and complex query capabilities, making it ideal for durable ledger storage and audit trails. However, relational reads incur higher latency, as I observed with the refund API’s p95 800 ms latency. Redis provides in‑memory O(1) lookups, dramatically reducing latency (we achieved 140 ms after moving the hot‑path read to Redis). The trade‑off is that Redis is eventually consistent and volatile; data must be persisted elsewhere for durability. To balance, I store the authoritative ledger in PostgreSQL and cache frequently accessed fields (e.g., recent transaction status) in Redis with a TTL. A cache‑aside pattern ensures cache misses fall back to PostgreSQL, preserving correctness while delivering low latency for the common case.
What steps would you take to ensure a Kafka‑driven settlement pipeline is resilient to duplicate message processing?
Answer (115 words)
First, enable exactly‑once semantics at the producer by setting `enable.idempotence=true`. On the consumer side, I would implement transactional processing: start a DB transaction, check the idempotency key table, and only commit if the key is new. I would also configure Kafka’s `max.poll.records` and `enable.auto.commit=false` to control offsets manually, committing only after the DB transaction succeeds. Additionally, I would use dead‑letter queues for messages that repeatedly fail, and monitor consumer lag with Prometheus. Finally, I would write comprehensive integration tests that simulate duplicate deliveries to verify that the system remains idempotent.
Describe how you would set up CI/CD for a Go microservice deployed on AWS EKS, including testing and security checks.
Answer (125 words)
In GitHub Actions I would define a pipeline with stages: lint, unit test, integration test, security scan, docker build, push to ECR, and helm upgrade on EKS. Linting uses `golangci-lint`; unit tests run with `go test -cover`. Integration tests spin up a local PostgreSQL and Kafka using Docker Compose. Security scanning employs Trivy to detect vulnerable base images. The Dockerfile builds a minimal multi‑stage image, which is pushed to Amazon ECR. Helm charts parameterize image tags, resource limits, and environment variables. Argo CD can handle automated sync to the cluster, while a canary deployment strategy validates the new version with a small traffic slice before full rollout.
How would you monitor and alert on latency regressions in a high‑traffic refunds API?
Answer (115 words)
I would instrument the refunds handler with Prometheus histograms for request latency, tagging by endpoint and status code. A Grafana dashboard would display p95 and p99 latency trends. Alerting rules would trigger when the p95 exceeds a defined threshold (e.g., 200 ms) for a sustained period (5 minutes). I would also create alerts for sudden spikes in error rates. To reduce noise, alerts would be routed to Slack with runbook links. Additionally, I would enable distributed tracing (e.g., OpenTelemetry) to pinpoint latency hotspots across services, and set up automated rollbacks if latency breaches persist beyond a defined SLA.
Role‑Specific (5 questions)
Razorpay values “product thinking.” How have you incorporated product impact into a backend feature you built?
Answer (120 words)
While building the order‑cancellation flow at Swiftcart (Java, Spring Boot, MySQL), I collaborated with product managers to understand merchant pain points. The feature processed ~1.2 M orders a month, and cancellations previously generated high support volume. I designed the API to be idempotent, added detailed error codes for merchants, and exposed a webhook for real‑time status updates. By reducing cancellation‑related tickets by 18 % (as measured in our support dashboard), the product team could allocate resources to new features. I also gathered merchant feedback post‑release, iterating on the API contract to improve usability—demonstrating a direct link between engineering decisions and product outcomes.
Explain how you would design a reconciliation service that ensures “every rupee lands exactly once.”
Answer (130 words)
The service would ingest events from settlement and refund streams via Kafka, storing them in a PostgreSQL ledger table with a composite primary key of `transaction_id` and `event_type`. For each incoming event, the service checks the ledger for an existing entry; if present, it validates that the amounts match (idempotent check) and discards duplicates. A periodic batch job runs a consistency scan, reconciling totals between the settlement and refund tables, flagging mismatches for manual review. To handle failures, the service writes a “pending” state to the ledger before processing and updates to “committed” only after successful DB transaction and external calls (e.g., to payment gateways). All state transitions are captured in audit logs and exposed via Prometheus metrics for observability.
What are the key considerations when moving a nightly batch settlement to an event‑driven architecture?
Answer (115 words)
Key considerations include ordering guarantees, exactly‑once processing, and latency expectations. Using Kafka ensures ordered event streams per seller, but we must handle out‑of‑order arrivals by buffering or using sequence numbers. Idempotency is enforced via a database key table to avoid double payouts. The system must be horizontally scalable; deploying consumers in a Kubernetes Deployment with autoscaling based on Kafka lag helps. Monitoring is critical—Prometheus metrics for lag, error rates, and payout success must be visualized in Grafana. Finally, a robust runbook (like the one I authored) is essential for on‑call engineers to troubleshoot settlement anomalies quickly.
How would you approach estimating the timeline for building a new “instant‑refund” feature on Razorpay’s platform?
Answer (110 words)
I would start with a requirements‑grooming session to break the feature into user stories (API design, Redis cache for instant lookup, Kafka event emission, DB schema changes). Each story would be sized using story points, calibrated against past work such as the settlement latency improvement (which took roughly two sprints). I’d add buffers for integration testing with external payment gateways and for observability setup (Prometheus alerts). The total estimate would be presented as a range (e.g., 4–5 weeks) with clear assumptions. I would also identify dependencies (e.g., schema migrations) and plan a spike to validate the Redis‑based instant lookup pattern.
Razorpay emphasizes “clear communication” with non‑engineers. Give an example of how you explained a complex incident to a product manager.
Answer (115 words)
During a double‑settlement incident, I drafted a post‑mortem that began with a plain‑language summary: “Two payouts were sent for the same order because the settlement consumer processed the same Kafka message twice.” I then used a simple flow diagram to illustrate the message flow, highlighted where the missing offset commit occurred, and described the fix (added idempotency check). I avoided technical jargon like “consumer group rebalance” and instead said “the system lost track of which messages it had already handled.” The product manager appreciated the clarity, and the incident’s root cause was communicated to the broader business team within an hour, fostering trust.