From 9153648dbac452fdd106805c231d1aadf6c0810c Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Fri, 28 Apr 2023 17:37:42 +0800 Subject: [PATCH] chore: tweaks --- docs/distributed-system/api-gateway.md | 28 ++++---- docs/distributed-system/distributed-id.md | 8 +-- ...d-write-separation-and-library-subtable.md | 4 +- .../project-experience-guide.md | 2 +- ...-prepare-for-the-interview-hand-in-hand.md | 4 +- docs/open-source-project/system-design.md | 8 +-- docs/system-design/J2EE基础知识.md | 64 +++++++++---------- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/distributed-system/api-gateway.md b/docs/distributed-system/api-gateway.md index 29a3546d..795a4c2f 100644 --- a/docs/distributed-system/api-gateway.md +++ b/docs/distributed-system/api-gateway.md @@ -75,12 +75,12 @@ Zuul 主要通过过滤器(类似于 AOP)来过滤请求,从而实现网 ![Zuul2 架构](https://oscimg.oschina.net/oscnet/up-4f9047dc9109e27f9fced1b365e2b976e9d.png) -- Github 地址 : https://github.com/Netflix/zuul -- 官方 Wiki : https://github.com/Netflix/zuul/wiki +- Github 地址 : +- 官方 Wiki : ### Spring Cloud Gateway -SpringCloud Gateway 属于 Spring Cloud 生态系统中的网关,其诞生的目标是为了替代老牌网关 **Zuul **。准确点来说,应该是 Zuul 1.x。SpringCloud Gateway 起步要比 Zuul 2.x 更早。 +SpringCloud Gateway 属于 Spring Cloud 生态系统中的网关,其诞生的目标是为了替代老牌网关 **Zuul**。准确点来说,应该是 Zuul 1.x。SpringCloud Gateway 起步要比 Zuul 2.x 更早。 为了提升网关的性能,SpringCloud Gateway 基于 Spring WebFlux 。Spring WebFlux 使用 Reactor 库来实现响应式编程模型,底层基于 Netty 实现同步非阻塞的 I/O。 @@ -90,8 +90,8 @@ Spring Cloud Gateway 不仅提供统一的路由方式,并且基于 Filter 链 Spring Cloud Gateway 和 Zuul 2.x 的差别不大,也是通过过滤器来处理请求。不过,目前更加推荐使用 Spring Cloud Gateway 而非 Zuul,Spring Cloud 生态对其支持更加友好。 -- Github 地址 : https://github.com/spring-cloud/spring-cloud-gateway -- 官网 : https://spring.io/projects/spring-cloud-gateway +- Github 地址 : +- 官网 : ### Kong @@ -118,8 +118,8 @@ $ curl -X POST http://kong:8001/services/{service}/plugins \ ![](https://oss.javaguide.cn/github/javaguide/system-design/distributed-system/api-gateway/kong-gateway-overview.png) -- Github 地址: https://github.com/Kong/kong -- 官网地址 : https://konghq.com/kong +- Github 地址: +- 官网地址 : ### APISIX @@ -144,8 +144,8 @@ APISIX 同样支持定制化的插件开发。开发者除了能够使用 Lua ![](https://oscimg.oschina.net/oscnet/up-a240d3b113cde647f5850f4c7cc55d4ff5c.png) -- Github 地址 :https://github.com/apache/apisix -- 官网地址: https://apisix.apache.org/zh/ +- Github 地址 : +- 官网地址: 相关阅读: @@ -162,11 +162,11 @@ Shenyu 是一款基于 WebFlux 的可扩展、高性能、响应式网关,Apac Shenyu 通过插件扩展功能,插件是 ShenYu 的灵魂,并且插件也是可扩展和热插拔的。不同的插件实现不同的功能。Shenyu 自带了诸如限流、熔断、转发 、重写、重定向、和路由监控等插件。 -- Github 地址: https://github.com/apache/incubator-shenyu -- 官网地址 : https://shenyu.apache.org/ +- Github 地址: +- 官网地址 : ## 参考 -- Kong 插件开发教程[通俗易懂]:https://cloud.tencent.com/developer/article/2104299 -- API 网关 Kong 实战:https://xie.infoq.cn/article/10e4dab2de0bdb6f2c3c93da6 -- Spring Cloud Gateway 原理介绍和应用:https://blog.fintopia.tech/60e27b0e2078082a378ec5ed/ +- Kong 插件开发教程[通俗易懂]: +- API 网关 Kong 实战: +- Spring Cloud Gateway 原理介绍和应用: diff --git a/docs/distributed-system/distributed-id.md b/docs/distributed-system/distributed-id.md index 373d1c40..357523f9 100644 --- a/docs/distributed-system/distributed-id.md +++ b/docs/distributed-system/distributed-id.md @@ -103,7 +103,7 @@ COMMIT; 以 MySQL 举例,我们通过下面的方式即可。 -**1.创建一个数据库表。** +**1. 创建一个数据库表。** ```sql CREATE TABLE `sequence_id_generator` ( @@ -122,7 +122,7 @@ CREATE TABLE `sequence_id_generator` ( `version` 字段主要用于解决并发问题(乐观锁),`biz_type` 主要用于表示业务类型。 -**2.先插入一行数据。** +**2. 先插入一行数据。** ```sql INSERT INTO `sequence_id_generator` (`id`, `current_max_id`, `step`, `version`, `biz_type`) @@ -130,7 +130,7 @@ VALUES (1, 0, 100, 0, 101); ``` -**3.通过 SELECT 获取指定业务下的批量唯一 ID** +**3. 通过 SELECT 获取指定业务下的批量唯一 ID** ```sql 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 1 0 100 0 101 ``` -**4.不够用的话,更新之后重新 SELECT 即可。** +**4. 不够用的话,更新之后重新 SELECT 即可。** ```sql UPDATE sequence_id_generator SET current_max_id = 0+100, version=version+1 WHERE version = 0 AND `biz_type` = 101 diff --git a/docs/high-performance/read-and-write-separation-and-library-subtable.md b/docs/high-performance/read-and-write-separation-and-library-subtable.md index b8855e47..ab2ce183 100644 --- a/docs/high-performance/read-and-write-separation-and-library-subtable.md +++ b/docs/high-performance/read-and-write-separation-and-library-subtable.md @@ -61,7 +61,7 @@ hintManager.setMasterRouteOnly(); 落实到项目本身的话,常用的方式有两种: -**1.代理方式** +**1. 代理方式** ![代理方式实现读写分离](https://oss.javaguide.cn/github/javaguide/high-performance/read-and-write-separation-and-library-subtable/read-and-write-separation-proxy.png) @@ -69,7 +69,7 @@ hintManager.setMasterRouteOnly(); 提供类似功能的中间件有 **MySQL Router**(官方)、**Atlas**(基于 MySQL Proxy)、**MaxScale**、**MyCat**。 -**2.组件方式** +**2. 组件方式** 在这种方式中,我们可以通过引入第三方组件来帮助我们读写请求。 diff --git a/docs/interview-preparation/project-experience-guide.md b/docs/interview-preparation/project-experience-guide.md index d08cdf38..f7693ced 100644 --- a/docs/interview-preparation/project-experience-guide.md +++ b/docs/interview-preparation/project-experience-guide.md @@ -96,7 +96,7 @@ Github 或者码云上面有很多实战类别项目,你可以选择一个来 5. **安全** : 项目是否存在安全问题? 6. ...... -另外,我在星球分享过常见的性能优化方向实践案例,涉及到多线程、异步、索引、缓存等方向,强烈推荐你看看:https://t.zsxq.com/06EqfeMZZ 。 +另外,我在星球分享过常见的性能优化方向实践案例,涉及到多线程、异步、索引、缓存等方向,强烈推荐你看看: 。 最后,**再给大家推荐一个 IDEA 优化代码的小技巧,超级实用!** diff --git a/docs/interview-preparation/teach-you-how-to-prepare-for-the-interview-hand-in-hand.md b/docs/interview-preparation/teach-you-how-to-prepare-for-the-interview-hand-in-hand.md index 68f62452..f0fb7eff 100644 --- a/docs/interview-preparation/teach-you-how-to-prepare-for-the-interview-hand-in-hand.md +++ b/docs/interview-preparation/teach-you-how-to-prepare-for-the-interview-hand-in-hand.md @@ -61,8 +61,8 @@ category: 知识星球 - **目标企业的官网/公众号** :最及时最权威的获取招聘信息的途径。 - **招聘网站** :[BOSS 直聘](https://www.zhipin.com/)、[智联招聘](https://www.zhaopin.com/)、[拉勾招聘](https://www.lagou.com/)......。 -- **牛客网** :每年秋招/春招,都会有大批量的公司会到牛客网发布招聘信息,并且还会有大量的公司员工来到这里发内推的帖子。地址:https://www.nowcoder.com/jobs/recommend/campus 。 -- **超级简历** :超级简历目前整合了各大企业的校园招聘入口,地址:https://www.wondercv.com/jobs/。如果你是校招的话,点击“校招网申”就可以直接跳转到各大企业的校园招聘入口的整合页面了。 +- **牛客网** :每年秋招/春招,都会有大批量的公司会到牛客网发布招聘信息,并且还会有大量的公司员工来到这里发内推的帖子。地址: 。 +- **超级简历** :超级简历目前整合了各大企业的校园招聘入口,地址: - **认识的朋友** :如果你有认识的朋友在目标企业工作的话,你也可以找他们了解招聘信息,并且可以让他们帮你内推。 - **宣讲会** :宣讲会也是一个不错的途径,不过,好的企业通常只会去比较好的学校,可以留意一下意向公司的宣讲会安排或者直接去到一所比较好的学校参加宣讲会。像我当时校招就去参加了几场宣讲会。不过,我是在荆州上学,那边没什么比较好的学校,一般没有公司去开宣讲会。所以,我当时是直接跑到武汉来了,参加了武汉理工大学以及华中科技大学的几场宣讲会。总体感觉还是很不错的! - **其他** :校园就业信息网、学校论坛、班级 or 年级 QQ 群。 diff --git a/docs/open-source-project/system-design.md b/docs/open-source-project/system-design.md index b8c80106..73d682aa 100644 --- a/docs/open-source-project/system-design.md +++ b/docs/open-source-project/system-design.md @@ -6,11 +6,11 @@ icon: "xitongsheji" ## 基础框架 -- [Spring Boot ](https://github.com/spring-projects/spring-boot "spring-boot") :Spring Boot 可以轻松创建独立的生产级基于 Spring 的应用程序,内置 web 服务器让你可以像运行普通 Java 程序一样运行项 目。另外,大部分 Spring Boot 项目只需要少量的配置即可,这有别于 Spring 的重配置。 +- [Spring Boot](https://github.com/spring-projects/spring-boot "spring-boot") :Spring Boot 可以轻松创建独立的生产级基于 Spring 的应用程序,内置 web 服务器让你可以像运行普通 Java 程序一样运行项 目。另外,大部分 Spring Boot 项目只需要少量的配置即可,这有别于 Spring 的重配置。 - [Javalin](https://github.com/tipsy/javalin) :一个轻量级的 Web 框架,同时支持 Java 和 Kotlin,被微软、红帽、Uber 等公司使用。 - [Quarkus](https://github.com/quarkusio/quarkus) : 用于编写 Java 应用程序的云原生和容器优先的框架。 - [Guice](https://github.com/google/guice) :Google 开源的一个轻量级依赖注入框架,相当于一个功能极简化的轻量级 Spring Boot。在某些情况下非常实用,就比如说我们的项目只需要使用依赖注入,不需要 AOP 等功能特性。 -- [SOFABoot](https://github.com/sofastack/sofa-boot) :SOFABoot 基于 Spring Boot ,不过在其基础上增加了 Readiness Check,类隔离,日志空间隔离等等能力。 配套提供的还有:SOFARPC(RPC 框架)、SOFABolt(基于 Netty 的远程通信框架)、SOFARegistry(注册中心)...详情请参考:[SOFAStack ](https://github.com/sofastack) 。 +- [SOFABoot](https://github.com/sofastack/sofa-boot) :SOFABoot 基于 Spring Boot ,不过在其基础上增加了 Readiness Check,类隔离,日志空间隔离等等能力。 配套提供的还有:SOFARPC(RPC 框架)、SOFABolt(基于 Netty 的远程通信框架)、SOFARegistry(注册中心)...详情请参考:[SOFAStack](https://github.com/sofastack) 。 - [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)。 ## 数据库 @@ -89,7 +89,7 @@ icon: "xitongsheji" - [XXL-JOB](https://github.com/xuxueli/xxl-job) :XXL-JOB 是一个分布式任务调度平台,其核心设计目标是开发迅速、学习简单、轻量级、易扩展。现已开放源代码并接入多家公司线上产品线,开箱即用。 - [Elastic-Job](http://elasticjob.io/index_zh.html) :Elastic-Job 是当当网开源的一个基于 Quartz 和 Zookeeper 的分布式调度解决方案,由两个相互独立的子项目 Elastic-Job-Lite 和 Elastic-Job-Cloud 组成,一般我们只要使用 Elastic-Job-Lite 就好。 - [EasyScheduler](https://github.com/analysys/EasyScheduler "EasyScheduler") (已经更名为 DolphinScheduler,已经成为 Apache 孵化器项目): Easy Scheduler 是一个分布式工作流任务调度系统,主要解决“复杂任务依赖但无法直接监控任务健康状态”的问题。Easy Scheduler 以 DAG 方式组装任务,可以实时监控任务的运行状态。同时,它支持重试,重新运行等操作... 。 -- [PowerJob](https://gitee.com/KFCFans/PowerJob) :新一代分布式任务调度与计算框架,支持 CRON、API、固定频率、固定延迟等调度策略,提供工作流来编排任务解决依赖关系,使用简单,功能强大,文档齐全,欢迎各位接入使用!http://www.powerjob.tech/ 。 +- [PowerJob](https://gitee.com/KFCFans/PowerJob) :新一代分布式任务调度与计算框架,支持 CRON、API、固定频率、固定延迟等调度策略,提供工作流来编排任务解决依赖关系,使用简单,功能强大,文档齐全,欢迎各位接入使用! 。 - [DolphinScheduler](https://github.com/apache/dolphinscheduler) :分布式易扩展的可视化工作流任务调度平台。 相关阅读: @@ -173,7 +173,7 @@ icon: "xitongsheji" 分布式限流 : -- [ Sentinel](https://github.com/alibaba/Sentinel)(推荐):面向分布式服务架构的高可用防护组件,主要以流量为切入点,从流量控制、熔断降级、系统自适应保护等多个维度来帮助用户保障微服务的稳定性。 +- [Sentinel](https://github.com/alibaba/Sentinel)(推荐):面向分布式服务架构的高可用防护组件,主要以流量为切入点,从流量控制、熔断降级、系统自适应保护等多个维度来帮助用户保障微服务的稳定性。 - [Hystrix](https://github.com/Netflix/Hystrix) :类似于 Sentinel 。 相关阅读:[Sentinel 与 Hystrix 的对比](https://sentinelguard.io/zh-cn/blog/sentinel-vs-hystrix.html) diff --git a/docs/system-design/J2EE基础知识.md b/docs/system-design/J2EE基础知识.md index 73cf72b0..d59d4fa9 100644 --- a/docs/system-design/J2EE基础知识.md +++ b/docs/system-design/J2EE基础知识.md @@ -223,57 +223,57 @@ JSP 中的四种作用域包括 page、request、session 和 application,具 1. **使用 Cookie** -向客户端发送 Cookie + 向客户端发送 Cookie -```java -Cookie c =new Cookie("name","value"); //创建Cookie -c.setMaxAge(60*60*24); //设置最大时效,此处设置的最大时效为一天 -response.addCookie(c); //把Cookie放入到HTTP响应中 -``` + ```java + Cookie c =new Cookie("name","value"); //创建Cookie + c.setMaxAge(60*60*24); //设置最大时效,此处设置的最大时效为一天 + response.addCookie(c); //把Cookie放入到HTTP响应中 + ``` -从客户端读取 Cookie + 从客户端读取 Cookie -```java -String name ="name"; -Cookie[]cookies =request.getCookies(); -if(cookies !=null){ - for(int i= 0;i -``` + ```html + + ``` -**优点:** Cookie 被禁时可以使用 + **优点:** Cookie 被禁时可以使用 -**缺点:** 所有页面必须是表单提交之后的结果。 + **缺点:** 所有页面必须是表单提交之后的结果。 4. HttpSession -在所有会话跟踪技术中,HttpSession 对象是最强大也是功能最多的。当一个用户第一次访问某个网站时会自动创建 HttpSession,每个用户可以访问他自己的 HttpSession。可以通过 HttpServletRequest 对象的 getSession 方 法获得 HttpSession,通过 HttpSession 的 setAttribute 方法可以将一个值放在 HttpSession 中,通过调用 HttpSession 对象的 getAttribute 方法,同时传入属性名就可以获取保存在 HttpSession 中的对象。与上面三种方式不同的 是,HttpSession 放在服务器的内存中,因此不要将过大的对象放在里面,即使目前的 Servlet 容器可以在内存将满时将 HttpSession 中的对象移到其他存储设备中,但是这样势必影响性能。添加到 HttpSession 中的值可以是任意 Java 对象,这个对象最好实现了 Serializable 接口,这样 Servlet 容器在必要的时候可以将其序列化到文件中,否则在序列化时就会出现异常。 + 在所有会话跟踪技术中,HttpSession 对象是最强大也是功能最多的。当一个用户第一次访问某个网站时会自动创建 HttpSession,每个用户可以访问他自己的 HttpSession。可以通过 HttpServletRequest 对象的 getSession 方 法获得 HttpSession,通过 HttpSession 的 setAttribute 方法可以将一个值放在 HttpSession 中,通过调用 HttpSession 对象的 getAttribute 方法,同时传入属性名就可以获取保存在 HttpSession 中的对象。与上面三种方式不同的 是,HttpSession 放在服务器的内存中,因此不要将过大的对象放在里面,即使目前的 Servlet 容器可以在内存将满时将 HttpSession 中的对象移到其他存储设备中,但是这样势必影响性能。添加到 HttpSession 中的值可以是任意 Java 对象,这个对象最好实现了 Serializable 接口,这样 Servlet 容器在必要的时候可以将其序列化到文件中,否则在序列化时就会出现异常。 ## Cookie 和 Session 的区别