# 从浅入深 学习 SpringCloud 微服务架构(四)Ribbon

server/2024/9/24 8:15:53/

从浅入深 学习 SpringCloud 微服务架构(四)Ribbon

段子手168

ribbon__ribbon__4">一、ribbon 概述以及基于 ribbon 的远程调用。

ribbon__7">1、ribbon 概述:

Ribbon 是 Netflixfa 发布的一个负载均衡器,有助于控制 HTTP 和 TCP客户端行为。

在 SpringCloud 中 Eureka 一般配合 Ribbon 进行使用,
Ribbon 提供了客户端负载均衡的功能,Ribbon 利用从 Eureka 中读取到的服务信息,
在调用服务节点提供的服务时,会合理的进行负载。

在 SpringCloud 中可以将注册中心和 Ribbon 配合使用,
Ribbon 自动的从注册中心中获取服务提供者的列表信息,并基于内置的负载均衡算法,请求服务。

2、Ribbon 的主要作用:

1)服务调用

基于 Ribbon 实现服务调用,是通过拉取到的所有服务列表组成(服务名-请求路径的)映射关系。
借助 RestTemplate 最终进行调用。

2)负载均衡

当有多个服务提供者时,Ribbon 可以根据负载均衡的算法自动的选择需要调用的服务地址。

3、修改 order_service 子工程(子模块)相关类

java_32">1)修改 order_service 子工程(子模块)中的 controller 类 OrderController.java

使用 基于 ribbon 的形式调用远程微服务,使用服务名称 service-product 替换 IP 地址 。

/***  C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\java\djh\it\order\controller\OrderController.java**  2024-4-19 订单的 controller 类 OrderController.java*/
package djh.it.order.controller;import djh.it.order.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;import java.util.List;@RestController
@RequestMapping("/order")
public class OrderController {// 注入 restTemplate 对象@Autowiredprivate RestTemplate restTemplate;/***  注入 DiscoveryClient : springcloud 提供的获取元数据的工具类。*      调用方法获取服务的元数据信息。*/@Autowiredprivate DiscoveryClient discoveryClient;/***  使用 基于 ribbon 的形式调用远程微服务:*  1、使用 @LoadBalanced 注解 声明 RestTemplate*  2、使用服务名称 service-product 替换 IP 地址 。** @param id* @return*/@RequestMapping(value = "/buy/{id}", method = RequestMethod.GET)public Product findById(@PathVariable Long id){Product product = null;//product = restTemplate.getForObject("http://127.0.0.1:9001/product/1", Product.class);product = restTemplate.getForObject("http://service-product/product/1", Product.class);return product;}/***  参数:商品的 id*      通过订单系统,调用商品服务根据id查询商品信息。*          1)需要配置商品对象。*          2)需要调用商品服务。*   可以使用 java 中的 urlconnection, HttpClient, OkHttp 进行远程调用。*   也可以使用 restTemplate 进行远程调用。** @param id* @return*/
//    @RequestMapping(value = "/buy/{id}", method = RequestMethod.GET)
//    public Product findById(@PathVariable Long id){
//
//        //调用 discoveryClient 方法,已调用服务名称获取所有的元数据。
//        List<ServiceInstance> instances = discoveryClient.getInstances("service-product");
//        for (ServiceInstance instance : instances) {
//            System.out.println(instance);
//        }
//
//        //获取唯一的一个元数据
//        ServiceInstance instance = instances.get(0);
//
//        Product product = null;
//
//        //根据元数据中的主机地址和端口号拼接请求微服务的 URL
//        product = restTemplate.getForObject("http://" + instance.getHost() + ":" + instance.getPort() + "/product/1", Product.class);
//
//
//        /**
//         *  调用商品服务(将微服务的请求路径硬编码到 java 代码中)
//         *  存在问题:对微服务调用的负载均衡,加入API网关,配置的统一管理,链路追踪。
//         */
//        //product = restTemplate.getForObject("http://127.0.0.1:9001/product/1", Product.class);
//        return product;
//    }
}

