├── Java ├── 集合.png ├── GC.gmind ├── 并发.gmind ├── 集合.gmind ├── JVM.gmind ├── Lock.gmind ├── 关键字.gmind ├── 线程池.gmind ├── 面向对象.gmind ├── Java 基础.gmind └── Sychronized 锁.gmind ├── 操作系统 ├── IO.png ├── 死锁.png ├── IO.gmind ├── 内存分配.png ├── 死锁.gmind ├── 内存分配.gmind ├── 进程&线程&协程.png └── 进程&线程&协程.gmind ├── MySQL ├── 优化.gmind ├── 索引.gmind ├── MySQL.gmind └── 事务 & 锁 & 日志.gmind ├── 中间件 ├── Redis.gmind ├── 分布式事务.gmind └── RabbitMQ.gmind ├── Spring ├── Bean.gmind ├── Spring.png ├── Spring.gmind ├── SpringBoot.gmind └── SpringMVC.gmind ├── 计算机网络 ├── Socket.gmind ├── TCP协议.gmind ├── OSI七层网络模型.gmind └── HTTP与HTTPS.gmind └── git常用指令速查.txt /Java/集合.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/集合.png -------------------------------------------------------------------------------- /操作系统/IO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/IO.png -------------------------------------------------------------------------------- /操作系统/死锁.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/死锁.png -------------------------------------------------------------------------------- /Java/GC.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/GC.gmind -------------------------------------------------------------------------------- /Java/并发.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/并发.gmind -------------------------------------------------------------------------------- /Java/集合.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/集合.gmind -------------------------------------------------------------------------------- /操作系统/IO.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/IO.gmind -------------------------------------------------------------------------------- /操作系统/内存分配.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/内存分配.png -------------------------------------------------------------------------------- /操作系统/死锁.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/死锁.gmind -------------------------------------------------------------------------------- /Java/JVM.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/JVM.gmind -------------------------------------------------------------------------------- /Java/Lock.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/Lock.gmind -------------------------------------------------------------------------------- /Java/关键字.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/关键字.gmind -------------------------------------------------------------------------------- /Java/线程池.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/线程池.gmind -------------------------------------------------------------------------------- /Java/面向对象.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/面向对象.gmind -------------------------------------------------------------------------------- /MySQL/优化.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/MySQL/优化.gmind -------------------------------------------------------------------------------- /MySQL/索引.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/MySQL/索引.gmind -------------------------------------------------------------------------------- /中间件/Redis.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/中间件/Redis.gmind -------------------------------------------------------------------------------- /中间件/分布式事务.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/中间件/分布式事务.gmind -------------------------------------------------------------------------------- /操作系统/内存分配.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/内存分配.gmind -------------------------------------------------------------------------------- /Java/Java 基础.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/Java 基础.gmind -------------------------------------------------------------------------------- /MySQL/MySQL.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/MySQL/MySQL.gmind -------------------------------------------------------------------------------- /Spring/Bean.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Spring/Bean.gmind -------------------------------------------------------------------------------- /Spring/Spring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Spring/Spring.png -------------------------------------------------------------------------------- /操作系统/进程&线程&协程.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/进程&线程&协程.png -------------------------------------------------------------------------------- /计算机网络/Socket.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/计算机网络/Socket.gmind -------------------------------------------------------------------------------- /计算机网络/TCP协议.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/计算机网络/TCP协议.gmind -------------------------------------------------------------------------------- /Spring/Spring.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Spring/Spring.gmind -------------------------------------------------------------------------------- /操作系统/进程&线程&协程.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/操作系统/进程&线程&协程.gmind -------------------------------------------------------------------------------- /计算机网络/OSI七层网络模型.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/计算机网络/OSI七层网络模型.gmind -------------------------------------------------------------------------------- /MySQL/事务 & 锁 & 日志.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/MySQL/事务 & 锁 & 日志.gmind -------------------------------------------------------------------------------- /Spring/SpringBoot.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Spring/SpringBoot.gmind -------------------------------------------------------------------------------- /Spring/SpringMVC.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Spring/SpringMVC.gmind -------------------------------------------------------------------------------- /计算机网络/HTTP与HTTPS.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/计算机网络/HTTP与HTTPS.gmind -------------------------------------------------------------------------------- /Java/Sychronized 锁.gmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UuMuR/BaGu/HEAD/Java/Sychronized 锁.gmind -------------------------------------------------------------------------------- /git常用指令速查.txt: -------------------------------------------------------------------------------- 1 | 目前掌握的点,今后继续补充 2 | 一、常用指令 3 | 1、git add -- 添加至暂存区(当前分支) 4 | git status -- 查看当前仓库状态,红字显示未添加的有变更的文件,可选参数-s简短输出 5 | git log (--online) + (--graph) -- 查看(简洁)提交日志,--graph参数可以更清晰显示分支 6 | git log --author=zhangweiyi --online -- 查看用户zhangweiyi提交的内容 7 | 8 | 2、git branch -- 列出所有分支 9 | 常用:git branch + (-d) + <分支名> 10 | #创建(删除) 11 | 12 | 3、git checkout (-b) + <分支名> -- (创建并)切换至该分支 13 | 14 | 4、git clean -- 清除工作区未跟踪文件 15 | 16 | 5、git clone -- 克隆版本库(包括版本变化) 17 | 常用:git clone + <远程仓库url> + (<本地文件目录名>) 18 | 19 | 6、git commit -- 提交 20 | 常用:git commit + ( + + ....) + (-a不需要add,直接提交) + (-m提交信息) + 21 | #提交暂存区所有(指定)内容到本地仓库中 22 | 23 | 7、git config -- 查询 git 配置 24 | 常用:1、git config --list 25 | #显示git核心配置 26 | 2、git config -e + (--global) 27 | git config --global user.name "zhangweiyi" 28 | git config --global user.email zhangweiyi.123@bytedance.com 29 | #编辑当前(全局)仓库git配置 30 | 31 | 8、git diff -- 比较版本差异 32 | 常用:1、git diff 33 | #当暂存区为空,对比工作区与最后一次commit的文件内容 34 | #当暂存区不为空,对比工作区和暂存区中的文件内容 35 | 2、git diff --cached 36 | #对比暂存区和最后一次commit的文件内容 37 | 3、git diff + + + (可选参数,不详细展示区别内容) --stat 38 | #对比两个分支最后一次commit的内容区别 39 | 40 | 9、git fetch -- 克隆远程仓库的一个分支 41 | 注:fetch是克隆一个分支,clone是克隆仓库,pull = fetch + merge 42 | 常用:1、git fetch + + <远程分支名> : <本地分支名> 43 | #将远程分支最新版本下载到本地 44 | 2、git diff <本地分支名> 45 | #比较下载的分支内容与本地master内容区别 46 | 3、git merge <本地分支名> 47 | #合并到本地master分支 48 | 49 | 10、git pull -- 拉取远程仓库分支更新到本地(获取最新版本) 50 | 常用:git pull + + <远程分支名> : <本地分支名(若无此项,代表拉取到本地当前分支)> 51 | 52 | 11、git push -- 将本地分支版本上传到远程并合并 53 | 常用:git push + (--force) + + <本地分支名> : <远程分支名(若分支同名可省略)> 54 | #可用参数--force,若两者版本有差异则可强制推送 55 | 56 | 12、git merge -- 合并分支 57 | 常用:git merge + 58 | #将分支合并到master分支 59 | 60 | 13、git mv -- 移动或重命名 61 | git (-r) rm + -- (可选参数递归删除) 删除工作区和暂存区中该文件 62 | git rm --cached + -- 仅删除暂存区中该文件 63 | 64 | 14、git reset -- 回退版本 65 | 常用:1、git reset + <--soft / --mixed / --hard> + HEAD^ + ()+ () 66 | #回退到(某个文件)所有内容的上一个(指定)版本 67 | #HEAD:当前版本,HEAD^:上一个版本,HEAD^^:上上一个版本...... 68 | #当为HEAD时与rm --cached效果类似,用于取消add添加的内容 69 | #--soft:仅改变引用,工作区与暂存区保持不变 70 | #--mixed:默认,回退暂存区内容到上一次commit版本,工作区保持不变 71 | #--hard:工作区与暂存区均改变 72 | 73 | 15、git remote -- 查看远程仓库,参数-v显示详细信息 74 | 常用:1、git remote add + <远程仓库url> 75 | #添加新的远程仓库 76 | 2、git remote rm + / git remote rename 77 | #删除/重命名 -------------------------------------------------------------------------------- /中间件/RabbitMQ.gmind: -------------------------------------------------------------------------------- 1 | PK 2 | &)qTIlYW)E)E content.json{"root":{"data":{"id":"cijdw582zq80","created":1647240130659,"text":"RabbitMQ","html":"

