当前位置:网站首页>千万级购物车系统缓存架构方案
千万级购物车系统缓存架构方案
2022-06-25 15:57:00 【华为云】
作者简介:小明的Java问道之路,某大型金融互联网公司后端研发高级工程师,擅长订单/交易领域的高安全/可用/并发/性能的架构设计与落地,专注于研究计算机底层与金融科技领域技术
如果此文还不错的话,还请关注、点赞、收藏三连支持一下博主
本文导读:本文主要介绍redis在千万级系统中设计架构方案,包括主架构设计、缓存一致性方案、大value处理方案和redis限流和故障恢复降级方案
缓存架构主架构图:
主架构中包括缓存集群、缓存限流、缓存大value处理、HotKey探测系统、redis故障恢复降级和redis-mysql数据同步
缓存一致性解决方案:
一、对于所有的DB操作都不去添加具体的删除缓存的操作,而是通过canal监听binlog的方式
二、待数据确认已提交到数据库后,通过监听的变化,解析出对应的数据后,过滤掉非增删改的
binlog
三、然后通过常量类配置的需要处理数据一致性的相关表以及关键字段和缓存前缀key,进行组装出需要进行删除的缓存key。并且通过mq的ack机制来保证缓存一定会被删除掉。
缓存限流解决方案:
防止redis崩溃之后,系统无法正常运转,所以我们需要做一个降级处理。
系统操作redis的所有方法一般都是通过RedisCache和Redislock两个类来处理的,所以我们通过AOP切面的方式,对这两个类中的所有方法做一个切面,如果在这里执行redis操作的时候,redis挂掉了,连接失败了,那么方法会抛异常,我们在切面处理方法上,捕捉异常,然后记录一下是redis挂掉还是网络暂时的波动
大Value处理方案:
一、搭建的redis集群
二、在canal中已经创建好了监听,存储到mysql中redis_large_key_log表的canal instance
三、在每天凌晨3点,会将Redis中的大key(value)数据,通过canal instance发送到 MQ
四、消费redis_large_key_log表的binlog数据,该数据包含Redis的大key(value)信息
五、将大value切分成多个key,返回时拼接组装
边栏推荐
- Nsurlsession learning notes (III) download task
- uniapp实现图片(单张/多张)预览
- When inputting text in the shutter textfield, if the page is refreshed, the cursor position will change.
- Most commonly used SQL statements
- 赫尔辛基交通安全改善项目部署Velodyne Lidar智能基础设施解决方案
- The database records are read through the system time under the Android system, causing the problem of incomplete Reading Records!
- 加密潮流:时尚向元宇宙的进阶
- Day_ twelve
- White screen, how fouc is formed, and how to avoid it
- 10款超牛Vim插件,爱不释手了
猜你喜欢

What exactly is a handler

Helsinki traffic safety improvement project deploys velodyne lidar Intelligent Infrastructure Solution

What processes are needed to build a wechat applet from scratch?

Read mysql45 lecture - index

Understanding of reflection part

The third day of mysql45

炮打司令部,别让一个UI框架把你毁了

Bugly hot update usage

Stop "outsourcing" Ai models! The latest research finds that some "back doors" that undermine the security of machine learning models cannot be detected

Precautions for function default parameters (formal parameter angle)
随机推荐
[untitled]
Kettle表输入组件精度丢失的问题
Message format of Modbus (PLC)
【 apprentissage automatique】 cas de prévision et d'analyse de l'examen d'entrée à l'Université basé sur des séries chronologiques multiples
Go language - what is critical resource security?
One minute to familiarize yourself with the meaning of all fluent question marks
Once the code was encrypted by the company's computer, the compilation failed
Shuttle pop-up returns to the upper level
Advanced SQL statement 1 of Linux MySQL database
根据先序遍历和中序遍历生成后序遍历
Rxjs TakeUntil 操作符的学习笔记
报错:homebrew-core is a shallow clone
The third day of mysql45
3.条件概率与独立性
Uniapp converts graphic verification codes in the form of file streams into images
Deadlock, thread communication, singleton mode
Error: homebrew core is a shallow clone
Summary of 2022 spring moves of ordinary people (Alibaba and Tencent offer)
Day_ fifteen
Unity技术手册 - 生命周期内大小(Size over Lifetime)和速度决定大小(Size by Speed)