java_126">2)修改 order_service 子工程(子模块)中的 启动类 OrderApplication.java

使用 基于 ribbon 的形式调用远程微服务,使用 @LoadBalanced 注解 声明 RestTemplate。


/***   C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\java\djh\it\order\OrderApplication.java**   2024-4-19  启动类 OrderApplication.java*/
package djh.it.order;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
@EntityScan("djh.it.order.domain")
@EnableEurekaClient  //激活 EurekaClient, 同 @EnableDiscoveryClient 注解相同。
public class OrderApplication {/***  使用 spring 提供的 RestTemplate 发送 http 请求到商品服务。*      1)创建 RestTemplate 对象交给容器管理。*      2)在使用的时候,调用其方法完成操作(getXX, postXX)。     **/@LoadBalanced@Beanpublic RestTemplate restTemplate(){return new RestTemplate();}public static void main(String[] args) {SpringApplication.run(OrderApplication.class, args);}
}

3)运行 3个 启动类(order_service, product_service, eureka_service),进行测试

浏览器地址栏输入:http://localhost:9000 输出界面如下:
在这里插入图片描述

浏览器地址栏输入:http://localhost:9001/product/1 输出界面如下:
在这里插入图片描述

浏览器地址栏输入:http://localhost:9002/order/buy/1 输出界面如下:
在这里插入图片描述

ribbon_186">二、ribbon:客户端负载均衡的概述

1、服务端的负载均衡:如:ngnix 软件系统, F5 硬件配置等。

2、客户端的负载均衡:如:ribbon

ribbon 是一个典型的客户端负载均衡器。
ribbon 会获取服务器的所有地址,根据内部的负载均衡算法,
获取本次请求的有效地址。

ribbon__196">三、基于 ribbon 的负载均衡测试

1、准备两个商品微服务(product_service 子工程),端口分别为:9001,9011

java_200">1)修改 product_service 子工程(子模块)中的 controller 类 ProductController.java
/***  C:\java-test\idea2019\spring_cloud_demo\product_service\src\main\java\djh\it\product\controller\ProductController.java**  2024-4-17 商品的 controller 类 ProductController.java*/
package djh.it.product.controller;import djh.it.product.domain.Product;
import djh.it.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;@RestController
@RequestMapping("/product")
public class ProductController {@Autowiredprivate ProductService productService;//获取服务器端口号@Value("${server.port}")private String port;//获取服务器IP地址@Value("${spring.cloud.client.ip-address}")   //springcloud 自动获取当前应用的IP地址private String ip;@RequestMapping(value = "/{id}", method = RequestMethod.GET)public Product findById(@PathVariable Long id){Product product = productService.findById(id);product.setProductName("访问的服务地址是:" + ip + " : " + port);return product;}@RequestMapping(value = "", method = RequestMethod.POST)public String save (@RequestBody Product product){productService.save(product);return "保存成功";}}
2)在 idea 的 RunDashboard 运行面板,复制一个 ProductApplication 并命名为:ProductApplication(2) 把它也运行起来。

在 idea 中,找不到 RunDashboard 运行面板 时,可以看如下文章:

# IDEA2019 如何打开 Run Dashboard 运行仪表面板

修改 product_service 子工程(子模块)中的 application.yml 配置文件中的端口号为:9011。
并把名为:ProductApplication(2) 服务 也运行起来。

