From a single machine to a cluster, it is easy to scale horizontally simply by adding servers to cope with greater traffic and concurrency
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
SpringBoot/RabbitMQ/Redis/MySQL, based on the most popular Java microservices framework
Graphic verification code, flow limiting and brush prevention, interface address hiding, various security mechanisms to reject the robot ticket brushing
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
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
Chap10: Conclusion the project
Redis has a decr() method that implements decrement and atomicity
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.