RabbitMQ

","right-number":7},"commentCount":0,"children":[{"data":{"id":"cijdwc1drww0","created":1647240145492,"html":"

特点

","text":"特点"},"commentCount":0,"children":[{"data":{"id":"cijdwwjerb40","created":1647240190117,"html":"

1、解耦:使用传统的服务间远程调用方式,需要在代码中直接调用其他模块,并且其他模块的不可用会导致整个

业务流程不可用;而在消息队列中,调用者仅需要将消息放入消息队列,由调用的模块订阅这个队列并取出消息进行

消费,不需要知道具体调用了什么模块,以及其他模块的健康状态

","text":"1、解耦:使用传统的服务间远程调用方式,需要在代码中直接调用其他模块,并且其他模块的不可用会导致整个\n业务流程不可用;而在消息队列中,调用者仅需要将消息放入消息队列,由调用的模块订阅这个队列并取出消息进行\n消费,不需要知道具体调用了什么模块,以及其他模块的健康状态"},"commentCount":0,"children":[]},{"data":{"id":"cije07m0p200","created":1647240449312,"html":"

2、异步:传统的远程调用方式,需要等待调用的模块全部执行完毕才能返回;在消息队列中,调用者可以将消息放入

消息队列后直接返回结果,由消费者异步的处理消息

