August 19, 2025
Migrating Coupons from Monolith to Microservice
Our JourneyBackground: The Heart of Our Platform Coupons are central to our platform, driving user engagement and retention through credit points and discounts. Historically, this critical system resided within our extensive PHP monolith, deeply integrated with almost all major modules like accounting, payment processing, checkout, listings, and item management. While this architecture initially facilitated rapid iteration, its limitations became apparent as our product and team grew. Why We Decided to Migrate The coupon domain’s deep entanglement with critical modules increasingly hampered agility and introduced operational risks. As some parts of our system transitioned to microservices while others remained in the monolith, complexity mounted. Our key motivations for this migration included: Technical Debt: The monolith’s increasing complexity hindered development and heightened regression risks. Scalability: Coupon processing needed to accommodate a growing user base and higher loads. Reliability and Ownership: We needed clearer data ownership boundaries and a straightforward path for performance optimization. What This Blog Post Covers In this post, I will detail the approach we adopted for migrating our coupon system to a robust, scalable microservice, including our methodology, the challenges we encountered, and the lessons we learned.The Challenges Migrating a critical domain like coupons involves more than just moving code. Here’s what made this journey particularly complex: Tight Coupling: The coupon domain’s pervasive connections to accounting, payments, listing, and item screens meant that moving one piece affected many others. Always-On Expectations: Our services needed to remain continuously available without significant downtime or interruptions. Data Consistency: The migration demanded meticulous management to prevent any coupon, transaction, or reward notification from being missed. Scalability: The new architecture had to match or surpass the original system’s scale. Performance: Achieving the monolith’s native speed despite additional network hops was a significant hurdle. Unclear Ownership: Ambiguities regarding endpoint and database ownership required resolution before… <a class="more-link" href="https://about.in.mercari.com/news/mercari-india/migrating-coupons-from-monolith-to-microservice/">Continue reading <span class="screen-reader-text">Migrating Coupons from Monolith to Microservice</span></a>