## C:\java-test\idea2019\spring_cloud_demo\product_service\src\main\resources\application.ymlserver:port: 9001  # 启动端口 命令行注入。
#  port: ${port:56010}  # 启动端口设置为动态传参,如果未传参数,默认端口为 56010
#  servlet:
#    context-path: /application1spring:application:name: service-product  #spring应用名, # 注意 FeignClient 不支持名字带下划线
#  main:
#    allow-bean-definition-overriding: true # SpringBoot2.1 需要设定。datasource:driver-class-name: com.mysql.jdbc.Driver  # mysql 驱动
#    url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghaiusername: rootpassword: 12311jpa:database: MySQLshow-sql: trueopen-in-view: trueeureka:  # 配置 Eurekaclient:service-url:defaultZone: http://localhost:9000/eureka/
#      defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  # 高可用,注册多个 eurekaserver 用 , 隔开。instance:prefer-ip-address: true  # 使用 ip 地址注册instance-id: ${spring.cloud.client.ip-address}:${server.port}  # 向注册中心注册服务的id(IP 地址)。lease-renewal-interval-in-seconds: 10  # 设置向注册中心每10秒发送一次心跳,告诉注册中心此服务没有岩机,此参数默认是30秒。lease-expiration-duration-in-seconds: 20  # 设置每20秒如果注册中心没收到此服务的心跳,就认为此服务岩机了,此参数默认是90秒。

## C:\java-test\idea2019\spring_cloud_demo\product_service\src\main\resources\application.ymlserver:port: 9011  # 启动端口 命令行注入。
#  port: ${port:56010}  # 启动端口设置为动态传参,如果未传参数,默认端口为 56010
#  servlet:
#    context-path: /application1spring:application:name: service-product  #spring应用名, # 注意 FeignClient 不支持名字带下划线
#  main:
#    allow-bean-definition-overriding: true # SpringBoot2.1 需要设定。datasource:driver-class-name: com.mysql.jdbc.Driver  # mysql 驱动
#    url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghaiusername: rootpassword: 12311jpa:database: MySQLshow-sql: trueopen-in-view: trueeureka:  # 配置 Eurekaclient:service-url:defaultZone: http://localhost:9000/eureka/
#      defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  # 高可用,注册多个 eurekaserver 用 , 隔开。instance:prefer-ip-address: true  # 使用 ip 地址注册instance-id: ${spring.cloud.client.ip-address}:${server.port}  # 向注册中心注册服务的id(IP 地址)。lease-renewal-interval-in-seconds: 10  # 设置向注册中心每10秒发送一次心跳,告诉注册中心此服务没有岩机,此参数默认是30秒。lease-expiration-duration-in-seconds: 20  # 设置每20秒如果注册中心没收到此服务的心跳,就认为此服务岩机了,此参数默认是90秒。
3)运行 3个 启动类(order_service, product_service, eureka_service),进行测试

浏览器地址栏输入:http://localhost:9000 输出界面如下:
在这里插入图片描述

浏览器地址栏输入:http://localhost:9001/product/1 输出界面如下:
在这里插入图片描述

浏览器地址栏输入:http://localhost:9011/product/1 输出界面如下:
在这里插入图片描述

浏览器地址栏输入:http://localhost:9002/order/buy/1 输出界面如下:
在这里插入图片描述

2、在订单系统中(order_service 子工程),远程以负载均衡的形式调用商品微服务。

java__363">1)在 order_service 子工程(子模块)的 controller 类 OrderController.java

使用 基于 ribbon 的形式调用远程微服务:使用服务名称 service-product 替换 IP 地址 。


