inflearn logo

Designing a Server System to Withstand Traffic Surges - Coupon Issuance Service

By implementing a first-come, first-served coupon system, you will solve core real-world backend challenges such as concurrency issues, data integrity, and peak traffic handling. You will discover problems by writing code yourself and gain hands-on experience with essential industry skills like synchronous/asynchronous processing and queue management. This is a project-based course designed for junior developers and job seekers to build practical experience.

(5.0) 3 reviews

319 learners

Level Basic

Course period Unlimited

Java
Java
Kotlin
Kotlin
MySQL
MySQL
Docker
Docker
Spring Boot
Spring Boot
Java
Java
Kotlin
Kotlin
MySQL
MySQL
Docker
Docker
Spring Boot
Spring Boot

What you will gain after the course

  • Concurrency Problem Solving and Data Consistency Assurance Techniques

  • Traffic load balancing design through synchronous/asynchronous processing

  • Implementing a Queue System and Peak Traffic Defense Architecture


Why does a server that's usually fine collapse when an event starts? 🚦


  • When a first-come, first-served coupon event opens, numerous requests hit the same inventory simultaneously.

  • More coupons may be issued than the prepared quantity, the same user might receive two, or records across multiple storages could become inconsistent.


Instead of memorizing a finished architecture, this course involves personally breaking down a coupon issuance service and redesigning it from scratch.


Reproduce the problem, measure TPS, P99, error rate, and actual issuance accuracy, then select DB Lock, Redis, Kafka, Cache, and Virtual Waiting Room to re-verify under the same load.


  • Write code using Kotlin and Spring Boot.

  • We will run MySQL, Redis, and Kafka using Docker Compose, and even if you are new to Redis and Kafka, you can follow along step-by-step as long as you have a basic understanding of HTTP, RDB, and Spring Boot.


Features of this course


📌 We will continuously evolve a single coupon service, starting from basic implementation and progressing through concurrency, asynchronous processing, caching, consistency recovery, and traffic control.

📌 We repeat the flow of problem reproduction → bottleneck measurement → design choice → re-verification under the same conditions in every part.

📌 We don't just look at TPS and P99. We also verify whether exactly N tickets were issued, whether the one-ticket-per-person rule was enforced, and whether all events were saved to MySQL without any omissions.

📌 We directly compare various alternatives such as DB pessimistic locking, Redis Lua, in-memory queues, and Kafka to determine when and what to choose.

📌 We don't stop at theory. Working code, execution environments, k6 load scenarios, and verification results before and after changes are provided as a complete set.

Recommended for these people

Junior backend developers experiencing peak traffic for the first time

This is perfect for those who feel overwhelmed and don't know whether to start with the DB, cache, or queue when requests flood in.

Backend job seekers who want to develop their design capabilities

I recommend this to those who want to explain their projects through problems, choices, and results instead of just listing technology names.

Server development learners who want to verify performance with numbers

This is helpful for those who want to go beyond CRUD and evolve their systems through load testing and failure reproduction.

This is a great fit for those who are familiar with simple implementations but feel lost on where to start checking or which technologies to choose when traffic surges. Through the process of reproducing problems firsthand and improving designs based on measurement results, you will establish decision-making criteria that can be applied in real-world practice.


After completing the course

✓ You can implement issuance logic that maintains accurate quantities and the one-ticket-per-person rule even under concurrent requests.

✓ You can compare the pros and cons of DB pessimistic locking, Redis distributed locking, and Redis Lua atomic operations, and choose the appropriate method for each situation.

✓ Separate user response and DB storage using Kafka, and recover failed messages through DLT and reprocessing flows.

✓ You can detect and respond to Cache Stampede, post-sell-out request surges, and inconsistencies between Redis and MySQL.

✓ Connect the virtual waiting room with the Gateway Rate Limit to make legitimate users wait while blocking abusers at the entrance.

✓ You can prove design improvements through results by measuring not only TPS, P99, and error rates, but also issuance volume, duplication, and storage omissions.


What you will learn

Reproduce the problem and find the cause with numbers

Intentionally create coupon over-issuance and bottlenecks. Read TPS, P99, error rates, and accuracy metrics, then compare the design before and after under the same k6 load conditions. Create the basis for your next decision with measured values, not just intuition.

Grow through 6 stages, from basic implementation to traffic control