","text":"2、异步:传统的远程调用方式,需要等待调用的模块全部执行完毕才能返回;在消息队列中,调用者可以将消息放入\n消息队列后直接返回结果,由消费者异步的处理消息"},"commentCount":0,"children":[]},{"data":{"id":"cije20slns80","created":1647240591201,"html":"

3、削峰/限流:假设服务器最多能一次性处理 1k 请求,在少数的某一时刻(例如秒杀)请求突增到 100k,会导致服务器

的崩溃,而如果将服务器的硬件资源强行提升,会造成资源浪费;使用消息队列,可以由生产者将消息发送到消息队列,

由消息队列对服务器暂时无法处理的请求进行堆积,从而实现短时间内突发的大量请求的平滑处理

","text":"3、削峰/限流:假设服务器最多能一次性处理 1k 请求,在少数的某一时刻(例如秒杀)请求突增到 100k,会导致服务器\n的崩溃,而如果将服务器的硬件资源强行提升,会造成资源浪费;使用消息队列,可以由生产者将消息发送到消息队列,\n由消息队列对服务器暂时无法处理的请求进行堆积,从而实现短时间内突发的大量请求的平滑处理"},"commentCount":0,"children":[]}]},{"data":{"id":"cije4xmcbq80","created":1647240819385,"html":"

结构

","text":"结构"},"commentCount":0,"children":[{"data":{"id":"cijejdx5q0g0","created":1647241951966,"html":"

1、Publisher:消息生产者

