Skip to content

Commit 9153648

Browse files
committed
chore: tweaks
1 parent 4df51f8 commit 9153648

File tree

7 files changed

+60
-60
lines changed

7 files changed

+60
-60
lines changed

docs/distributed-system/api-gateway.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ Zuul 主要通过过滤器(类似于 AOP)来过滤请求,从而实现网
7575

7676
![Zuul2 架构](https://oscimg.oschina.net/oscnet/up-4f9047dc9109e27f9fced1b365e2b976e9d.png)
7777

78-
- Github 地址 : https://github.com/Netflix/zuul
79-
- 官方 Wiki : https://github.com/Netflix/zuul/wiki
78+
- Github 地址 : <https://github.com/Netflix/zuul>
79+
- 官方 Wiki : <https://github.com/Netflix/zuul/wiki>
8080

8181
### Spring Cloud Gateway
8282

83-
SpringCloud Gateway 属于 Spring Cloud 生态系统中的网关,其诞生的目标是为了替代老牌网关 **Zuul **。准确点来说,应该是 Zuul 1.x。SpringCloud Gateway 起步要比 Zuul 2.x 更早。
83+
SpringCloud Gateway 属于 Spring Cloud 生态系统中的网关,其诞生的目标是为了替代老牌网关 **Zuul**。准确点来说,应该是 Zuul 1.x。SpringCloud Gateway 起步要比 Zuul 2.x 更早。
8484

8585
为了提升网关的性能,SpringCloud Gateway 基于 Spring WebFlux 。Spring WebFlux 使用 Reactor 库来实现响应式编程模型,底层基于 Netty 实现同步非阻塞的 I/O。
8686

@@ -90,8 +90,8 @@ Spring Cloud Gateway 不仅提供统一的路由方式,并且基于 Filter 链
9090

9191
Spring Cloud Gateway 和 Zuul 2.x 的差别不大,也是通过过滤器来处理请求。不过,目前更加推荐使用 Spring Cloud Gateway 而非 Zuul,Spring Cloud 生态对其支持更加友好。
9292

93-
- Github 地址 : https://github.com/spring-cloud/spring-cloud-gateway
94-
- 官网 : https://spring.io/projects/spring-cloud-gateway
93+
- Github 地址 : <https://github.com/spring-cloud/spring-cloud-gateway>
94+
- 官网 : <https://spring.io/projects/spring-cloud-gateway>
9595

9696
### Kong
9797

@@ -118,8 +118,8 @@ $ curl -X POST http://kong:8001/services/{service}/plugins \
118118
119119
![](https://oss.javaguide.cn/github/javaguide/system-design/distributed-system/api-gateway/kong-gateway-overview.png)
120120

121-
- Github 地址: https://github.com/Kong/kong
122-
- 官网地址 : https://konghq.com/kong
121+
- Github 地址: <https://github.com/Kong/kong>
122+
- 官网地址 : <https://konghq.com/kong>
123123

124124
### APISIX
125125

@@ -144,8 +144,8 @@ APISIX 同样支持定制化的插件开发。开发者除了能够使用 Lua
144144
145145
![](https://oscimg.oschina.net/oscnet/up-a240d3b113cde647f5850f4c7cc55d4ff5c.png)
146146

147-
- Github 地址 :https://github.com/apache/apisix
148-
- 官网地址: https://apisix.apache.org/zh/
147+
- Github 地址 :<https://github.com/apache/apisix>
148+
- 官网地址: <https://apisix.apache.org/zh/>
149149

150150
相关阅读:
151151

@@ -162,11 +162,11 @@ Shenyu 是一款基于 WebFlux 的可扩展、高性能、响应式网关,Apac
162162

163163
Shenyu 通过插件扩展功能,插件是 ShenYu 的灵魂,并且插件也是可扩展和热插拔的。不同的插件实现不同的功能。Shenyu 自带了诸如限流、熔断、转发 、重写、重定向、和路由监控等插件。
164164

165-
- Github 地址: https://github.com/apache/incubator-shenyu
166-
- 官网地址 : https://shenyu.apache.org/
165+
- Github 地址: <https://github.com/apache/incubator-shenyu>
166+
- 官网地址 : <https://shenyu.apache.org/>
167167

168168
## 参考
169169

170-
- Kong 插件开发教程[通俗易懂]https://cloud.tencent.com/developer/article/2104299
171-
- API 网关 Kong 实战:https://xie.infoq.cn/article/10e4dab2de0bdb6f2c3c93da6
172-
- Spring Cloud Gateway 原理介绍和应用:https://blog.fintopia.tech/60e27b0e2078082a378ec5ed/
170+
- Kong 插件开发教程[通俗易懂]<https://cloud.tencent.com/developer/article/2104299>
171+
- API 网关 Kong 实战:<https://xie.infoq.cn/article/10e4dab2de0bdb6f2c3c93da6>
172+
- Spring Cloud Gateway 原理介绍和应用:<https://blog.fintopia.tech/60e27b0e2078082a378ec5ed/>

docs/distributed-system/distributed-id.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ COMMIT;
103103

104104
以 MySQL 举例,我们通过下面的方式即可。
105105

106-
**1.创建一个数据库表。**
106+
**1. 创建一个数据库表。**
107107

108108
```sql
109109
CREATE TABLE `sequence_id_generator` (
@@ -122,15 +122,15 @@ CREATE TABLE `sequence_id_generator` (
122122

123123
`version` 字段主要用于解决并发问题(乐观锁),`biz_type` 主要用于表示业务类型。
124124

125-
**2.先插入一行数据。**
125+
**2. 先插入一行数据。**
126126

127127
```sql
128128
INSERT INTO `sequence_id_generator` (`id`, `current_max_id`, `step`, `version`, `biz_type`)
129129
VALUES
130130
(1, 0, 100, 0, 101);
131131
```
132132

133-
**3.通过 SELECT 获取指定业务下的批量唯一 ID**
133+
**3. 通过 SELECT 获取指定业务下的批量唯一 ID**
134134

135135
```sql
136136
SELECT `current_max_id`, `step`,`version` FROM `sequence_id_generator` where `biz_type` = 101
@@ -143,7 +143,7 @@ id current_max_id step version biz_type
143143
1 0 100 0 101
144144
```
145145

146-
**4.不够用的话,更新之后重新 SELECT 即可。**
146+
**4. 不够用的话,更新之后重新 SELECT 即可。**
147147

148148
```sql
149149
UPDATE sequence_id_generator SET current_max_id = 0+100, version=version+1 WHERE version = 0 AND `biz_type` = 101

docs/high-performance/read-and-write-separation-and-library-subtable.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,15 @@ hintManager.setMasterRouteOnly();
6161

6262
落实到项目本身的话,常用的方式有两种:
6363

64-
**1.代理方式**
64+
**1. 代理方式**
6565

6666
![代理方式实现读写分离](https://oss.javaguide.cn/github/javaguide/high-performance/read-and-write-separation-and-library-subtable/read-and-write-separation-proxy.png)
6767

6868
我们可以在应用和数据中间加了一个代理层。应用程序所有的数据请求都交给代理层处理,代理层负责分离读写请求,将它们路由到对应的数据库中。
6969

7070
提供类似功能的中间件有 **MySQL Router**(官方)、**Atlas**(基于 MySQL Proxy)、**MaxScale****MyCat**
7171

72-
**2.组件方式**
72+
**2. 组件方式**
7373

7474
在这种方式中,我们可以通过引入第三方组件来帮助我们读写请求。
7575

docs/interview-preparation/project-experience-guide.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Github 或者码云上面有很多实战类别项目,你可以选择一个来
9696
5. **安全** : 项目是否存在安全问题?
9797
6. ......
9898

99-
另外,我在星球分享过常见的性能优化方向实践案例,涉及到多线程、异步、索引、缓存等方向,强烈推荐你看看:https://t.zsxq.com/06EqfeMZZ
99+
另外,我在星球分享过常见的性能优化方向实践案例,涉及到多线程、异步、索引、缓存等方向,强烈推荐你看看:<https://t.zsxq.com/06EqfeMZZ>
100100

101101
最后,**再给大家推荐一个 IDEA 优化代码的小技巧,超级实用!**
102102

docs/interview-preparation/teach-you-how-to-prepare-for-the-interview-hand-in-hand.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ category: 知识星球
6161

6262
- **目标企业的官网/公众号** :最及时最权威的获取招聘信息的途径。
6363
- **招聘网站**[BOSS 直聘](https://www.zhipin.com/)[智联招聘](https://www.zhaopin.com/)[拉勾招聘](https://www.lagou.com/)......。
64-
- **牛客网** :每年秋招/春招,都会有大批量的公司会到牛客网发布招聘信息,并且还会有大量的公司员工来到这里发内推的帖子。地址:https://www.nowcoder.com/jobs/recommend/campus
65-
- **超级简历** :超级简历目前整合了各大企业的校园招聘入口,地址:https://www.wondercv.com/jobs/。如果你是校招的话,点击“校招网申”就可以直接跳转到各大企业的校园招聘入口的整合页面了。
64+
- **牛客网** :每年秋招/春招,都会有大批量的公司会到牛客网发布招聘信息,并且还会有大量的公司员工来到这里发内推的帖子。地址:<https://www.nowcoder.com/jobs/recommend/campus>
65+
- **超级简历** :超级简历目前整合了各大企业的校园招聘入口,地址:<https://www.wondercv.com/jobs/。如果你是校招的话,点击“校招网申”就可以直接跳转到各大企业的校园招聘入口的整合页面了。>
6666
- **认识的朋友** :如果你有认识的朋友在目标企业工作的话,你也可以找他们了解招聘信息,并且可以让他们帮你内推。
6767
- **宣讲会** :宣讲会也是一个不错的途径,不过,好的企业通常只会去比较好的学校,可以留意一下意向公司的宣讲会安排或者直接去到一所比较好的学校参加宣讲会。像我当时校招就去参加了几场宣讲会。不过,我是在荆州上学,那边没什么比较好的学校,一般没有公司去开宣讲会。所以,我当时是直接跑到武汉来了,参加了武汉理工大学以及华中科技大学的几场宣讲会。总体感觉还是很不错的!
6868
- **其他** :校园就业信息网、学校论坛、班级 or 年级 QQ 群。

docs/open-source-project/system-design.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ icon: "xitongsheji"
66

77
## 基础框架
88

9-
- [Spring Boot ](https://github.com/spring-projects/spring-boot "spring-boot") :Spring Boot 可以轻松创建独立的生产级基于 Spring 的应用程序,内置 web 服务器让你可以像运行普通 Java 程序一样运行项 目。另外,大部分 Spring Boot 项目只需要少量的配置即可,这有别于 Spring 的重配置。
9+
- [Spring Boot](https://github.com/spring-projects/spring-boot "spring-boot") :Spring Boot 可以轻松创建独立的生产级基于 Spring 的应用程序,内置 web 服务器让你可以像运行普通 Java 程序一样运行项 目。另外,大部分 Spring Boot 项目只需要少量的配置即可,这有别于 Spring 的重配置。
1010
- [Javalin](https://github.com/tipsy/javalin) :一个轻量级的 Web 框架,同时支持 Java 和 Kotlin,被微软、红帽、Uber 等公司使用。
1111
- [Quarkus](https://github.com/quarkusio/quarkus) : 用于编写 Java 应用程序的云原生和容器优先的框架。
1212
- [Guice](https://github.com/google/guice) :Google 开源的一个轻量级依赖注入框架,相当于一个功能极简化的轻量级 Spring Boot。在某些情况下非常实用,就比如说我们的项目只需要使用依赖注入,不需要 AOP 等功能特性。
13-
- [SOFABoot](https://github.com/sofastack/sofa-boot) :SOFABoot 基于 Spring Boot ,不过在其基础上增加了 Readiness Check,类隔离,日志空间隔离等等能力。 配套提供的还有:SOFARPC(RPC 框架)、SOFABolt(基于 Netty 的远程通信框架)、SOFARegistry(注册中心)...详情请参考:[SOFAStack ](https://github.com/sofastack)
13+
- [SOFABoot](https://github.com/sofastack/sofa-boot) :SOFABoot 基于 Spring Boot ,不过在其基础上增加了 Readiness Check,类隔离,日志空间隔离等等能力。 配套提供的还有:SOFARPC(RPC 框架)、SOFABolt(基于 Netty 的远程通信框架)、SOFARegistry(注册中心)...详情请参考:[SOFAStack](https://github.com/sofastack)
1414
- [Spring Batch](https://github.com/spring-projects/spring-batch) : Spring Batch 是一个轻量级但功能又十分全面的批处理框架,主要用于批处理场景比如从数据库、文件或队列中读取大量记录。不过,需要注意的是:Spring Batch 不是调度框架。商业和开源领域都有许多优秀的企业调度框架比如 Quartz、XXL-JOB、Elastic-Job。它旨在与调度程序一起工作,而不是取代调度程序。更多介绍请参考 [Spring Batch 官方文档](https://docs.spring.io/spring-batch/docs/4.3.x/reference/html/spring-batch-intro.html#spring-batch-intro),入门教程可以参考 [Spring Batch 从入门到实战](https://mrbird.cc/Spring-Batch入门.html)
1515

1616
## 数据库
@@ -89,7 +89,7 @@ icon: "xitongsheji"
8989
- [XXL-JOB](https://github.com/xuxueli/xxl-job) :XXL-JOB 是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。
9090
- [Elastic-Job](http://elasticjob.io/index_zh.html) :Elastic-Job 是当当网开源的一个基于 Quartz 和 Zookeeper 的分布式调度解决方案,由两个相互独立的子项目 Elastic-Job-Lite 和 Elastic-Job-Cloud 组成,一般我们只要使用 Elastic-Job-Lite 就好。
9191
- [EasyScheduler](https://github.com/analysys/EasyScheduler "EasyScheduler") (已经更名为 DolphinScheduler,已经成为 Apache 孵化器项目): Easy Scheduler 是一个分布式工作流任务调度系统,主要解决“复杂任务依赖但无法直接监控任务健康状态”的问题。Easy Scheduler 以 DAG 方式组装任务,可以实时监控任务的运行状态。同时,它支持重试,重新运行等操作... 。
92-
- [PowerJob](https://gitee.com/KFCFans/PowerJob) :新一代分布式任务调度与计算框架,支持 CRON、API、固定频率、固定延迟等调度策略,提供工作流来编排任务解决依赖关系,使用简单,功能强大,文档齐全,欢迎各位接入使用!http://www.powerjob.tech/
92+
- [PowerJob](https://gitee.com/KFCFans/PowerJob) :新一代分布式任务调度与计算框架,支持 CRON、API、固定频率、固定延迟等调度策略,提供工作流来编排任务解决依赖关系,使用简单,功能强大,文档齐全,欢迎各位接入使用!<http://www.powerjob.tech/>
9393
- [DolphinScheduler](https://github.com/apache/dolphinscheduler) :分布式易扩展的可视化工作流任务调度平台。
9494

9595
相关阅读:
@@ -173,7 +173,7 @@ icon: "xitongsheji"
173173

174174
分布式限流 :
175175

176-
- [ Sentinel](https://github.com/alibaba/Sentinel)(推荐):面向分布式服务架构的高可用防护组件,主要以流量为切入点,从流量控制、熔断降级、系统自适应保护等多个维度来帮助用户保障微服务的稳定性。
176+
- [Sentinel](https://github.com/alibaba/Sentinel)(推荐):面向分布式服务架构的高可用防护组件,主要以流量为切入点,从流量控制、熔断降级、系统自适应保护等多个维度来帮助用户保障微服务的稳定性。
177177
- [Hystrix](https://github.com/Netflix/Hystrix) :类似于 Sentinel 。
178178

179179
相关阅读:[Sentinel 与 Hystrix 的对比](https://sentinelguard.io/zh-cn/blog/sentinel-vs-hystrix.html)

docs/system-design/J2EE基础知识.md

+33-33
Original file line numberDiff line numberDiff line change
@@ -223,57 +223,57 @@ JSP 中的四种作用域包括 page、request、session 和 application,具
223223

224224
1. **使用 Cookie**
225225

226-
向客户端发送 Cookie
226+
向客户端发送 Cookie
227227

228-
```java
229-
Cookie c =new Cookie("name","value"); //创建Cookie
230-
c.setMaxAge(60*60*24); //设置最大时效,此处设置的最大时效为一天
231-
response.addCookie(c); //把Cookie放入到HTTP响应中
232-
```
228+
```java
229+
Cookie c =new Cookie("name","value"); //创建Cookie
230+
c.setMaxAge(60*60*24); //设置最大时效,此处设置的最大时效为一天
231+
response.addCookie(c); //把Cookie放入到HTTP响应中
232+
```
233233

234-
从客户端读取 Cookie
234+
从客户端读取 Cookie
235235

236-
```java
237-
String name ="name";
238-
Cookie[]cookies =request.getCookies();
239-
if(cookies !=null){
240-
for(int i= 0;i<cookies.length;i++){
241-
Cookie cookie =cookies[i];
242-
if(name.equals(cookis.getName()))
243-
//something is here.
244-
//you can get the value
245-
cookie.getValue();
246-
247-
}
248-
}
236+
```java
237+
String name ="name";
238+
Cookie[]cookies =request.getCookies();
239+
if(cookies !=null){
240+
for(int i= 0;i<cookies.length;i++){
241+
Cookie cookie =cookies[i];
242+
if(name.equals(cookis.getName()))
243+
//something is here.
244+
//you can get the value
245+
cookie.getValue();
249246

250-
```
247+
}
248+
}
249+
250+
```
251251

252-
**优点:** 数据可以持久保存,不需要服务器资源,简单,基于文本的 Key-Value
252+
**优点:** 数据可以持久保存,不需要服务器资源,简单,基于文本的 Key-Value
253253

254-
**缺点:** 大小受到限制,用户可以禁用 Cookie 功能,由于保存在本地,有一定的安全风险。
254+
**缺点:** 大小受到限制,用户可以禁用 Cookie 功能,由于保存在本地,有一定的安全风险。
255255

256256
2. URL 重写
257257

258-
在 URL 中添加用户会话的信息作为请求的参数,或者将唯一的会话 ID 添加到 URL 结尾以标识一个会话。
258+
在 URL 中添加用户会话的信息作为请求的参数,或者将唯一的会话 ID 添加到 URL 结尾以标识一个会话。
259259

260-
**优点:** 在 Cookie 被禁用的时候依然可以使用
260+
**优点:** 在 Cookie 被禁用的时候依然可以使用
261261

262-
**缺点:** 必须对网站的 URL 进行编码,所有页面必须动态生成,不能用预先记录下来的 URL 进行访问。
262+
**缺点:** 必须对网站的 URL 进行编码,所有页面必须动态生成,不能用预先记录下来的 URL 进行访问。
263263

264-
3.隐藏的表单域
264+
3. 隐藏的表单域
265265

266-
```html
267-
<input type="hidden" name="session" value="..." />
268-
```
266+
```html
267+
<input type="hidden" name="session" value="..." />
268+
```
269269

270-
**优点:** Cookie 被禁时可以使用
270+
**优点:** Cookie 被禁时可以使用
271271

272-
**缺点:** 所有页面必须是表单提交之后的结果。
272+
**缺点:** 所有页面必须是表单提交之后的结果。
273273

274274
4. HttpSession
275275

276-
在所有会话跟踪技术中,HttpSession 对象是最强大也是功能最多的。当一个用户第一次访问某个网站时会自动创建 HttpSession,每个用户可以访问他自己的 HttpSession。可以通过 HttpServletRequest 对象的 getSession 方 法获得 HttpSession,通过 HttpSession 的 setAttribute 方法可以将一个值放在 HttpSession 中,通过调用 HttpSession 对象的 getAttribute 方法,同时传入属性名就可以获取保存在 HttpSession 中的对象。与上面三种方式不同的 是,HttpSession 放在服务器的内存中,因此不要将过大的对象放在里面,即使目前的 Servlet 容器可以在内存将满时将 HttpSession 中的对象移到其他存储设备中,但是这样势必影响性能。添加到 HttpSession 中的值可以是任意 Java 对象,这个对象最好实现了 Serializable 接口,这样 Servlet 容器在必要的时候可以将其序列化到文件中,否则在序列化时就会出现异常。
276+
在所有会话跟踪技术中,HttpSession 对象是最强大也是功能最多的。当一个用户第一次访问某个网站时会自动创建 HttpSession,每个用户可以访问他自己的 HttpSession。可以通过 HttpServletRequest 对象的 getSession 方 法获得 HttpSession,通过 HttpSession 的 setAttribute 方法可以将一个值放在 HttpSession 中,通过调用 HttpSession 对象的 getAttribute 方法,同时传入属性名就可以获取保存在 HttpSession 中的对象。与上面三种方式不同的 是,HttpSession 放在服务器的内存中,因此不要将过大的对象放在里面,即使目前的 Servlet 容器可以在内存将满时将 HttpSession 中的对象移到其他存储设备中,但是这样势必影响性能。添加到 HttpSession 中的值可以是任意 Java 对象,这个对象最好实现了 Serializable 接口,这样 Servlet 容器在必要的时候可以将其序列化到文件中,否则在序列化时就会出现异常。
277277

278278
## Cookie 和 Session 的区别
279279

0 commit comments

Comments
 (0)