Managing Flash Sales And Discounts

Explore top LinkedIn content from expert professionals.

  • View profile for Rajat Gajbhiye

    Writes to 200k+ | SDE | AI & Tech Content Creator | JAVA, Python, AI Agents, MERN

    229,436 followers

    Round 3 at Walmart broke me. The interviewer said: Design a Flash Sale system. 10 million users. One product. All hitting Buy at exactly 12:00:00. - What happens when 10 million writes hit your database simultaneously? - Two users bought the last item at the same millisecond. Who gets it? I failed that round. 33 LPA oppurtuinity gone. But I didn't move on. I went deep. Here's what I should have said. The naive approach (what everyone says): - User clicks Buy - API checks inventory - If available → deduct stock → confirm order - This works in demo. Kills in production. The real problems at scale: 1. Overselling 10 million users hit Buy simultaneously. API reads stock = 1 for all of them. All pass the inventory check. 10 million confirmation emails sent. Stock was 1. Fix: Never check inventory in your application layer. Use Redis DECR atomic single operation. Stock decrements by 1. Returns new value. If value < 0 → reject instantly. No two users ever see the same stock count. 2. Database dies at 12:00:00 10 million writes per second hit your DB directly. DB connection pool exhausts in milliseconds. System crashes. Sale over before it started. Fix: Put Kafka between API and DB. User clicks Buy → Kafka accepts instantly → returns "You are in queue." DB processes orders at its own pace. API never waits. DB never chokes. 3. Same user buys twice Network timeout. User clicks Buy again. Two orders created. Two payments charged. Fix: Idempotency key unique token per Buy attempt. Before processing — check Redis if this token exists. Already processed? Return old result. Never process again. 4. Sale not starting at exactly 12:00:00 Server A starts at 12:00:00. Server B starts at 12:00:03. Users on different servers see different sale states. Fix: Centralised sale flag in Redis. All servers check the same key. Flag flips to true simultaneously. Consistent experience for every user. The architecture I should have led with: User → API Gateway → Redis (inventory + idempotency) → Kafka → Order Service → DB - Redis handles inventory atomically no overselling ever - Kafka absorbs the 12:00:00 traffic spike no direct DB hammering - Idempotency key prevents duplicate orders - API Gateway rate limits per user no single user hammers the system Walmart doesn't test whether you can build a flash sale. They test whether you know what happens when 10 million people break it simultaneously. 𝗞𝗲𝗲𝗽𝗶𝗻𝗴 𝘁𝗵𝗶𝘀 𝗶𝗻 𝗺𝗶𝗻𝗱, 𝗜 𝘄𝗲𝗻𝘁 𝗱𝗲𝗲𝗽 𝗮𝗻𝗱 𝗱𝗼𝗰𝘂𝗺𝗲𝗻𝘁𝗲𝗱 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴 𝗶𝗻𝘁𝗼 𝗮 𝗝𝗮𝘃𝗮 𝗕𝗮𝗰𝗸𝗲𝗻𝗱 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗲𝗿 𝗚𝘂𝗶𝗱𝗲. 𝗚𝗲𝘁 𝘁𝗵𝗲 𝗚𝘂𝗶𝗱𝗲 𝗵𝗲𝗿𝗲: https://lnkd.in/dTvYVutD Use SDE20 to get 20% off. Stay Hungry, Stay FoolisH!

  • View profile for Vishal Chopra

    Data Analytics & Excel Reports | Leveraging Insights to Drive Business Growth | ☕Coffee Aficionado | TEDx Speaker | ⚽Arsenal FC Member | 🌍World Economic Forum Member | Enabling Smarter Decisions

    12,273 followers

    Inflation often forces businesses into a dilemma—raise prices and risk losing customers, or keep prices stable and shrink margins. But what if data could help strike the perfect balance? 🚀 Challenge: Flipkart, one of India’s largest e-commerce platforms, noticed fluctuating customer retention rates and declining repeat purchases, especially during inflationary periods. Traditional deep-discount campaigns led to short-term sales spikes but failed to build long-term customer loyalty. 🔎 Solution: Data-Driven Discounting Strategy Flipkart’s analytics team uncovered a key insight: Small, frequent discounts (e.g., 5-10% on repeat purchases) led to higher engagement. Personalized offers based on purchase history encouraged repeat buys. A/B testing revealed that customers preferred consistency over occasional deep discounts. 💡 Implementation: Using AI-driven dynamic pricing, Flipkart rolled out: ✅ Tiered discounts for loyal customers. ✅ AI-powered coupon recommendations. ✅ Targeted email campaigns promoting small, time-sensitive discounts. 📈 Results: After three months of testing, Flipkart saw: ✔️ 17% increase in repeat purchases ✔️ 12% uplift in customer retention ✔️ Higher profit margins vs. deep discounting 🎯 Key Takeaway: In an inflationary environment, data-driven pricing isn't just about maximizing revenue—it’s about customer psychology. Businesses that personalize their offers and optimize discounts intelligently can boost retention while protecting margins. 𝑾𝒉𝒂𝒕 𝒑𝒓𝒊𝒄𝒊𝒏𝒈 𝒔𝒕𝒓𝒂𝒕𝒆𝒈𝒊𝒆𝒔 𝒉𝒂𝒗𝒆 𝒘𝒐𝒓𝒌𝒆𝒅 𝒇𝒐𝒓 𝒚𝒐𝒖𝒓 𝒃𝒖𝒔𝒊𝒏𝒆𝒔𝒔 𝒊𝒏 𝒄𝒉𝒂𝒍𝒍𝒆𝒏𝒈𝒊𝒏𝒈 𝒕𝒊𝒎𝒆𝒔? #datadrivendecisionmaking #DataAnalytics #DiscountStrategy #BusinessStrategies

  • View profile for Carla Penn-Kahn
    Carla Penn-Kahn Carla Penn-Kahn is an Influencer
    12,894 followers

    This peak season, protect your margins by controlling discount stacking. As we approach peak trade and the peak discounting period, brands often default to the bluntest tool in the box: heavy sitewide sales. The logic is simple “drop the price, drive volume, clear stock.” But too many brands forget one crucial detail: stacking discounts can quickly turn profitable orders into loss-making ones. The Overlooked Discounts: Sitewide promotions don’t operate in isolation. Sitting in the background are your: High-intent pop-ups Welcome series discounts Cart abandonment flow incentives These are designed to capture incremental conversions in normal trading periods. But when layered on top of aggressive sitewide offers, they often wipe out already-thin margins. A Quick Example: RRP: $100 Sitewide discount: 30% → Sale price = $70 Product cost (COGS): $20 Customer acquisition cost (CAC): $30 Shipping / merchant / pick & pack costs: $15 At this stage: Revenue: $70 Costs: $20 + $30 + $15 = $65 Profit: $5 per order (5% margin) Not great, but still positive. Now add in an additional 20% discount from a pop-up or triggered flow: Extra discount: 20% off $70 = -$14 Adjusted sale price = $56 Recalculate: Revenue: $56 Costs: $65 🛑 Net loss: -$9 per order Why It Matters At scale, these “hidden discounts” mean businesses spend thousands acquiring customers and fulfilling orders at a negative contribution margin. Instead of driving growth, they quietly erode cashflow and profitability during the most critical sales period of the year. How to Avoid This Trap: Audit your flows before peak trade. Adjust high-intent pop-ups, welcome offers, and cart abandonment discounts during sitewide promotions. Set a CAC ceiling. Ensure that even with discounts applied, your contribution margin remains positive. Model scenarios. Calculate “worst case” blended discounts and costs before launching campaigns. Use AI or rules-based systems. Automate safeguards so discounts can’t stack beyond a certain threshold. Discounting can be a powerful lever, but unmanaged, it becomes a profit killer. You may risk turning your busiest period into your least profitable one.

  • View profile for Raul Junco

    Simplifying System Design

    138,648 followers

    Flash sales expose bad inventory design fast. Preventing oversells without killing latency is the hard part. At first glance, every option looks reasonable: A. Lock in the primary DB Safe and correct. But hot rows create lock contention and ugly tail latency. B. Optimistic concurrency with retries Clean and simple. But under heavy contention, retries turn into a traffic amplifier. C. Atomic in-memory counter ✅ Fast, scalable, and race-free on the hot path. This is the best fit for flash sales. D. Queue it and fix later Great for smoothing spikes. But you are accepting oversells and paying for it later with refunds and support pain. Why C wins? 1. Atomic check and decrement removes race conditions 2. In-memory operations keep latency low 3. Sharding by product helps scale hot SKUs 4. The database stops being the bottleneck 5. It matches the reality of flash-sale traffic Trade-offs - You still need durable persistence - You need reconciliation for drift - You need idempotency for retries - You need reservation expiry for abandoned carts Contrast: DB locking protects stock by slowing the system down. Atomic counters protect stock while keeping the system fast.

  • View profile for Koushal Jha

    SDE 2 @Akamai, Ex- Zscaler | 1982+ rating @Leetcode| Expertise in Java, Spring Boot, Angular | Full Stack Developer

    11,817 followers

    🔥 𝗧𝗵𝗶𝘀 𝗜𝘀 𝗛𝗼𝘄 Amazon 𝗔𝘃𝗼𝗶𝗱𝘀 𝗙𝗹𝗮𝘀𝗵 𝗦𝗮𝗹𝗲 𝗖𝗿𝗮𝘀𝗵𝗲𝘀 𝗶𝗻 𝗕𝗮𝗰𝗸𝗲𝗻𝗱𝘀 Flash sale crashes don’t happen because of traffic. They happen because the 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝘁𝗿𝗲𝗮𝘁𝘀 𝘀𝗽𝗶𝗸𝗲𝘀 𝗹𝗶𝗸𝗲 𝗻𝗼𝗿𝗺𝗮𝗹 𝗹𝗼𝗮𝗱. Here’s the 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝘁𝗵𝗶𝗻𝗸𝗶𝗻𝗴 used to survive flash-sale at scale 👇 𝗦𝘁𝗲𝗽 1: 𝗔𝘀𝘀𝘂𝗺𝗲 𝗧𝗿𝗮𝗳𝗳𝗶𝗰 𝗪𝗶𝗹𝗹 𝗕𝗲 𝗨𝗻𝗳𝗮𝗶𝗿 Millions of users hit the same few products at once. So instead of letting everyone hit the database: • Requests are throttled • Rate limits are applied early • Excess traffic is shed gracefully 𝗚𝗼𝗮𝗹: protect the system, not please every request 𝗦𝘁𝗲𝗽 2: 𝗡𝗲𝘃𝗲𝗿 𝗧𝗿𝘂𝘀𝘁 𝘁𝗵𝗲 𝗗𝗮𝘁𝗮𝗯𝗮𝘀𝗲 Inventory and product data are: • Cached aggressively • Pre-computed before the sale • Served from in-memory stores 𝗦𝘁𝗲𝗽 3: 𝗪𝗿𝗶𝘁𝗲𝘀 𝗔𝗿𝗲 𝗦𝗲𝗿𝗶𝗮𝗹𝗶𝘇𝗲𝗱 Orders are not processed directly. 𝗜𝗻𝘀𝘁𝗲𝗮𝗱: • Requests go into queues • Inventory is decremented safely • Only confirmed orders hit the DB 𝗧𝗵𝗶𝘀 𝗽𝗿𝗲𝘃𝗲𝗻𝘁𝘀: • Overselling • Lock contention • Cascade failures 𝗦𝘁𝗲𝗽 4: 𝗙𝗮𝗶𝗹𝘂𝗿𝗲 𝗜𝘀 𝗘𝘅𝗽𝗲𝗰𝘁𝗲𝗱 Some services will slow down. Some requests will fail. 𝗦𝗼 𝘀𝘆𝘀𝘁𝗲𝗺𝘀 𝘂𝘀𝗲: • Timeouts • Circuit breakers • Fallback responses 𝗔 𝗳𝗹𝗮𝘀𝗵 𝘀𝗮𝗹𝗲 𝗯𝗮𝗰𝗸𝗲𝗻𝗱 𝗶𝘀 𝗱𝗲𝘀𝗶𝗴𝗻𝗲𝗱 𝘁𝗼 𝗱𝗲𝗴𝗿𝗮𝗱𝗲, 𝗻𝗼𝘁 𝗰𝗼𝗹𝗹𝗮𝗽𝘀𝗲. Final Thought 👇 𝗙𝗹𝗮𝘀𝗵 𝘀𝗮𝗹𝗲𝘀 𝗮𝗿𝗲 𝗻𝗼𝘁 𝗮𝗯𝗼𝘂𝘁 𝘀𝗽𝗲𝗲𝗱. 𝗧𝗵𝗲𝘆’𝗿𝗲 𝗮𝗯𝗼𝘂𝘁 𝗰𝗼𝗻𝘁𝗿𝗼𝗹 𝘂𝗻𝗱𝗲𝗿 𝗲𝘅𝘁𝗿𝗲𝗺𝗲 𝗹𝗼𝗮𝗱. This is the difference between: • “It worked in testing” • “It survived production” Exactly the kind of backend thinking product-based companies look for. --------------------------------- 𝗙𝗼𝗿 𝗽𝗲𝗿𝘀𝗼𝗻𝗮𝗹𝗶𝘇𝗲𝗱 𝗴𝘂𝗶𝗱𝗮𝗻𝗰𝗲, 𝗿𝗼𝗮𝗱𝗺𝗮𝗽𝘀, 𝗼𝗿 1:1, 𝘆𝗼𝘂 𝗰𝗮𝗻 𝗰𝗼𝗻𝗻𝗲𝗰𝘁 𝘄𝗶𝘁𝗵 𝗺𝗲 𝗵𝗲𝗿𝗲 :- https://lnkd.in/gb-2Wbut #SystemDesign #BackendEngineering #Scalability #DistributedSystems #Java #SpringBoot #SoftwareEngineer #HighTrafficSystems

  • View profile for Vamsi Karuturi

    Senior Backend Engineer @ Salesforce | Distributed Systems • Java • Spring Boot • Kafka • AWS | Mentored 100+ into FAANG | System Design Mentor | Ex-Walmart • Siemens

    28,294 followers

    ✨ 𝐑𝐞𝐜𝐞𝐧𝐭 𝐒𝐲𝐬𝐭𝐞𝐦 𝐃𝐞𝐬𝐢𝐠𝐧 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐏𝐫𝐨𝐛𝐥𝐞𝐦: 𝐇𝐨𝐰 𝐈 𝐃𝐞𝐬𝐢𝐠𝐧𝐞𝐝 𝐚 𝐋𝐢𝐠𝐡𝐭𝐧𝐢𝐧𝐠-𝐅𝐚𝐬𝐭 𝐞𝐂𝐨𝐦𝐦𝐞𝐫𝐜𝐞 & 𝐂𝐚𝐦𝐩𝐚𝐢𝐠𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 ⚡️Ever joined a Swiggy/Amazon flash sale where 100k people smash “Claim” at the same second? It feels less like shopping and more like a hunger games arena. 🏹🔥 𝐋𝐚𝐬𝐭 𝐰𝐞𝐞𝐤 𝐢𝐧 𝐚 𝐬𝐲𝐬𝐭𝐞𝐦 𝐝𝐞𝐬𝐢𝐠𝐧 𝐢𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰, I was thrown right into that chaos: 👉 “Design a checkout system that survives when everyone wants the same burger at ₹1.” 🎯 The Problem "Ensure fair claims, avoid double-claims, prevent oversell, and keep the system resilient under chaos."   🧠 Challenges I Navigated Inventory Management → Prevent overselling even under 10k+ requests/sec. User Claim Idempotency → Each user should claim only once. High Traffic Bursts → Handle flash sale traffic spikes without downtime.   🤯 Trade-offs Considered ✅ DB-first approach? ❌ Collapses under massive write bursts. ✅ Cache-only? ❌ Risk of losing truth during failures. ✅ Queue buffering? ✅ Helps absorb spikes but adds latency.   🧠 𝐖𝐡𝐲 𝐂𝐚𝐜𝐡𝐞-𝐅𝐢𝐫𝐬𝐭, 𝐍𝐨𝐭 𝐃𝐁-𝐅𝐢𝐫𝐬𝐭? In high-concurrency campaigns like Swiggy’s “100 Burgers at ₹1”, the DB-first approach fails under massive bursts: Problem: Imagine 10,000+ users hitting the DB simultaneously. Even with high TPS, row locks for stock decrement → contention → everyone slows down. Result: Users see delays, oversells happen, and double-claims sneak in. ✅ Solution → Cache-first (Redis): Redis is in-memory, ultra-fast, and handles 100k+ ops/sec. Real-time checks happen in cache, not DB. DB is updated asynchronously (Kafka → DB) for durability + analytics.   ⚡ 𝐅𝐥𝐨𝐰 𝐨𝐟 𝐭𝐡𝐞 𝐒𝐲𝐬𝐭𝐞𝐦 User → API Gateway → Claim Service → Cache (Redis) → DB 1️⃣ User clicks the claim link. 2️⃣ API Gateway routes to Claim Service. 3️⃣ Claim Service checks Redis cache: User already claimed? → return ❌ Stock > 0? → proceed ✅ 4️⃣ Redis Atomic Ops: SETNX user:{id}:claimed → ensures only first claim succeeds. DECR burger:count → decrements stock safely. 5️⃣ If claim succeeds → respond with Happy Face. 6️⃣️If stock exhauste→ respond with Sad Face Events are pushed → Kafka → DB (durability + analytics). ⚡ This ensures: Each user gets exactly 1 burger. No overselling. Sub-100ms latency for most requests.   ⚡ Atomic Operations in Redis 𝐒𝐄𝐓𝐍𝐗 𝐮𝐬𝐞𝐫:𝟏𝟐𝟑𝟒𝟓: 𝐜𝐥𝐚𝐢𝐦𝐞𝐝→ Only the first request succeeds. Subsequent ones fail instantly → prevents double-claims. 𝐃𝐄𝐂𝐑 𝐛𝐮𝐫𝐠𝐞𝐫:𝐜𝐨𝐮𝐧𝐭 → Decrements stock atomically. Guarantees no overselling, even under massive concurrency.   💡 how would you improve this further? I’d love to hear your thoughts 👇 #SystemDesign #SystemDesignInterview #DistributedSystems #HighScalability #SoftwareArchitecture #BackendEngineering #CloudArchitecture #Redis #Kafka #Databases #TechCareers #EngineeringLeadership #InterviewPrep #SDE

  • View profile for Shikhar Verma

    Software Engineer @Google | YouTube | ex @Oracle | Specialist @Codeforces (1546) | Knight @Leetcode (1995) | NITR’23

    8,211 followers

    𝗢𝗻𝗲 𝗵𝗼𝘁 𝗿𝗼𝘄. 𝗠𝗶𝗹𝗹𝗶𝗼𝗻 𝘂𝘀𝗲𝗿𝘀. 𝗖𝗵𝗮𝗼𝘀. In a flash sale, imagine a product with 100 units and millions of users clicking Buy at the same time. If inventory lives in one row: product_id = 42, stock = 100 Every purchase hits the same row. What happens? • In lock-based systems → waiting, timeouts, deadlocks • In optimistic systems → aborts and retries Either way, that single row becomes the bottleneck. The fix: sharded counters Instead of one row, split stock into multiple rows: • shard 0 → 10 units • shard 1 → 10 units • … • shard 9 → 10 units Total stock is still 100 but contention drops massively. Each purchase: • randomly picks a shard • decrements stock if available • retries another shard if empty No hot row. Much higher throughput. System stays responsive under extreme load. Key takeaway: 𝗜𝗳 𝗼𝗻𝗲 𝗿𝗼𝘄 𝗶𝘀 𝗯𝗲𝗶𝗻𝗴 𝘂𝗽𝗱𝗮𝘁𝗲𝗱 𝗯𝘆 𝗲𝘃𝗲𝗿𝘆𝗼𝗻𝗲, 𝘁𝗵𝗮𝘁 𝗿𝗼𝘄 𝗶𝘀 𝗮𝗹𝗿𝗲𝗮𝗱𝘆 𝗮 𝘀𝗰𝗮𝗹𝗮𝗯𝗶𝗹𝗶𝘁𝘆 𝗯𝘂𝗴.

  • View profile for Tom Griffiths

    I help small businesses maximise profits | Numbers guy to CEOs | Ex-JPMorgan now providing Finance & Strategy Support to £5-15m revenue Business Owners | £100m+ Client Revenue

    24,018 followers

    How a discount can wipe out all of your profits The hardest part for most business is winning clients It takes time, effort, and resources to generate leads Then more time, effort, and resources to convert them into paying clients And once they’re on board, it takes even more work to retain them So, it’s tempting to think discounting will make things easier - a quick way to close the deal or keep the client happy. But I don’t agree with that logic. If your gross margin is 40% and you discount prices by 10%, you’d need to increase total sales by 33% just to maintain the same profit. At a 20% margin, a 4% discount means 25% more sales. That’s a lot of work, just to maintain (not even increase) profit. Is that level of growth realistic for your business? For most, it’s not Discounting rarely leads to growth. It wipes out your profit and forces you to work harder for the same result. Yes, there are exceptions: - entering a new market, - defending against a competitor, - retaining a customer short-term, - making a loss on one product if it leads to more sales of a more profitable one But those are strategic decisions The bottom line: try not to discount your prices. Next time someone asks for a discount, pause and ask: “Can we really sell that much more to make up for it?” Most businesses can’t. What’s your view - do small businesses rely too heavily on discounting as a growth tactic? Dm me 'margins' if you would like a pdf version of the below infographic that breaks down the impact of offering discounts. -- ♻️ Repost to help other leaders ➕ Follow for more insights on finance and strategy

  • View profile for Matt Green

    Co-Founder & Chief Revenue Officer at Sales Assembly | Helping B2B tech companies improve sales and post-sales performance | Decent Husband, Better Father

    61,026 followers

    Trying to drive margin discipline with a comp plan that rewards discounting is like trying to enforce a diet at an all you can eat buffet. Everyone says they’ll behave. Then Q4 hits and it’s wings, waffles, and 30% off enterprise licenses. 🕺 Michael Shields posted a killer story today via a convo he had with a CFO friend of his: - Renewal gets to the finish line. - Product is great. - Adoption is solid. - Support is top notch. But the CFO tanks the deal…because she found out a peer company got the same product…for way less. Not because of product failure. Because of pricing inconsistency. First off - let's be clear: the reps are NOT the villains. They’re just playing the game we set up for them. So if you want to fix the disconnect between short term bookings and long term trust? Fix the scoreboard. Here’s a few things I’ve seen work: 1. Tiered quota credit Reps can discount - but if they do, they get less credit toward quota. Discounting becomes a trade off, not a cheat code. 2. Discount guardrails - Set clear approval tiers. - Give reps flexibility up to a point. - But if they want to go beyond it, the CFO (or a pricing leader) needs to sign off. 3. Margin-based accelerators Reward healthy deals. - Hit quota and get 1.2x. - Hit quota and protect margin? Get 1.4x. 4. Pay on net revenue, not list price Wanna turn the dial to 11? Pay reps based on what the company actually makes, not the top line sticker. This one is definitely not for everyone…but it will fix misaligned incentives overnight. :) At the end of the day, if you want your reps to think like owners, they need to be comped like owners. And if you don’t fix that? The next “hero” deal you close might just be a churn story in 12 months.

Explore categories