","text":"1、Publisher:消息生产者"},"commentCount":0,"children":[]},{"data":{"id":"cijek0ir07c0","created":1647242001160,"html":"

2、Consumer:消息消费者

","text":"2、Consumer:消息消费者"},"commentCount":0,"children":[]},{"data":{"id":"cijek52x71c0","created":1647242011087,"html":"

3、Broker:一个 MQ 服务节点

","text":"3、Broker:一个 MQ 服务节点"},"commentCount":0,"children":[{"data":{"id":"cijekj5acj40","created":1647242041705,"html":"

Queue:消息队列

","text":"Queue:消息队列"},"commentCount":0,"children":[]},{"data":{"id":"cijekmdjp940","created":1647242048735,"html":"

Exchange:交换机,根据消息的 Routing Key 找到有对应 Binding Key 的消息队列进行消息转发

","text":"Exchange:交换机,根据消息的 Routing Key 找到有对应 Binding Key 的消息队列进行消息转发"},"commentCount":0,"children":[]}]},{"data":{"id":"cijeny52acg0","created":1647242309436,"html":"

4、Routing Key:消息的路由关键字

","text":"4、Routing Key:消息的路由关键字"},"commentCount":0,"children":[]},{"data":{"id":"cijeo4tqci00","created":1647242323988,"html":"

5、Binding Key:队列与交换机绑定时声明

","text":"5、Binding Key:队列与交换机绑定时声明"},"commentCount":0,"children":[]},{"data":{"id":"cijeosmfm740","created":1647242375790,"html":"

6、Connection:Consumer、Publisher 与 Broker 之间建立的连接,例如 TCP 连接

","text":"6、Connection:Consumer、Publisher 与 Broker 之间建立的连接,例如 TCP 连接"},"commentCount":0,"children":[]},{"data":{"id":"cijepapi7mo0","created":1647242415157,"html":"

7、Channel:信道,一个 TCP 连接可以包含多个信道,以此来多路复用一个 TCP 连接,减少连接建立和销毁的开销,

MQ 的通信都是在信道中完成的

","text":"7、Channel:信道,一个 TCP 连接可以包含多个信道,以此来多路复用一个 TCP 连接,减少连接建立和销毁的开销,\nMQ 的通信都是在信道中完成的"},"commentCount":0,"children":[]}]},{"data":{"id":"cijew0ct7xc0","created":1647242941171,"html":"

Exchange 类型

","text":"Exchange 类型"},"commentCount":0,"children":[{"data":{"id":"cijew49omnk0","created":1647242949689,"html":"

1、Fanout Exchange:将消息发送至所有与其进行绑定的队列当中

","text":"1、Fanout Exchange:将消息发送至所有与其进行绑定的队列当中"},"commentCount":0,"children":[]},{"data":{"id":"cijewxyetd40","created":1647243014311,"html":"

2、Direct Exchange:将消息发送至 BindingKey 与 RoutingKey 完全匹配的队列当中,是一种单播模式

","text":"2、Direct Exchange:将消息发送至 BindingKey 与 RoutingKey 完全匹配的队列当中,是一种单播模式"},"commentCount":0,"children":[]},{"data":{"id":"cijexrescio0","created":1647243078428,"html":"

3、Topic Exchange:类似于通配符匹配,由 '.' 将单词隔开,将消息发送至所有匹配的队列当中

","text":"3、Topic Exchange:类似于通配符匹配,由 '.' 将单词隔开,将消息发送至所有匹配的队列当中"},"commentCount":0,"children":[]}]},{"data":{"id":"cijf22rtaw80","created":1647243416617,"html":"

工作流程

","text":"工作流程"},"commentCount":0,"children":[{"data":{"id":"cijf25pmcdc0","created":1647243423015,"html":"

1、预先准备

","text":"1、预先准备"},"commentCount":0,"children":[{"data":{"id":"cijf29ct8ow0","created":1647243430947,"html":"

