← J.P. Morgan Interview Insights

J.P. Morgan·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

System design round at J.P. Morgan for a software engineer role. The whole session was centered on designing an e-commerce backend, and it went deeper than I expected, especially around concurrency and order correctness.

Questions Asked (7)

Q1

Design the backend system for an e-commerce shopping platform. Walk through the high-level architecture, the major services, the data stores, and how requests flow on both the read path (browsing, product pages, cart) and the write path (adding to cart, placing an order).

System DesignData ModelingTechnical Trade-offs
Author's notes

I started by splitting things into domains: catalog, cart, inventory, order, payment, fulfillment.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying functional and non-functional requirements, then sketch a high-level architecture with separate read and write paths. Decompose into services (product catalog, cart, order, inventory, payment) and choose data stores based on access patterns. Walk through request flows for browsing, cart operations, and order placement, highlighting trade-offs and scalability considerations.

Pro tip: Emphasize idempotency and consistency mechanisms (e.g., idempotency keys, distributed transactions, or sagas) for order placement, as financial systems like J.P. Morgan prioritize correctness and reliability over raw performance.

1. Clarify Requirements and Scope

Ask about expected scale (users, products, orders), consistency needs, latency targets, and key features (search, recommendations, payments). This shows you can tailor the design to business needs.

2. High-Level Architecture

Draw a diagram with clients, API gateway, services, and data stores. Separate read and write paths, and mention CDN, load balancers, and caching layers for reads.

3. Service Decomposition and Data Stores

Define major services: Product Catalog, Cart, Order, Inventory, Payment, User. Choose data stores: e.g., NoSQL for product catalog (read-heavy, flexible schema), relational for orders (ACID), Redis for cart and caching.

4. Read Path Flow

Describe browsing: client -> CDN -> API gateway -> Product Service (cache-aside with Redis) -> database. For cart: client -> Cart Service -> Redis (or DynamoDB) with session management.

5. Write Path Flow and Consistency

For adding to cart: write to Cart Service (idempotent). For order placement: Order Service orchestrates a saga: reserve inventory, process payment, create order, with compensating actions. Use idempotency keys and outbox pattern for reliability.

Key Points to Mention

  • Read/write separation and CQRS for scalability
  • Caching strategies (CDN, Redis) and cache invalidation
  • Data store choices: NoSQL vs SQL, and polyglot persistence
  • Idempotency and exactly-once semantics for order placement
  • Saga pattern for distributed transactions and compensating actions
  • Sharding and replication for horizontal scaling

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

Q2

How would you design the order submission path to be idempotent, so that network retries or double-clicks never result in duplicate orders or double charges?

System DesignTechnical Trade-offsAPI & Integrations
Author's notes

This is the part I actually felt decent about.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining idempotency in the context of order submission, then propose a client-generated idempotency key that the server uses to deduplicate requests. Walk through the end-to-end flow, including storage, concurrency control, and how to handle retries and double-clicks, while discussing trade-offs like key expiration and storage overhead.

Pro tip: Emphasize that idempotency must be enforced at the server side, not just the client, and that the idempotency key should be stored atomically with the order creation to prevent race conditions. Mention that in financial systems like J.P. Morgan, auditability and exactly-once semantics are critical, so consider logging idempotency keys for reconciliation.

1. Define Idempotency and Scope

Clarify what idempotency means for order submission: multiple identical requests should result in a single order and charge. Identify all entry points (UI, API, retries) and the need for a unique request identifier.

2. Client-Side Idempotency Key Generation

Have the client generate a unique idempotency key (e.g., UUID) per order attempt and include it in the request header or body. Ensure the key is generated once per user action, not per retry.

3. Server-Side Deduplication and Atomic Processing

On the server, check if the idempotency key exists in a persistent store (e.g., database with unique constraint). If it does, return the stored response; if not, process the order and store the key with the result atomically to prevent race conditions.

4. Handle Concurrency and Failures

