Skip to content

Commit

Permalink
feat: update duplicate files and generate pagination
Browse files Browse the repository at this point in the history
移除冗余文件,激活页面底部导航
  • Loading branch information
yanglbme committed Apr 5, 2020
1 parent d497fff commit ee7f18e
Show file tree
Hide file tree
Showing 177 changed files with 241 additions and 201 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![wechat-group](https://badgen.net/badge/chat/%E5%BE%AE%E4%BF%A1%E4%BA%A4%E6%B5%81/138c7b)](#公众号)
[![reading](https://badgen.net/badge/books/read%20together/cyan)](https://github.com/doocs/technical-books)
[![coding](https://badgen.net/badge/leetcode/coding%20together/cyan)](https://github.com/doocs/leetcode)
[![notice](https://badgen.net/badge/notice/%E7%BB%B4%E6%9D%83%E8%A1%8C%E5%8A%A8/red)](/docs/from-readers/rights-defending-action.md)
[![notice](https://badgen.net/badge/notice/%E7%BB%B4%E6%9D%83%E8%A1%8C%E5%8A%A8/red)](/docs/extra-page/rights-defending-action.md)
[![stars](https://badgen.net/github/stars/doocs/advanced-java)](https://github.com/doocs/advanced-java/stargazers)
[![contributors](https://badgen.net/github/contributors/doocs/advanced-java)](https://github.com/doocs/advanced-java/tree/master/docs/from-readers#contributors)
[![help-wanted](https://badgen.net/github/label-issues/doocs/advanced-java/help%20wanted/open)](https://github.com/doocs/advanced-java/labels/help%20wanted)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
5. 要是锁建立失败了,那么就依次之前建立过的锁删除;
6. 只要别人建立了一把分布式锁,你就得**不断轮询去尝试获取锁**

![redis-redlock](/images/redis-redlock.png)
![redis-redlock](./images/redis-redlock.png)

[Redis 官方](https://redis.io/)给出了以上两种基于 Redis 实现分布式锁的方法,详细说明可以查看:https://redis.io/topics/distlock

Expand Down
2 changes: 1 addition & 1 deletion docs/distributed-system/distributed-system-interview.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

分布式业务系统,就是把原来用 Java 开发的一个大块系统,给拆分成**多个子系统**,多个子系统之间互相调用,形成一个大系统的整体。假设原来你做了一个 OA 系统,里面包含了权限模块、员工模块、请假模块、财务模块,一个工程,里面包含了一堆模块,模块与模块之间会互相去调用,1 台机器部署。现在如果你把这个系统给拆开,权限系统、员工系统、请假系统、财务系统 4 个系统,4 个工程,分别在 4 台机器上部署。一个请求过来,完成这个请求,这个员工系统,调用权限系统,调用请假系统,调用财务系统,4 个系统分别完成了一部分的事情,最后 4 个系统都干完了以后,才认为是这个请求已经完成了。

![simple-distributed-system-oa](/images/simple-distributed-system-oa.png)
![simple-distributed-system-oa](./images/simple-distributed-system-oa.png)

> 近几年开始兴起和流行 Spring Cloud,刚流行,还没开始普及,目前普及的是 dubbo,因此这里也主要讲 dubbo。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

下面我给个我们用过的方案吧,简单来说,首先你得用 dubbo 的一致性 hash 负载均衡策略,将比如某一个订单 id 对应的请求都给分发到某个机器上去,接着就是在那个机器上,因为可能还是多线程并发执行的,你可能得立即将某个订单 id 对应的请求扔一个**内存队列**里去,强制排队,这样来确保他们的顺序性。

![distributed-system-request-sequence](/images/distributed-system-request-sequence.png)
![distributed-system-request-sequence](./images/distributed-system-request-sequence.png)

但是这样引发的后续问题就很多,比如说要是某个订单对应的请求特别多,造成某台机器成**热点**怎么办?解决这些问题又要开启后续一连串的复杂技术方案......曾经这类问题弄的我们头疼不已,所以,还是建议什么呢?

Expand Down
8 changes: 4 additions & 4 deletions docs/distributed-system/distributed-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

如果你要操作别人的服务的库,你必须是通过**调用别的服务的接口**来实现,绝对不允许交叉访问别人的数据库。

![distributed-transacion-XA](/images/distributed-transaction-XA.png)
![distributed-transacion-XA](./images/distributed-transaction-XA.png)

### TCC 方案
TCC 的全称是:`Try``Confirm``Cancel`
Expand All @@ -43,7 +43,7 @@ TCC 的全称是:`Try`、`Confirm`、`Cancel`。

但是说实话,一般尽量别这么搞,自己手写回滚逻辑,或者是补偿逻辑,实在太恶心了,那个业务代码是很难维护的。

![distributed-transacion-TCC](/images/distributed-transaction-TCC.png)
![distributed-transacion-TCC](./images/distributed-transaction-TCC.png)

### 本地消息表
本地消息表其实是国外的 ebay 搞出来的这么一套思想。
Expand All @@ -59,7 +59,7 @@ TCC 的全称是:`Try`、`Confirm`、`Cancel`。

这个方案说实话最大的问题就在于**严重依赖于数据库的消息表来管理事务**啥的,如果是高并发场景咋办呢?咋扩展呢?所以一般确实很少用。

![distributed-transaction-local-message-table](/images/distributed-transaction-local-message-table.png)
![distributed-transaction-local-message-table](./images/distributed-transaction-local-message-table.png)

### 可靠消息最终一致性方案
这个的意思,就是干脆不要用本地的消息表了,直接基于 MQ 来实现事务。比如阿里的 RocketMQ 就支持消息事务。
Expand All @@ -73,7 +73,7 @@ TCC 的全称是:`Try`、`Confirm`、`Cancel`。
5. 这个方案里,要是系统 B 的事务失败了咋办?重试咯,自动不断重试直到成功,如果实在是不行,要么就是针对重要的资金类业务进行回滚,比如 B 系统本地回滚后,想办法通知系统 A 也回滚;或者是发送报警由人工来手工回滚和补偿。
6. 这个还是比较合适的,目前国内互联网公司大都是这么玩儿的,要不你就用 RocketMQ 支持的,要不你就自己基于类似 ActiveMQ?RabbitMQ?自己封装一套类似的逻辑出来,总之思路就是这样子的。

![distributed-transaction-reliable-message](/images/distributed-transaction-reliable-message.png)
![distributed-transaction-reliable-message](./images/distributed-transaction-reliable-message.png)

### 最大努力通知方案
这个方案的大致意思就是:
Expand Down
2 changes: 1 addition & 1 deletion docs/distributed-system/dubbo-operating-principle.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ MQ、ES、Redis、Dubbo,上来先问你一些**思考性的问题**、**原理
- 第三步:consumer 调用 provider
- 第四步:consumer 和 provider 都异步通知监控中心

![dubbo-operating-principle](/images/dubbo-operating-principle.png)
![dubbo-operating-principle](./images/dubbo-operating-principle.png)

### 注册中心挂了可以继续通信吗?
可以,因为刚开始初始化的时候,消费者会将提供者的地址等信息**拉取到本地缓存**,所以注册中心挂了可以继续通信。
6 changes: 3 additions & 3 deletions docs/distributed-system/dubbo-serialization-protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dubbo 支持哪些通信协议?支持哪些序列化协议?说一下 Hessian
## 面试题剖析
**序列化**,就是把数据结构或者是一些对象,转换为二进制串的过程,而**反序列化**是将在序列化过程中所生成的二进制串转换成数据结构或者对象的过程。

![serialize-deserialize](/images/serialize-deserialize.png)
![serialize-deserialize](./images/serialize-deserialize.png)

### dubbo 支持不同的通信协议
- dubbo 协议
Expand All @@ -20,11 +20,11 @@ dubbo 支持哪些通信协议?支持哪些序列化协议?说一下 Hessian

长连接,通俗点说,就是建立连接过后可以持续发送请求,无须再建立连接。

![dubbo-keep-connection](/images/dubbo-keep-connection.png)
![dubbo-keep-connection](./images/dubbo-keep-connection.png)

而短连接,每次要发送请求之前,需要先重新建立一次连接。

![dubbo-not-keep-connection](/images/dubbo-not-keep-connection.png)
![dubbo-not-keep-connection](./images/dubbo-not-keep-connection.png)

- rmi 协议

Expand Down
2 changes: 1 addition & 1 deletion docs/distributed-system/dubbo-service-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

那就需要基于 dubbo 做的分布式系统中,对各个服务之间的调用自动记录下来,然后自动将**各个服务之间的依赖关系和调用链路生成出来**,做成一张图,显示出来,大家才可以看到对吧。

![dubbo-service-invoke-road](/images/dubbo-service-invoke-road.png)
![dubbo-service-invoke-road](./images/dubbo-service-invoke-road.png)

#### 2. 服务访问压力以及时长统计
需要自动统计**各个接口和服务之间的调用次数以及访问延时**,而且要分成两个级别。
Expand Down
2 changes: 1 addition & 1 deletion docs/distributed-system/dubbo-spi.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ hessian=com.alibaba.dubbo.rpc.protocol.hessian.HessianProtocol
```
provider 启动的时候,就会加载到我们 jar 包里的`my=com.bingo.MyProtocol` 这行配置里,接着会根据你的配置使用你定义好的 MyProtocol 了,这个就是简单说明一下,你通过上述方式,可以替换掉大量的 dubbo 内部的组件,就是扔个你自己的 jar 包,然后配置一下即可。

![dubbo-spi](/images/dubbo-spi.png)
![dubbo-spi](./images/dubbo-spi.png)

dubbo 里面提供了大量的类似上面的扩展点,就是说,你如果要扩展一个东西,只要自己写个 jar,让你的 consumer 或者是 provider 工程,依赖你的那个 jar,在你的 jar 里指定目录下配置好接口名称对应的文件,里面通过 `key=实现类`

Expand Down
File renamed without changes
8 changes: 4 additions & 4 deletions docs/distributed-system/zookeeper-application-scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ zookeeper 都有哪些使用场景?
### 分布式协调
这个其实是 zookeeper 很经典的一个用法,简单来说,就好比,你 A 系统发送个请求到 mq,然后 B 系统消息消费之后处理了。那 A 系统如何知道 B 系统的处理结果?用 zookeeper 就可以实现分布式系统之间的协调工作。A 系统发送请求之后可以在 zookeeper 上**对某个节点的值注册个监听器**,一旦 B 系统处理完了就修改 zookeeper 那个节点的值,A 系统立马就可以收到通知,完美解决。

![zookeeper-distributed-coordination](/images/zookeeper-distributed-coordination.png)
![zookeeper-distributed-coordination](./images/zookeeper-distributed-coordination.png)

### 分布式锁
举个栗子。对某一个数据连续发出两个修改操作,两台机器同时收到了请求,但是只能一台机器先执行完另外一个机器再执行。那么此时就可以使用 zookeeper 分布式锁,一个机器接收到了请求之后先获取 zookeeper 上的一把分布式锁,就是可以去创建一个 znode,接着执行操作;然后另外一个机器也**尝试去创建**那个 znode,结果发现自己创建不了,因为被别人创建了,那只能等着,等第一个机器执行完了自己再执行。

![zookeeper-distributed-lock-demo](/images/zookeeper-distributed-lock-demo.png)
![zookeeper-distributed-lock-demo](./images/zookeeper-distributed-lock-demo.png)

### 元数据/配置信息管理
zookeeper 可以用作很多系统的配置信息的管理,比如 kafka、storm 等等很多分布式系统都会选用 zookeeper 来做一些元数据、配置信息的管理,包括 dubbo 注册中心不也支持 zookeeper 么?

![zookeeper-meta-data-manage](/images/zookeeper-meta-data-manage.png)
![zookeeper-meta-data-manage](./images/zookeeper-meta-data-manage.png)

### HA高可用性
这个应该是很常见的,比如 hadoop、hdfs、yarn 等很多大数据系统,都选择基于 zookeeper 来开发 HA 高可用机制,就是一个**重要进程一般会做主备**两个,主进程挂了立马通过 zookeeper 感知到切换到备用进程。

![zookeeper-active-standby](/images/zookeeper-active-standby.png)
![zookeeper-active-standby](./images/zookeeper-active-standby.png)
2 changes: 1 addition & 1 deletion docs/extra-page/cover.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![logo](images/icon.png)](https://github.com/doocs/advanced-java)
[![logo](./images/icon.png)](https://github.com/doocs/advanced-java)

# 互联网 Java 工程师进阶知识完全扫盲

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/extra-page/offer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![where-is-my-offer](/images/where-is-my-offer.png)](https://doocs.github.io/advanced-java/#/offer)
[![where-is-my-offer](./images/where-is-my-offer.png)](https://doocs.github.io/advanced-java/#/offer)

<p align="center"><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=1321616516&auto=1&height=66"></iframe></p>

Expand Down Expand Up @@ -122,4 +122,4 @@ HR
```

[![get-up-and-study](/images/get-up-and-study.png)](https://doocs.github.io/advanced-java)
[![get-up-and-study](./images/get-up-and-study.png)](https://doocs.github.io/advanced-java)
File renamed without changes.
37 changes: 0 additions & 37 deletions docs/from-readers/README.md

This file was deleted.

52 changes: 0 additions & 52 deletions docs/from-readers/doocs-advanced-java-attention.md

This file was deleted.

Binary file removed docs/from-readers/images/qrcode-for-doocs.jpg
Binary file not shown.
Binary file removed docs/from-readers/images/qrcode-for-yanglbme.jpg
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/high-availability/hystrix-timeout.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Peter Steiner 说过,"[On the Internet, nobody knows you're a dog](https://en.wikipedia.org/wiki/On_the_Internet,_nobody_knows_you%27re_a_dog)",也就是说在互联网的另外一头,你都不知道甚至坐着一条狗。

![220px-Internet_dog.jpg](/images/220px-Internet_dog.jpg)
![220px-Internet_dog.jpg](./images/220px-Internet_dog.jpg)

像特别复杂的分布式系统,特别是在大公司里,多个团队、大型协作,你可能都不知道服务是谁的,很可能说开发服务的那个哥儿们甚至是一个实习生。依赖服务的接口性能可能很不稳定,有时候 2ms,有时候 200ms,甚至 2s,都有可能。

Expand Down
Loading

0 comments on commit ee7f18e

Please sign in to comment.