Coder Social home page Coder Social logo

ticketmax's Introduction

TicketMax

TicketMax is a ticket selling web application with queueing system.

Content

SignIn

Testing Account
Email [email protected]
Password karry

Tech Stack

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

Architecture Diagram

architecture-diagram

Database Schema

database-schema

Features

  • 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

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 the Seat

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.

Load Test

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.

api1



Check unique token: Lambda will check if unique token exists in ElastiCache by short polling and return seat map.

api2



Submit the order: interact with EC2 server, which handles the completion of the seat selection process.

api2

Setting

  • 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

Report

load-test-img
  • 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.

ticketmax's People

Contributors

karry0104 avatar

Stargazers

47chen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.