We proceed in the following order: coupon requirement implementation, concurrency control, asynchronous processing, cache strategy, consistency recovery, and traffic control. By identifying the limitations of each stage, you will naturally understand why the next design is necessary.

Connect multiple technologies into a single coupon issuance flow

The Gateway and virtual waiting room control the entry speed, while Redis atomically handles inventory and duplicate issuance. The Kafka Worker saves to MySQL, and the batch scheduler checks for inconsistencies between the two data stores.

Both the code and verification results are preserved together

We will write the application using Kotlin and Spring Boot. We'll run MySQL, Redis, and Kafka using Docker Compose, and use k6 to apply actual load to verify TPS, P99, error rates, issuance volume, duplicates, and storage omissions.

Why I created this course

  • When looking at a completed architecture, every choice seems obvious, but in practice, you must identify the root cause and choose one from several alternatives.

  • Rather than simply showing how to add another famous technology, I wanted to convey the power to decide where to control requests, which state to place where, and what criteria to use for determining success.

This is not covered in this course

  • We won't be broadly covering coupon-related domains like payment and shipping, nor will we go over all distributed systems theories.

  • We will focus on the conditions of issuing a fixed quantity of coupons, one per person, a set start time, and ending upon sell-out.

Notes before taking the course

Hands-on Environment

• We use Kotlin, Spring Boot, and Gradle.

• MySQL, Redis, and Kafka are run using Docker Compose.

• We use k6 for load testing.

• You can practice in Windows, macOS, or Linux environments where Docker can be executed.

• At least 8GB of memory is recommended for smooth practice.

Learning Materials

• Lecture slides and the full source code are provided.

• We provide execution environments for each part and Docker Compose configurations.

• There are k6 load testing scenarios that you can run repeatedly yourself.

• Review the design documents for each stage along with the verification results before and after the changes.

Prerequisites and Notices

• A basic understanding of HTTP and REST APIs is required.

• Relational databases and SQL at the level of SELECT and UPDATE are used.

• You need to be familiar with Java or Kotlin syntax.

• Basic knowledge of Spring Boot is recommended.

• Redis and Kafka experience is not required.




Recommended for
these people

Who is this course right for?

  • A junior backend developer looking to gain practical experience

  • A backend job seeker who wants to learn about concurrency control and high-traffic processing.

  • A computer science student who wants to experience practical, industry-level backend system design

Need to know before starting?

  • Understanding of basic syntax for backend programming languages (Java, Python, etc.)

  • Basic knowledge of databases and SQL

  • Basic concepts of REST API and HTTP communication

Hello
This is apiece

Career Verified

1,029

Learners

39

Reviews

43

Answers

4.9

Rating

5

Courses

While working as a developer at Kakao and SK,
I have designed and operated various backend systems in real-world service environments.

I am creating knowledge-sharing content with the hope that the trial and error and the concerns I have experienced
can save even a little bit of time and effort for your choices as students.

If you have any opinions or suggestions for improvement regarding the content,
please feel free to let me know at the email address below at any time.
I look forward to your honest feedback. Thank you.
apiece.dev.ai@gmail.com

More

Curriculum

All

59 lectures ∙ (10hr 17min)

Course Materials:

Lecture resources
Published: 
Last updated: 

Reviews

All

3 reviews

5.0

3 reviews

  • maruhxn님의 프로필 이미지
    maruhxn

    Reviews 11

    Average Rating 5.0

    5

    61% enrolled

    I hadn't been able to organize the potential issues that occur with large-scale traffic in my head, but this single lecture makes me feel like all my fragmented knowledge is finally coming together. I am so grateful to be able to take a course like this.

    • apiece
      Instructor

      Hello, maruhxn. I am truly glad to hear that your fragmented knowledge has been connected into one, as it means the intention behind creating this lecture was well-conveyed. I hope it helped you establish a standard for looking at large-scale traffic issues. Thank you for leaving a review! 😊

  • jorealbusiness님의 프로필 이미지
    jorealbusiness

    Reviews 7

    Average Rating 5.0

    5

    31% enrolled

    • wlgusqkr116518님의 프로필 이미지
      wlgusqkr116518

      Reviews 3

      Average Rating 5.0

      5

      80% enrolled

      Similar courses

      Explore other courses in the same field!

      Limited time deal

      $355,671.00

      69%

      $42.90