在 Consumer 服务中声明一个交换机和交换队列

","text":"在 Consumer 服务中声明一个交换机和交换队列"},"commentCount":0,"children":[]},{"data":{"id":"cijf2hvqqn40","created":1647243449506,"html":"

通过 BindingKey 将交换队列绑定至交换机

","text":"通过 BindingKey 将交换队列绑定至交换机"},"commentCount":0,"children":[]}]},{"data":{"id":"cijf32xhi1c0","created":1647243495324,"html":"

2、Publisher 发送消息

","text":"2、Publisher 发送消息"},"commentCount":0,"children":[{"data":{"id":"cijf37ukusg0","created":1647243506032,"html":"

使用 rabbitTemplate.convertAndSend 发送消息,发送时指定消息的 RoutingKey,交换机名称,具体的消息

","text":"使用 rabbitTemplate.convertAndSend 发送消息,发送时指定消息的 RoutingKey,交换机名称,具体的消息"},"commentCount":0,"children":[]},{"data":{"id":"cijf47sb48g0","created":1647243584259,"html":"

建立 Connection 连接,连接到 Broker,开启一个 Channel,交换机找到对应的消息队列并存入消息

","text":"建立 Connection 连接,连接到 Broker,开启一个 Channel,交换机找到对应的消息队列并存入消息"},"commentCount":0,"children":[]},{"data":{"id":"cijf5vd07d40","created":1647243713941,"html":"

关闭 Channel

","text":"关闭 Channel"},"commentCount":0,"children":[]}]},{"data":{"id":"cijf5yawaeo0","created":1647243720344,"html":"

3、Consumer 消费消息

","text":"3、Consumer 消费消息"},"commentCount":0,"children":[{"data":{"id":"cijf8svvyns0","created":1647243943645,"html":"

通过 Connection 连接到 Broker,建立 Channel

","text":"通过 Connection 连接到 Broker,建立 Channel"},"commentCount":0,"children":[]},{"data":{"id":"cijfa35gq8w0","created":1647244044356,"html":"

从监听的队列中获取消息

","text":"从监听的队列中获取消息"},"commentCount":0,"children":[]},{"data":{"id":"cijfa809l800","created":1647244054925,"html":"

消费者确认收到消息并返回 Ack,消息队列收到后将消息删除

","text":"消费者确认收到消息并返回 Ack,消息队列收到后将消息删除"},"commentCount":0,"children":[]},{"data":{"id":"cijfayrnoq00","created":1647244113178,"html":"

关闭 Channel

","text":"关闭 Channel"},"commentCount":0,"children":[]}]}]},{"data":{"id":"cijfb3l1guw0","created":1647244123662,"html":"

重复消费问题

","text":"重复消费问题"},"commentCount":0,"children":[{"data":{"id":"cijfi84yfmo0","created":1647244682122,"html":"

消费者接收到消息后的 Ack 确认可能没有到达消息队列,此时消息队列可能又将消息交给其他消费者

","text":"消费者接收到消息后的 Ack 确认可能没有到达消息队列,此时消息队列可能又将消息交给其他消费者"},"commentCount":0,"children":[]},{"data":{"id":"cijfibfydkg0","created":1647244689317,"html":"

不重复消费的方法:保证消息的幂等性

","text":"不重复消费的方法:保证消息的幂等性"},"commentCount":0,"children":[{"data":{"id":"cijfigvygd40","created":1647244701169,"html":"

对于修改数据的操作,比如减库存等,可以添加判断条件,不满足则不进行操作

","text":"对于修改数据的操作,比如减库存等,可以添加判断条件,不满足则不进行操作"},"commentCount":0,"children":[]},{"data":{"id":"cijfiljul1k0","created":1647244711321,"html":"

对于 insert、delete 等操作,可以通过 Unique Key 或主键避免重复插入

