当前位置:网站首页>缓存综合项目--秒杀架构
缓存综合项目--秒杀架构
2022-06-27 03:49:00 【喵叔哟】
前面几篇文章我们学习了读缓存、写缓存和数据收集的场景,在这篇文章中我们将综合这三个方面来实现一个秒杀架构。
秒杀架构的特点是 僧多粥少,一般来说商品会在两秒内被抢光,后续进来的用户只能看到秒杀结束的界面,因此秒杀开始的前两秒中会出现一个流量峰值。并且秒杀架构设计时要保证商品不能被超卖、下单数据不能丢失、服务器与数据库不能崩溃、尽最大可能屏蔽机器人抢走商品。下面针对这四个方面我们来讲解一下。
一、实现思路
1.1 架构简述
秒杀架构就是一个不断过滤请求的过程,一般来说秒杀系统分为5层:静态资源/负载均衡、网关、后台服务器、缓存和数据库。我们尽量会在第一层和第二层对用户请求进行处理,关于怎么将请求拦截在第一层和第二层的问题,需要结合实际业务来考虑。
1.2 思路
秒杀系统的业务流程分为四层:展示页面、下单、付款和结果。下面就针业务流程的四层分别来讲解一下实现思路。
1.2.1 展示页面拦截请求
对于商品展示页面,我们大部分情况会使用到内容分发网络,也就是常说的CDN,使用CDN的优点是我们不需要花费自己的服务器资源,并且响应速度快,可以把静态资源的压力转嫁到外部系统。
既然有静态资源ÿ
边栏推荐
- Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
- Further exploration of handler (I) (the most complete analysis of the core principle of handler)
- How can e-commerce products be promoted and advertised on Zhihu?
- Resnet152 pepper pest image recognition 1.0
- LDR6028 手机设备一边充电一边OTG传输数据方案
- Further exploration of handler (Part 2) (the most complete analysis of the core principles of handler)
- Static timing analysis OCV and time derive
- 乐得瑞LDR6035 USB-C接口设备支持可充电可OTG传输数据方案。
- Yuantou firm offer weekly record 20220627
- ESP8266
猜你喜欢

Uni-app 之uParse 富文本解析 完美解析富文本!

PostgreSQL basic command tutorial: create a new user admin to access PostgreSQL

Anaconda3安装过程及安装后缺失大量文件,没有scripts等目录

CVPR2021:Separating Skills and Concepts for Novel Visual Question Answering将技巧与概念分开的新视觉问答

卷积神经网络(CNN)网络结构及模型原理介绍

Kotlin Compose compositionLocalOf 与 staticCompositionLocalOf

为什么 C# 访问 null 字段会抛异常?

ERP需求和销售管理 金蝶

jmeter分布式压测

文旅夜游|以沉浸式视觉体验激发游客的热情
随机推荐
PAT甲级 1019 General Palindromic Number
Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused
NestJS环境变量配置,解决如何在拦截器(interceptor)注入服务(service)的问题
Easy to use plug-ins in idea
ERP需求和销售管理 金蝶
低代码开发平台NocoBase的安装
iOS开发:对于动态库共享缓存(dyld)的了解
2021:Passage Retrieval for Outside-KnowledgeVisual Question Answering通道检索的外部知识视觉问答
与STM32或GD32替换说明
PAT甲级 1024 Palindromic Number
WPF 开源控件库Extended WPF Toolkit介绍(经典)
Career outlook, money outlook and happiness outlook
栈溢出漏洞
Overview of Tsinghua & Huawei | semantic communication: Principles and challenges
卷积神经网络(CNN)网络结构及模型原理介绍
2022 operation of simulated examination platform for tea artist (Senior) work license question bank
2021:AdaVQA: Overcoming Language Priors with Adapted Margin Cosine Loss∗自适应的边缘余弦损失解决语言先验
2020:MUTANT: A Training Paradigm for Out-of-Distribution Generalizationin Visual Question Answering
2016Analyzing the Behavior of Visual Question Answering Models
[promise I] introduction of promise and key issues of hand rolling