/***  C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\java\djh\it\order\controller\OrderController.java**  2024-4-19 订单的 controller 类 OrderController.java*/
package djh.it.order.controller;import djh.it.order.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;import java.util.List;@RestController
@RequestMapping("/order")
public class OrderController {// 注入 restTemplate 对象@Autowiredprivate RestTemplate restTemplate;/***  注入 DiscoveryClient : springcloud 提供的获取元数据的工具类。*      调用方法获取服务的元数据信息。*/@Autowiredprivate DiscoveryClient discoveryClient;/***  使用 基于 ribbon 的形式调用远程微服务:*  1、使用 @LoadBalanced 注解 声明 RestTemplate*  2、使用服务名称 service-product 替换 IP 地址 。** @param id* @return*/@RequestMapping(value = "/buy/{id}", method = RequestMethod.GET)public Product findById(@PathVariable Long id){Product product = null;//product = restTemplate.getForObject("http://127.0.0.1:9001/product/1", Product.class);product = restTemplate.getForObject("http://service-product/product/1", Product.class);return product;}/***  参数:商品的 id*      通过订单系统,调用商品服务根据id查询商品信息。*          1)需要配置商品对象。*          2)需要调用商品服务。*   可以使用 java 中的 urlconnection, HttpClient, OkHttp 进行远程调用。*   也可以使用 restTemplate 进行远程调用。** @param id* @return*/
//    @RequestMapping(value = "/buy/{id}", method = RequestMethod.GET)
//    public Product findById(@PathVariable Long id){
//
//        //调用 discoveryClient 方法,已调用服务名称获取所有的元数据。
//        List<ServiceInstance> instances = discoveryClient.getInstances("service-product");
//        for (ServiceInstance instance : instances) {
//            System.out.println(instance);
//        }
//
//        //获取唯一的一个元数据
//        ServiceInstance instance = instances.get(0);
//
//        Product product = null;
//
//        //根据元数据中的主机地址和端口号拼接请求微服务的 URL
//        product = restTemplate.getForObject("http://" + instance.getHost() + ":" + instance.getPort() + "/product/1", Product.class);
//
//
//        /**
//         *  调用商品服务(将微服务的请求路径硬编码到 java 代码中)
//         *  存在问题:对微服务调用的负载均衡,加入API网关,配置的统一管理,链路追踪。
//         */
//        //product = restTemplate.getForObject("http://127.0.0.1:9001/product/1", Product.class);
//        return product;
//    }
}
java__458">2)在 order_service 子工程(子模块)的 启动类 OrderApplication.java

使用 基于 ribbon 的形式调用远程微服务:使用 @LoadBalanced 注解 声明 RestTemplate


/***   C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\java\djh\it\order\OrderApplication.java**   2024-4-19  启动类 OrderApplication.java*/
package djh.it.order;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;@SpringBootApplication
@EntityScan("djh.it.order.domain")
@EnableEurekaClient  //激活 EurekaClient, 同 @EnableDiscoveryClient 注解相同。
public class OrderApplication {/***  使用 spring 提供的 RestTemplate 发送 http 请求到商品服务。*      1)创建 RestTemplate 对象交给容器管理。*      2)在使用的时候,调用其方法完成操作(getXX, postXX)。     **/@LoadBalanced  //使用 基于 ribbon 的形式调用远程微服务:使用 @LoadBalanced 注解 声明 RestTemplate@Beanpublic RestTemplate restTemplate(){return new RestTemplate();}public static void main(String[] args) {SpringApplication.run(OrderApplication.class, args);}
}
3)再次运行 3个 启动类(order_service, product_service, eureka_service),进行测试

浏览器地址栏输入:http://localhost:9002/order/buy/1 多刷新几次,
会发现,输出界面采用轮询的方式 切换 9001 和 9011 端口的访问。如下:
7.png
8.png

ribbon_514">四、ribbon:负载均衡策略

ribbon__516">1、ribbon:负载均衡策略 分类

com.netf1ix.1oadbalancer.RoundRobinRule: 以轮询的方式进行负载均衡
com.netflix.loadbalancer.RandomRule: 随机策略
com.netflix.1oadbalancer.RetryRule: 重试策略。
com.netflix.1oadbalancer.weightedResponseTimeRule: 权重策略。会计算每个服务的权重,越高的被调用的可能性越大。
com.netflix.1oadbalancer.BestAvailableRule: 最佳策略。遍历所有的服务实例,过滤掉故障实例,并返回请求数最小的实例返回。
com.netf1ix.1oadbalancer.Avai1abilityFi1teringRule: 可用过滤策略。过滤掉故障和请求数超过阈值的服务实例,再从剩下的实力中轮询调用。

ribbon__526">2、ribbon:负载均衡 策略选择:

1)如果每个机器配置一样,则建议不修改策略(推荐)
2)如果部分机器配置性能强,则可以改为 WeightedResponseTimeRule 权重策略。