","text":"对于 insert、delete 等操作,可以通过 Unique Key 或主键避免重复插入"},"commentCount":0,"children":[]}]}]},{"data":{"id":"cijfrtlnsdc0","created":1647245434122,"html":"

消息的可靠传输

","text":"消息的可靠传输"},"commentCount":0,"children":[{"data":{"id":"cijfrx7lzdc0","created":1647245441981,"html":"

1、Publisher 发送时丢失

","text":"1、Publisher 发送时丢失"},"commentCount":0,"children":[{"data":{"id":"cijfsfgmxi80","created":1647245481707,"html":"

采用事务机制:在发送中发生异常,就会进行回滚,缺点是必须同步阻塞的等待发送结果,吞吐量下降

","text":"采用事务机制:在发送中发生异常,就会进行回滚,缺点是必须同步阻塞的等待发送结果,吞吐量下降"},"commentCount":0,"children":[]},{"data":{"id":"cijftcql0rc0","created":1647245554143,"html":"

Confirm 机制:为所有消息分配一个唯一的 ID,一旦消息被发送到匹配的队列时,就会返回一个确认信息

给 Publisher,若该消息没能正常处理,消息队列也可以返回一个 Nack 信息来提示 Publisher 进行重试

","text":"Confirm 机制:为所有消息分配一个唯一的 ID,一旦消息被发送到匹配的队列时,就会返回一个确认信息\n给 Publisher,若该消息没能正常处理,消息队列也可以返回一个 Nack 信息来提示 Publisher 进行重试"},"commentCount":0,"children":[]}]},{"data":{"id":"cijfvdhrx6o0","created":1647245712515,"html":"

2、消息队列中丢失

","text":"2、消息队列中丢失"},"commentCount":0,"children":[{"data":{"id":"cijfvrijkb40","created":1647245743037,"html":"

开启消息队列的持久化存储,只有当消息持久化存储到磁盘后,消息队列才会发送 Ack 消息给 Publisher

","text":"开启消息队列的持久化存储,只有当消息持久化存储到磁盘后,消息队列才会发送 Ack 消息给 Publisher"},"commentCount":0,"children":[]}]},{"data":{"id":"cijfwob9gj40","created":1647245814430,"html":"

3、Consumer 消息丢失

","text":"3、Consumer 消息丢失"},"commentCount":0,"children":[{"data":{"id":"cijfx0tuhcg0","created":1647245841675,"html":"

通常因为 Consumer 在接收到消息时,就会立刻返回一个 Ack 给消息队列,消息队列收到后会删除消息,

但 Consumer 处理消息时可能会因为异常或宕机失败,从而丢失了消息,可以关闭自动 Ack

","text":"通常因为 Consumer 在接收到消息时,就会立刻返回一个 Ack 给消息队列,消息队列收到后会删除消息,\n但 Consumer 处理消息时可能会因为异常或宕机失败,从而丢失了消息,可以关闭自动 Ack"},"commentCount":0,"children":[]}]}]},{"data":{"id":"cijg1hvphg80","created":1647246192250,"html":"

消息的有序传输

","text":"消息的有序传输"},"commentCount":0,"children":[{"data":{"id":"cijgchqhk8w0","created":1647247053940,"html":"

1、可以为不同的消息绑定多个队列,利用队列内部消息的先进先出性质保证消息的有序性;

问题:只能由单线程的消费者去监听一个队列,吞吐量降低,若使用多线程去监听同一个消息队列,则仍然会发生乱序的情况

","text":"1、可以为不同的消息绑定多个队列,利用队列内部消息的先进先出性质保证消息的有序性;\n问题:只能由单线程的消费者去监听一个队列,吞吐量降低,若使用多线程去监听同一个消息队列,则仍然会发生乱序的情况"},"commentCount":0,"children":[]},{"data":{"id":"cijgebzcl9c0","created":1647247198143,"html":"

2、若采用多线程消费同一个消息队列,例如一个包含 新增/修改/删除 三步的消息,可以使用失败重试机制,即若删除发生在了新增之前,

