GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codesssss/FlashSale: Flash Sale System AKA. seckill system

BranchesTags
Open more actions menu

Latest commit

 

History

11 Commits
11 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
guideDoc
guideDoc
 
 
src/main
src/main
 
 
target/classes
target/classes
 
 
FlashSaleSystem.iml
FlashSaleSystem.iml
 
 
README.md
README.md
 
 
architecture.svg
architecture.svg
 
 
pom.xml
pom.xml
 
 

Repository files navigation

FlashSaleSystem

  • FlashSaleSystem
    • Project highlights
      • Distributed system scheme
      • System optimization
      • In-depth microservice skills
      • The security policy
    • Server design ideas
      • The overall architecture
    • The detailed guide to build such a system
    • Mainly questions

Project highlights

Distributed system scheme

From a single machine to a cluster, it is easy to scale horizontally simply by adding servers to cope with greater traffic and concurrency

System optimization

Browser cache/Nginx cache/page cache/object cache/RabbitMQ queue asynchronous ordering, reduce network traffic, reduce database pressure, improve the system's concurrent processing capability

In-depth microservice skills

SpringBoot/RabbitMQ/Redis/MySQL, based on the most popular Java microservices framework

The security policy

Graphic verification code, flow limiting and brush prevention, interface address hiding, various security mechanisms to reject the robot ticket brushing

Server design ideas

The bottleneck is the database's ability to handle requests. After a large number of requests are sent to the database, the database may time out or break down due to its limited processing capability. So the idea is to try to intercept requests upstream of the system.

  • For applications that read a lot (read inventory) and write a little (create order), use caching more (for inventory query operations through caching, reduce database operations)

  • Cache, application, database cluster, load balancing; Asynchronous message processing

  • The foreground can do some restrictions to the normal user's operation through JS, and cache some static resources with CDN and user browser

The overall architecture

architecture

The detailed guide to build such a system

Chap01: Integrate Mybatis and Redis

Chap02: MD5 encryption and globle exception handler

Chap03: Implement distributed session via redis

Chap04: Implement the flash sale function

Chap05: Using JMeter to pressure test

Chap06: Page cache and object cache

Chap07: Integrate rabbitMQ and optimize the interface

Chap08: Optimizing the flash sale system after integrated rabbitMQ

Chap09: Dynamic flash sale url, mathematical formula verification code and the interface current limiting

Chap10: Conclusion the project

Main questions

How to ensure thread safety and prevent oversold when inventory is deducted in Redis?

Redis has a decr() method that implements decrement and atomicity

How to limit traffic and prevent robot access?

This is done by interceptor, and we have a custom annotation that will mark a method, specify the number of times it is accessed per unit of time, and if it exceeds the requirement, it will be intercepted.

Interceptor is inherited HandlerInterceptorAdapter, rewriting is preHandle method, in this method, will visit frequency synchronization to Redis, there is the period of validity of the key/value pair. Finally, you need to configure the interceptor into the project, inheriting the WebMvcConfigurerAdapter and overriding the addInterceptors() method.

About

Flash Sale System AKA. seckill system

Resources

Readme
Activity

Stars

14 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.