Use database transactions or locks to ensure that concurrent requests with the same key are serialized. Implement retry logic with exponential backoff and ensure that failures during processing do not leave partial state.

5. Discuss Trade-offs and Operational Considerations

Address key expiration (e.g., 24 hours), storage costs, and how to handle key collisions. Mention monitoring and alerting for duplicate attempts and the importance of audit logs for compliance.

Key Points to Mention

  • Idempotency key generation on the client side (UUID) and inclusion in every request.
  • Server-side storage of idempotency keys with unique constraints to prevent duplicates.
  • Atomicity: combining order creation and key storage in a single transaction.
  • Handling concurrent requests with the same key using locks or serializable transactions.
  • Returning the same response for duplicate requests (including error responses).
  • Trade-offs: key expiration, storage overhead, and impact on latency.

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

Q3

Two customers simultaneously try to buy the last unit of a product. How do you prevent overselling, and how do you handle reservations that are abandoned mid-checkout?

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

Honestly the hardest part of the whole interview.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints, such as expected traffic, consistency needs, and acceptable latency. Then propose a solution using atomic operations (e.g., database transactions with row locking or conditional updates) to prevent overselling, and a reservation system with TTL and a cleanup mechanism to handle abandoned checkouts. Discuss trade-offs between consistency, availability, and complexity, and mention how you would handle failures and scale.

Pro tip: Emphasize idempotency and exactly-once processing for reservation operations, as financial systems like J.P. Morgan require high reliability and auditability. Also, consider using a distributed lock or a queue to serialize critical sections, but be aware of its limitations.

1. Clarify Requirements

Ask about expected traffic, consistency requirements (strong vs. eventual), latency tolerance, and whether the system is distributed. This shows you understand the importance of context in system design.

2. Prevent Overselling

Propose using atomic database operations (e.g., UPDATE ... WHERE quantity > 0) or row-level locking to ensure only one transaction succeeds. Alternatively, use optimistic concurrency control with versioning.

3. Implement Reservations

Introduce a reservation step where inventory is temporarily held for a customer. Use a unique reservation ID and set a TTL (time-to-live) to automatically expire abandoned reservations.

4. Handle Abandoned Checkouts

Use a background job or scheduled task to release expired reservations and increment available inventory. Ensure this cleanup is idempotent and handles failures gracefully.

5. Discuss Trade-offs and Scalability

Compare approaches: pessimistic locking (simple but may reduce concurrency) vs. optimistic (better concurrency but requires retries). Mention how to scale with sharding or distributed locks, and the impact on user experience.

Key Points to Mention

  • Atomic operations (e.g., database transactions, conditional updates) to prevent race conditions.
  • Reservation TTL and cleanup mechanism (e.g., scheduled job, Redis TTL) for abandoned checkouts.
  • Idempotency of reservation and release operations to avoid double-selling or double-releasing.
  • Trade-offs between consistency and availability (CAP theorem) and latency implications.
  • Handling failures and retries, including deadlock detection and resolution.
  • Scalability considerations: sharding, distributed locking, and queue-based serialization.

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

Q4

During a flash sale, a single popular SKU becomes a write hotspot. How do you prevent that inventory row from becoming a bottleneck without allowing oversells?

System DesignTechnical Trade-offs
Author's notes

Did not see this follow-up coming.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging the tension between preventing oversells and avoiding a single-row bottleneck. Then propose a multi-layered solution that combines in-memory atomic operations (e.g., Redis) for fast reservation with asynchronous persistence to the database, ensuring eventual consistency and reconciliation. Emphasize trade-offs like latency, consistency, and complexity, and how you would monitor and handle failures.

Pro tip: Show awareness that in financial systems, auditability and correctness are paramount, so any optimization must include a reconciliation mechanism and clear failure handling. Mention that you would validate the solution with load testing and chaos engineering to ensure it meets SLAs.

1. Clarify requirements and constraints

Ask about expected traffic volume, acceptable latency, consistency requirements (strong vs eventual), and whether overselling is absolutely prohibited or if a small buffer is acceptable. Confirm the need for audit trails and regulatory compliance.

