Loading

Hystrix

https://gitee.com/hslxy/spring-cloud-learning中的hystrix-service模块

这个工具可以实现服务降级、请求缓存、请求合并功能

服务降级

服务降级就是将服务进行隔离,避免因为当前服务的问题导致关联的服务也一起崩溃

请求缓存

就是将请求根据一定规则缓存起来,下次直接返回缓存

请求合并

就是当一定时间的内有多个相同请求时,将多个请求合并成一个请求

20221201220448

就比如这个我发了三个请求,结果1,2请求合并成了一个

监控工具 Hystrix Dashboard 是Spring Cloud中查看Hystrix实例执行情况的一种仪表盘组件

踩坑
Origin parameter: http://localhost:8401/actuator/hystrix.stream is not in the allowed list of proxy

hystrix:
  dashboard:
    proxy-stream-allow-list: "localhost"

踩坑
Failed opening connection to http://localhost:8401/actuator/hystrix.stream : 404 : HTTP/1.1 404
网上都说是这个,但是这个不是关键,*改成hystrix.stream,我都不行

management:
  endpoints:
    web:
      exposure:
        include: "*"

用下面这个
https://blog.csdn.net/weixin_43391312/article/details/105017927

在服务提供者的主函数中添加

	@Bean
	public ServletRegistrationBean getServlet(){
		HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
		ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
		registrationBean.setLoadOnStartup(1);
		registrationBean.addUrlMappings("/actuator/hystrix.stream");
		registrationBean.setName("HystrixMetricsStreamServlet");

		return registrationBean;
	}

turbine聚合hystrix的信息

posted @ 2022-12-01 23:02  要努力哇  阅读(50)  评论(0)    收藏  举报