Mansi πŸ‘©β€πŸ’» (@MansiCodez)

Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-10-18T13:32:00.000Z

Recently I interviewed a Senior Engineer. Strong candidate. Kafka? βœ… Redis? βœ… Microservices? βœ… Distributed systems? βœ… Then I asked: "You're building the inventory service for a flash sale. Only 1 item left in stock." Two users hit β€œBuy Now” at the exact same millisecond. Both requests pass the β€œis available?” check. Both create an order. Both deduct stock. Now you’ve sold 2 items when only 1 existed. How do you guarantee you never oversell β€” even with concurrent requests, client retries, and partial failures? "Just use a database transaction." Doesn’t fully solve it if both requests read `stock = 1` before either writes, or if the response is lost and the client retries. "Check stock before deducting." What happens when both checks happen at the same time? "Use Redis DECR and reject if it goes negative." What happens if Redis is down, or the decrement succeeds but the order is never persisted? Your turn: How would you design this inventory reservation API so concurrent buyers and retries never oversell the last item? There’s a specific distributed-systems concept behind this. And you’ll encounter it everywhere inventory, tickets, seats, coupons, and limited resources are involved.

758 32 1103966 160 82
Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-11-25T16:32:00.000Z

How a URL shortener actually works at scale: -A request hits the load balancer -The app server generates a Base62 ID -A cache checks for hot links first -The DB is sharded by ID range -A 301 vs 302 redirect decides your analytics Save this for your next system design round.

2 1 123 0 0
Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-11-25T16:02:00.000Z

Before any system design interview, make sure you can explain these 10 things: -CAP theorem with a real example -SQL vs NoSQL trade-offs -Consistent hashing -Rate limiting algorithms -Cache invalidation strategies -Message queues vs pub/sub -Database indexing -Sharding vs replication -Idempotency -Back-of-envelope estimation Bookmark this. Thank me after the offer letter.

11 2 625 0 0
Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-11-25T15:32:00.000Z

Instead say: Casual: "I'm targeting around 25 LPA based on the role and responsibilities. What's the budget you've allocated for this position?" Professional: "I'd prefer to align compensation with the responsibilities and market range for this position rather than anchor it to my current package. Could you share the approved compensation band?"

2 0 76 0 0
Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-11-25T14:32:00.000Z

"Design a flash sale for 1M users in 10 seconds." That's what the interviewer asked me. I said "Redis + queue" and felt smart. Then he asked: "What happens when 50,000 people pay for the last 10 items at once?" Here's the answer he was looking for πŸ‘‡

4 0 729 1 0
Mansi πŸ‘©β€πŸ’» @MansiCodez 2026-11-25T13:32:00.000Z

Recently I interviewed a Senior Engineer. Strong candidate. Kafka? βœ… Redis? βœ… Microservices? βœ… Distributed systems? βœ… Then I asked: "You're building the seat booking system for a sold-out concert. 10,000 seats. A user picks seat A12 and hits Book. Two users hit Book on the exact same seat at the same millisecond. Both see it as available. Both create a reservation. Both get a success response. Now two people think they own the same seat. How do you guarantee a seat is never double-booked β€” even with concurrent requests, client retries, and partial failures?" "Just use a database transaction." Doesn’t fully solve it if both requests read `available = true` before either writes, or if the response is lost and the client retries. "Check availability then update." What happens when both checks happen at the same time? "Use Redis SETNX and reject if the key already exists." What happens if Redis is down, the lock expires, or the booking is never persisted? Your turn: How would you design this seat reservation API so concurrent buyers and retries never double-book the last seat? There’s a specific distributed-systems concept behind this. And you’ll encounter it everywhere limited resources are involved β€” seats, tickets, rooms, appointments, inventory.

4 0 407 3 0