2. Identify the bottleneck and propose a high-level strategy

Explain that the single inventory row becomes a hotspot due to serialized writes. Propose moving the contention point to a faster, more scalable layer (e.g., in-memory store) and using atomic operations to decrement inventory.

3. Design the reservation and persistence flow

Detail using Redis with Lua scripts or atomic decrement to reserve inventory, then asynchronously persist reservations to the database. Discuss how to handle failures (e.g., retries, compensating transactions) and ensure no oversell via idempotency and reconciliation.

4. Address consistency and failure scenarios

Explain how to maintain consistency between Redis and the database: use a write-ahead log, periodic reconciliation, and fallback to database if Redis is unavailable. Discuss handling of race conditions and distributed locks if needed.

5. Evaluate trade-offs and monitoring

Summarize trade-offs: increased complexity, potential for temporary inconsistency, but improved throughput and reduced latency. Mention monitoring metrics (e.g., reservation success rate, reconciliation lag) and alerting.

Key Points to Mention

  • Atomic operations in Redis (e.g., DECR, Lua scripts) to prevent race conditions
  • Asynchronous persistence to the database with a queue (e.g., Kafka) for durability
  • Idempotency keys to avoid double reservations
  • Reconciliation process to detect and correct discrepancies between cache and database
  • Fallback mechanisms when the cache is unavailable (e.g., circuit breaker, direct DB with rate limiting)
  • Trade-offs between strong consistency and high availability, and how to choose based on business requirements

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

Q5

A payment goes through successfully but the order confirmation write fails, or the reverse. How do you keep money and order state consistent, and how do you recover from that split?

System DesignData ModelingTechnical Trade-offs
Author's notes

Two-phase approaches, outbox patterns, idempotent retries.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by acknowledging that distributed transactions are hard and that the goal is eventual consistency, not perfect atomicity. Then propose a saga pattern with compensating actions, idempotency keys, and a reconciliation process to detect and repair inconsistencies. Finally, discuss trade-offs between consistency, availability, and complexity, and how you would monitor and alert on such splits.

Pro tip: Emphasize that you would design the system to be self-healing: use idempotent operations and a reconciliation job that automatically resolves splits, rather than relying on manual intervention. This shows you think about operational maturity and failure recovery.

1. Acknowledge the problem and define consistency goals

Explain that in distributed systems, you cannot have atomicity across services without sacrificing availability. State that you aim for eventual consistency with compensating actions and reconciliation.

2. Prevent splits with idempotency and ordering

Use idempotency keys for both payment and order operations to avoid duplicate writes. Ensure operations are retryable and ordered, e.g., by using a saga with a defined sequence of steps.

3. Detect and recover from splits

Implement a reconciliation process that periodically compares payment and order states, identifies mismatches, and triggers compensating actions (e.g., refund or order cancellation).

4. Design for observability and manual override

Add logging, metrics, and alerts for split states. Provide a manual intervention path for cases that cannot be auto-resolved, with clear audit trails.

5. Discuss trade-offs and alternatives

Compare saga vs. two-phase commit (2PC) vs. event sourcing. Explain why saga is often preferred in microservices for availability, but note its complexity and eventual consistency implications.

Key Points to Mention

  • Saga pattern with compensating transactions (e.g., refund if order fails)
  • Idempotency keys to ensure retries don't cause duplicate charges or orders
  • Reconciliation jobs that run periodically to detect and fix inconsistencies
  • Event-driven architecture with a message broker (e.g., Kafka) for reliable communication
  • Trade-offs: 2PC vs. saga, consistency vs. availability, complexity vs. correctness
  • Monitoring, alerting, and manual intervention for edge cases

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

Q6

If the business is willing to accept a small, reconcilable oversell in exchange for much higher checkout throughput, how would your inventory design change and how would you reconcile afterward?

Technical Trade-offsSystem Design
Author's notes