删除操作必然失败,可以在一个线程中循环删除操作直到成功,保证最终的有序性

","text":"2、若采用多线程消费同一个消息队列,例如一个包含 新增/修改/删除 三步的消息,可以使用失败重试机制,即若删除发生在了新增之前,\n删除操作必然失败,可以在一个线程中循环删除操作直到成功,保证最终的有序性"},"commentCount":0,"children":[]}]},{"data":{"id":"cijgiu1lrbs0","created":1647247550918,"html":"

处理大量积压的消息

","text":"处理大量积压的消息"},"commentCount":0,"children":[{"data":{"id":"cijgiynmbnk0","created":1647247560957,"html":"

1、消息积压必定是消费者消费速度跟不上生产者生产速度,先排查 Consumer 的问题并尽快修复,可能是 Consumer 宕机、MySQL 宕机、

Consumer 消息处理逻辑低效等问题

","text":"1、消息积压必定是消费者消费速度跟不上生产者生产速度,先排查 Consumer 的问题并尽快修复,可能是 Consumer 宕机、MySQL 宕机、\nConsumer 消息处理逻辑低效等问题"},"commentCount":0,"children":[]},{"data":{"id":"cijgjyhsils0","created":1647247638969,"html":"

2、建立多个临时消息队列,新写一个程序专门消费堆积的消息队列中的消息,不对消息做具体处理,只是将消息再放入临时消息队列中

","text":"2、建立多个临时消息队列,新写一个程序专门消费堆积的消息队列中的消息,不对消息做具体处理,只是将消息再放入临时消息队列中"},"commentCount":0,"children":[]},{"data":{"id":"cijgl1g27bs0","created":1647247723758,"html":"

3、临时部署优化后的 Consumer 来对临时消息队列进行消费

","text":"3、临时部署优化后的 Consumer 来对临时消息队列进行消费"},"commentCount":0,"children":[]}]},{"data":{"id":"cijgm9fo3zc0","created":1647247819513,"html":"

高可用

","text":"高可用"},"commentCount":0,"children":[{"data":{"id":"cijgmcbpw3s0","created":1647247825805,"html":"

普通集群模式

","text":"普通集群模式"},"commentCount":0,"children":[{"data":{"id":"cijgnaisknk0","created":1647247900243,"html":"

即主从集群,只在一台 MQ 服务节点上存储真正的消息,在其他节点上只存储队列的元信息,当访问其他节点时,

通过元信息从主节点拉取消息进行消费

","text":"即主从集群,只在一台 MQ 服务节点上存储真正的消息,在其他节点上只存储队列的元信息,当访问其他节点时,\n通过元信息从主节点拉取消息进行消费"},"commentCount":0,"children":[]}]},{"data":{"id":"cijgmf32ksg0","created":1647247831812,"html":"

镜像集群模式

","text":"镜像集群模式"},"commentCount":0,"children":[{"data":{"id":"cijgpe5dd400","created":1647248064867,"html":"

主从集群模式下,存储 Queue 的主节点宕机了就会导致整个集群不可用,在镜像集群中,所有操作必须先经由主节点进行操作,

再同步至所有从节点,保证消息的先后次序,当主节点宕机,会由最老的从节点接替

","text":"主从集群模式下,存储 Queue 的主节点宕机了就会导致整个集群不可用,在镜像集群中,所有操作必须先经由主节点进行操作,\n再同步至所有从节点,保证消息的先后次序,当主节点宕机,会由最老的从节点接替"},"commentCount":0,"children":[]}]}]}]},"subtree":[],"template":"right","theme":"spy-4","relLine":[],"style":{},"colorGroup":null,"version":"1.5.4","zoom":100,"position":{"x":-139.5,"y":-565.5}}PK 3 | &)qTIlYW)E)E content.jsonPK:SE --------------------------------------------------------------------------------