3、可以在服务消费者的 application.yml 配置文件中修改负载均衡策略

shop-service-product:
ribbon :
NFLoadBalancerRuleclassName: com.netflix.loadbalancer.RandomRule

1)修改 order_service 子工程(子模块)的 application.yml 配置文件,

添加 修改 ribbon 负载均衡策略。


## C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\resources\application.ymlserver:port: 9002  # 启动端口 命令行注入。
#  port: ${port:9002}  # 启动端口设置为动态传参,如果未传参数,默认端口为 9002
#  servlet:
#    context-path: /application1spring:application:name: service-order  #spring应用名, # 注意 FeignClient 不支持名字带下划线
#  main:
#    allow-bean-definition-overriding: true # SpringBoot2.1 需要设定。datasource:driver-class-name: com.mysql.jdbc.Driver  # mysql 驱动
#    url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghaiusername: rootpassword: 12311jpa:database: MySQLshow-sql: trueopen-in-view: trueeureka:  # 配置 Eurekaclient:service-url:defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  # 多个 eurekaserver 用 , 隔开。instance:prefer-ip-address: true  # 使用 ip 地址注册
# 添加 修改 ribbon 负载均衡策略:服务名 - ribbon - NFLoadBalancerRuleclassName :策略
service-product:ribbon:NFLoadBalancerRuleclassName: com.netflix.loadbalancer.RandomRule
2)再次运行 3个 启动类(order_service, product_service, eureka_service),进行测试

浏览器地址栏输入:http://localhost:9002/order/buy/1 多刷新几次,
会发现,输出界面采用 随机 的方式 切换 9001 和 9011 端口的访问。如下:
在这里插入图片描述

在这里插入图片描述

ribbon_594">五、ribbon:请求重试

1、修改 order_service 子工程(子模块)的 pom.xml 配置文件,

添加 spring-retry 请求重试 依赖坐标。


<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>spring_cloud_demo</artifactId><groupId>djh.it</groupId><version>1.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><artifactId>order_service</artifactId><dependencies><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><!--            <version>5.1.32</version>--><version>8.0.26</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><!-- 引入 EurekaClient 依赖坐标 --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><!-- 引入 spring-retry 请求重试 依赖坐标 --><dependency><groupId>org.springframework.retry</groupId><artifactId>spring-retry</artifactId></dependency></dependencies></project>
<!-- C:\java-test\idea2019\spring_cloud_demo\order_service\pom.xml -->

2、修改 order_service 子工程(子模块)的 application.yml 配置文件,

添加 ribbon 请求重试设置,添加 日志打印设置。


## C:\java-test\idea2019\spring_cloud_demo\order_service\src\main\resources\application.ymlserver:port: 9002  # 启动端口 命令行注入。
#  port: ${port:9002}  # 启动端口设置为动态传参,如果未传参数,默认端口为 9002
#  servlet:
#    context-path: /application1spring:application:name: service-order  #spring应用名, # 注意 FeignClient 不支持名字带下划线
#  main:
#    allow-bean-definition-overriding: true # SpringBoot2.1 需要设定。datasource:driver-class-name: com.mysql.jdbc.Driver  # mysql 驱动
#    url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8url: jdbc:mysql://localhost:3306/shop?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghaiusername: rootpassword: 12311jpa:database: MySQLshow-sql: trueopen-in-view: trueeureka:  # 配置 Eurekaclient:service-url:defaultZone: http://localhost:9000/eureka/,http://localhost:8000/eureka/  # 多个 eurekaserver 用 , 隔开。instance:prefer-ip-address: true  # 使用 ip 地址注册logging:  # 使用日志level:root: debug# 添加 修改 ribbon 负载均衡策略:服务名 - ribbon - NFLoadBalancerRuleclassName :策略
service-product:ribbon:
#    NFLoadBalancerRuleclassName: com.netflix.loadbalancer.RandomRule  # 配置负载均衡重置为随机ConnectTimeout: 250  # Ribbon 的连接超时时间ReadTimeout: 1000  # Ribbon 的数据读取超时时间OkToRetryOnAllOperations: true  # 是否对所有操作都进行重试MaxAutoRetriesNextServer: 1  # 切换实例的重试次数MaxAutoRetries: 1  # 对当前实例的重试次数。