Short answer: I said move the counter to something like Redis with atomic decrements, drop the strict floor enforcement, let it go slightly negative, then reconcile against actual fulfillment capacity in a batch job.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge the trade-off and propose a design that decouples inventory reservation from checkout, using optimistic concurrency or soft reservations to allow oversell. Then outline a reconciliation process that detects and resolves discrepancies asynchronously, with compensating actions and monitoring.

Pro tip: Emphasize that oversell must be bounded and monitored; propose a cap on oversell per item and automated alerts when thresholds are breached, showing you understand risk management in a financial context.

1. Clarify requirements and constraints

Confirm the acceptable oversell limit, throughput targets, and reconciliation SLA. Discuss how oversell impacts customer experience and business rules.

2. Redesign inventory model for high throughput

Introduce soft reservations or optimistic locking to avoid blocking on checkout. Use event-driven updates to inventory asynchronously, allowing temporary oversell.

3. Implement reconciliation mechanism

Design a periodic or event-triggered reconciliation job that compares orders against actual inventory. Use idempotent operations and compensating transactions to correct oversell.

4. Handle oversell resolution

Define business rules for resolving oversell: e.g., backorder, cancel, or offer alternatives. Automate notifications and refunds if needed.

5. Monitor and iterate

Set up metrics and alerts for oversell frequency and reconciliation lag. Continuously tune the system based on data.

Key Points to Mention

  • Optimistic concurrency control vs. pessimistic locking
  • Eventual consistency and asynchronous processing
  • Idempotency and exactly-once processing in reconciliation
  • Compensating transactions (Saga pattern)
  • Monitoring and alerting for oversell thresholds
  • Business impact and customer communication

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

Q7

How would you extend a single global inventory count per SKU to a multi-warehouse model where stock and reservations are tracked per fulfillment location?

System DesignData Modeling
Author's notes

Last question, felt like a stress test.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the current single-count model and the business drivers for multi-warehouse (e.g., fulfillment speed, inventory accuracy). Then propose a data model that introduces a warehouse/location entity and a stock table keyed by SKU and location, with reservations tracked separately. Finally, discuss migration, consistency, and query patterns to ensure the system scales and remains correct.

Pro tip: Emphasize idempotency and concurrency control (e.g., optimistic locking or versioning) for reservation updates, as double-booking or overselling is a critical risk in multi-warehouse systems. Also, mention the importance of a phased migration to avoid downtime and data inconsistencies.

1. Clarify Requirements and Constraints

Ask about expected scale (number of warehouses, SKUs, transactions per second), consistency requirements (strong vs. eventual), and whether reservations need to be real-time. This ensures the design meets business needs.

2. Design the Data Model

Introduce a Warehouse (or Location) entity and a Stock table with composite key (SKU, WarehouseID) storing quantity and reserved quantity. Optionally, separate Reservations table for audit and lifecycle tracking.

3. Define Operations and Concurrency

Describe how to handle stock updates, reservations, and releases atomically. Use transactions with appropriate isolation levels or optimistic concurrency to prevent overselling.

4. Plan Migration and Backfill

Outline a phased migration: create new tables, backfill existing global counts to a default warehouse, and switch reads/writes gradually. Ensure backward compatibility during transition.

5. Address Query Patterns and Performance

Discuss how to efficiently query available stock per warehouse (e.g., indexes on (SKU, WarehouseID)) and aggregate across warehouses for global views. Consider caching for hot SKUs.

Key Points to Mention

  • Composite key (SKU, WarehouseID) for stock table to ensure uniqueness per location.
  • Separate reservations table or reserved_quantity column to track holds without affecting physical stock.
  • Concurrency control mechanisms: optimistic locking (version column) or pessimistic locking (SELECT FOR UPDATE) to prevent race conditions.
  • Idempotent reservation APIs to handle retries safely.
  • Migration strategy: dual-write or backfill with a default warehouse, then gradually shift traffic.
  • Indexing and partitioning strategies for scalability (e.g., partition by WarehouseID).

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