TicketMax is a ticket selling web application with queueing system.
- SignIn
- Tech Stack
- Architecture Diagram
- Database Schema
- Features
- Queueing System
- Lock the Seat
- Load Test
Testing Account | |
---|---|
[email protected] | |
Password | karry |
Client: HTML, TailwindCSS, JavaScript
Server: Node.js, Express
Database: RDS (MySQL), ElastiCache (Redis)
Cloud Service(AWS): EC2, S3, EventBridge, Lambda, SQS, RDS, ElastiCache, API Gateway, CloudFront
Tool: RabbitMQ
- Used SQS FIFO queues and Lambda delay people from accessing the seat selection page, and managed it with CDK.
- Achieved the capability to handle 7000 requests within 10 seconds in seat selection page, and process 6000 orders within 40 seconds.
- Deployed the static Front-End page on S3 and accessed via CloudFront.
- Integrated EventBridge to pre-warm Lambda before events sell.
- Employed RabbitMQ queues to handle expired order and payment system.
- Utilized the Redis Lua script to lock the seat, preventing race condition.
Queueing.system.mp4
- Users enter the SQS FIFO queue with a unique token, which Lambda places it into ElastiCache.
- Short polling is used to check if the token exists in ElastiCache. If found, the user receives the seat map. Otherwise, they receive the number of users ahead in the queue.
lock_seat.mp4
- Utilize the Redis Lua script to lock seats, ensuring that each seat can only be selected by one user at a time.
- Only those who successfully reserved a seat will create an order using MySQL, which helps in reducing the workload on the database.
A concert ticketing website may experience high traffic when event go on sale.
Utilized K6 spike test to simulate sudden and very high load when a event start selling.
The testing cover three APIs.
Enter the queue: users are allowed to join the SQS FIFO queues with a unique token, which Lambda places it into ElastiCache.
Check unique token: Lambda will check if unique token exists in ElastiCache by short polling and return seat map.
Submit the order: interact with EC2 server, which handles the completion of the seat selection process.
- EC2 instance type
Instance | vCPU | Memory |
---|---|---|
t4g.small * 1 | 2 | 2 (GiB) |
- Parameters for Lambda and SQS
API | SQS batch | Lambda count |
---|---|---|
Enter the queue | 5 | 5 |
Check unique token | - | 450 |
- Spike test configurations
time(s) | Vus |
---|---|
10 | 5000 |
- The queueing system processes around 7000 users in 10 seconds.
- Within 40 seconds, approximately 6000 users successfully submit their orders, while about 1000 users remain in the queue.
- 25% to 35% of the CPU is utilized.