3、再次运行 3个 启动类(order_service, product_service, eureka_service),进行测试

浏览器地址栏输入:http://localhost:9002/order/buy/1 多刷新几次,
先发现是轮询访问 9001 和 9011 端口,

然后停掉一个,再次刷新访问
会发现,edia 控制台 Consule 界面 有等待,尝试请求重试 日志,如下:
在这里插入图片描述

上一节链接如下:
# 从浅入深 学习 SpringCloud 微服务架构(三)注册中心 Eureka(4)


http://www.ppmy.cn/server/15600.html

相关文章

《数据结构与算法之美》读书笔记4(递归)

递归是一种应用非常广泛的算法。之后要讲的很多数据结构和算法的编码实现都要用到递归&#xff1a;DFS深度优先搜索&#xff0c;前中后序二叉树遍历等。 推荐注册返佣金这个功能&#xff0c;用户A推荐用户B来注册&#xff0c;用户B推荐用户C来注册。可以说用户B的“最终推荐人…

opencv 打开中文路径图报错

img cv.imread(中文图, 1) [ WARN:06.414] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_(‘D:/download/中文.png’): can’t open/read file: check file path/integrity 转换编码无法解决 file_pa…

后端程序员利用 AI 给网站制作专业 favicon

看看你的 Chrome 浏览器顶部的标签页&#xff0c;每个标签页前面有一个小小的图标&#xff0c;这个就是 favicon&#xff0c;如果你将网页保存到收藏夹&#xff0c;前面也会是这个小图标。这个图标有时候就是网站的 Logo&#xff0c;有时候也不太一样。 上面截图中&#xff0c…

记内网http洪水攻击,导致网页无法访问一事

事由 最近两日&#xff0c;部分同事在访问税纪云平台时&#xff0c;登录跳转页面频繁转圈、要么就是出现无法连接的错误提示。 无法访问此页面 已重置连接。 请尝试: 检查连接检查代理和防火墙运行 Windows 网络诊断经过以下几方面的排查&#xff0c;无果。 后续通过检查…

Footprint Analytics 与 GalaChain 达成战略合作

​ Footprint Analytics 宣布与 GalaChain 达成战略合作。GalaChain 是 Gala 旗下的 Layer 1 区块链。此次合作标志着双方在游戏&#xff08;包括 Gala Games) 、娱乐和金融等多个行业的区块链生态系统革新方面迈出了重要的一步。 GalaChain 致力于满足企业级项目的广泛需求&…

python之APScheduler

APScheduler是一个用于Python的高级任务调度库&#xff0c;可以在任何Python环境中使用。它提供了各种灵活的方式来定义和执行定时任务&#xff0c;支持多种调度方式&#xff0c;包括固定时间间隔、固定日期时间、CRON表达式等。 首先&#xff0c;需要使用pip安装APScheduler库…

CST Studio初级教程 一

本教程将详细介绍CST Studio Project创建。 新建Project 1. 点击New and Recent&#xff0c;然后点击New Template。 然后依据我们的仿真属类&#xff0c;在下图中做选择需要的模板。 如果做高频连接器信号完整性&#xff08;SI&#xff09;仿真&#xff0c;我们就选Microwaves…

3.AlexNet--CNN经典网络模型详解(pytorch实现)

看博客AlexNet--CNN经典网络模型详解&#xff08;pytorch实现&#xff09;_alex的cnn-CSDN博客&#xff0c;该博客的作者写的很详细&#xff0c;是一个简单的目标分类的代码&#xff0c;可以通过该代码深入了解目标检测的简单框架。在这里不作详细的赘述&#xff0c;如果想更深…