← Razorpay Interview Insights

Razorpay·Software Engineer·Onsite - Multi Round·Intermediate

IntermediateRejected
Jul 2026Remote

Summary

Four rounds at Razorpay for an SDE 2 role, LLD through CEO level, all elimination. Made it past the machine coding round but got cut after HLD, which was a frustrating experience partly because the interviewer gave almost nothing to work with.

Questions Asked (2)

Q1

Build an in-process feature flag service that an application can embed and query at runtime. It should support boolean, string, and integer flag types, targeting rules with AND/OR conditions on evaluation context attributes, and percentage-based rollouts with sticky bucketing that stays consistent across process restarts.

System DesignTechnical Trade-offsA/B Testing & Experimentation
Author's notes

The AI-assisted format was genuinely interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a modular architecture with a flag store, evaluator, and bucketing service. Focus on how targeting rules and sticky bucketing work, and discuss trade-offs around consistency, performance, and update mechanisms.

Pro tip: Emphasize deterministic bucketing using a stable hash of flag key and user ID, and mention that persisting the bucketing seed or using a consistent hashing algorithm ensures stickiness across restarts. Also, highlight the importance of caching and efficient rule evaluation for low-latency queries.

1. Clarify Requirements and Scope

Ask questions to understand expected scale, update frequency, consistency needs, and integration points. Confirm flag types, targeting rule complexity, and rollout percentage semantics.

2. Design Core Components

Outline the main modules: flag configuration store, rule evaluator, bucketing service, and a client API. Discuss how flags are loaded and refreshed (e.g., polling, push, or embedded config).

3. Detail Targeting and Bucketing

Explain how AND/OR conditions are evaluated against context attributes, and how percentage rollouts use consistent hashing (e.g., MurmurHash) with a stable seed to assign users to buckets deterministically.

4. Address Stickiness and Persistence

Describe how to ensure bucketing remains consistent across restarts: use a deterministic hash of flag key and user ID, and optionally persist the bucketing seed or user assignments if needed.

5. Discuss Trade-offs and Optimizations

Cover performance (caching, pre-compiled rules), consistency (eventual vs strong), and operational concerns (flag updates, monitoring, fallback defaults).

Key Points to Mention

  • Deterministic bucketing using consistent hashing (e.g., MurmurHash) with a stable seed to ensure stickiness across restarts.
  • Efficient rule evaluation: compile rules into an expression tree or use a library for fast AND/OR condition checks.
  • Flag configuration management: how flags are defined, stored, and updated (e.g., JSON/YAML files, database, or external service) and refreshed in-process.
  • Caching strategies to minimize evaluation overhead and handle high query throughput.
  • Handling of edge cases: missing context attributes, default values, and flag evaluation errors.
  • Trade-offs between consistency and availability, and how to handle flag updates without restarting the application.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Design a feature flag evaluation service that supports up to 1,000 active flags, handles 10,000 evaluation requests per second from backend services, and keeps P95 latency under 10ms for both single and batched evaluations.

System DesignData ModelingTechnical Trade-offs
Author's notes

This was framed as an extension of the LLD question, which I wasn't expecting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then propose a high-level architecture with a fast in-memory evaluation engine and a durable control plane. Focus on data modeling, caching, and consistency trade-offs to meet latency and throughput goals, and discuss how to handle updates and failures.

Pro tip: Emphasize that the evaluation path must be completely decoupled from the control plane and served from memory with no external calls, as even a single network hop can exceed the 10ms P95 budget. Also, mention that batching should be done server-side to reduce per-request overhead.

1. Clarify Requirements and Constraints

Ask questions to understand the scale, consistency needs, and failure modes. Confirm that flags are read-heavy, updates are infrequent, and that eventual consistency is acceptable for flag changes.

2. Design the Data Model and Storage

Define a flag schema with targeting rules, and choose a storage solution for the control plane (e.g., a relational DB or a versioned key-value store). Consider using a compact binary format for efficient in-memory representation.

3. Architect the Evaluation Service

Propose a stateless service that loads all flags into memory and evaluates locally. Use a push-based mechanism (e.g., pub/sub) to propagate updates from the control plane to all instances, ensuring low-latency reads.

4. Optimize for Performance and Scale

Discuss techniques like caching, pre-compilation of rules, and efficient data structures (e.g., bitsets, tries) to achieve sub-10ms P95. For batched evaluations, process flags in parallel and return results in a single response.

5. Address Consistency, Failures, and Monitoring

Explain how to handle stale data, network partitions, and service failures. Propose a fallback strategy (e.g., default flag values) and monitoring for latency, error rates, and flag update propagation delays.

Key Points to Mention

  • In-memory evaluation with no external dependencies on the hot path
  • Push-based updates via pub/sub (e.g., Kafka, Redis Pub/Sub) for low-latency propagation
  • Efficient data structures and rule compilation for fast evaluation
  • Batching strategy: server-side batching and parallel processing
  • Consistency trade-offs: eventual consistency vs. strong consistency for flag updates
  • Monitoring and alerting for P95 latency, error rates, and update lag

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.