标签: hystrix

为Hystrix-AMQP生成的LOGS太多

所以我将Hystrix-AMQP的依赖项添加到我的服务中,日志文件变得疯狂,它只是继续记录指标的东西.我需要那个罐子才能将它与涡轮AMQP一起使用.

这是我在hystrix的gradle中所拥有的: -

compile         ("org.springframework.cloud:spring-cloud-starter-hystrix:1.0.6.RELEASE")
compile         ('org.springframework.cloud:spring-cloud-starter-bus-amqp:1.0.6.RELEASE')
compile         ('org.springframework.cloud:spring-cloud-netflix-hystrix-amqp:1.0.7.RELEASE')
compile         ('com.netflix.hystrix:hystrix-javanica:1.5.2')
Run Code Online (Sandbox Code Playgroud)

这是继续在我的日志中生成它继续运行: -

   2016-05-03 13:49:14.698 INFO [LogMessage=Starting span: MilliSpan(begin=1462308554698, end=0, name=execution(HystrixStreamTask.sendMetrics()), traceId=21825112-0c71-4c6a-a9ca-51b11a21e4e5, parents=[], spanId=053946b5-7287-41f4-8579-d048655f41ea, remote=false, annotations={}, processId=null, timelineAnnotations=[])]
2016-05-03 13:49:14.698 INFO  [LogMessage=Continued span: MilliSpan(begin=1462308554698, end=0, name=execution(HystrixStreamTask.sendMetrics()), traceId=21825112-0c71-4c6a-a9ca-51b11a21e4e5, parents=[], spanId=053946b5-7287-41f4-8579-d048655f41ea, remote=false, annotations={}, processId=null, timelineAnnotations=[])]
2016-05-03 13:49:14.698 INFO  [LogMessage=Stopped span: MilliSpan(begin=1462308554698, end=1462308554698, name=execution(HystrixStreamTask.sendMetrics()), traceId=21825112-0c71-4c6a-a9ca-51b11a21e4e5, parents=[], spanId=053946b5-7287-41f4-8579-d048655f41ea, remote=false, annotations={/messaging/headers/id=e1cc5042-1a5c-e3f9-6f3c-de936d1aa959, /messaging/headers/timestamp=1462308554698, /messaging/payload/type=java.lang.String, /messaging/payload/size=592}, processId=null, timelineAnnotations=[])]
2016-05-03 13:49:14.698 INFO  [LogMessage=Starting span: MilliSpan(begin=1462308554698, end=0, name=execution(HystrixStreamTask.gatherMetrics()), traceId=6cc342bb-9693-493a-8fa8-8a17c2ff06c3, parents=[], spanId=10cdee69-22f8-43ab-883f-3e09b29ab6fb, remote=false, annotations={}, processId=null, timelineAnnotations=[])]
2016-05-03 13:49:14.699 INFO [LogMessage=Continued …
Run Code Online (Sandbox Code Playgroud)

java netflix amqp hystrix spring-cloud

11
推荐指数
1
解决办法
484
查看次数

Spring boot 微服务 (jdk11) 抛出 hystrix.stream-actuator-endpoint 异常

spring boot服务迁移到2.1.3.RELEASEand后jdk11,出现hystrix流执行器相关异常。

例外是 ERROR org.apache.catalina.core.ContainerBase.[Tomcat-1].[localhost].[/].[hystrix.stream-actuator-endpoint] - Servlet.service() for servlet [hystrix.stream-actuator-endpoint] in context with path [] threw exception[]


Spring启动版本:2.1.3.RELEASE

Java 版本:11

公开所有执行器端点: management.endpoints.web.exposure.include=*

此外,hystrix.stream端点实际上已启用并提供流。尽管如此,日志中仍然会出现异常


堆栈跟踪:

java.nio.BufferOverflowException
    at java.base/java.nio.DirectByteBuffer.put(DirectByteBuffer.java:410)
    at java.base/java.nio.DirectByteBuffer.put(DirectByteBuffer.java:389)
    at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:74)
    at java.base/sun.nio.ch.IOUtil.write(IOUtil.java:50)
    at java.base/sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:466)
    at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:134)
    at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:105)
    at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:144)
    at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.doWrite(NioEndpoint.java:1223)
    at org.apache.tomcat.util.net.SocketWrapperBase.doWrite(SocketWrapperBase.java:743)
    at org.apache.tomcat.util.net.SocketWrapperBase.flushBlocking(SocketWrapperBase.java:696)
    at org.apache.tomcat.util.net.SocketWrapperBase.flush(SocketWrapperBase.java:686)
    at org.apache.coyote.http11.Http11OutputBuffer$SocketOutputBuffer.flush(Http11OutputBuffer.java:553)
    at org.apache.coyote.http11.filters.ChunkedOutputFilter.flush(ChunkedOutputFilter.java:157)
    at org.apache.coyote.http11.Http11OutputBuffer.flush(Http11OutputBuffer.java:216)
    at org.apache.coyote.http11.Http11Processor.flush(Http11Processor.java:1149)
    at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:394)
    at org.apache.coyote.Response.action(Response.java:209)
    at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:295)
    at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:262)
    at org.apache.catalina.connector.CoyoteWriter.flush(CoyoteWriter.java:94)
    at org.apache.catalina.connector.CoyoteWriter.checkError(CoyoteWriter.java:119)
    at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.handleRequest(HystrixSampleSseServlet.java:165)
    at com.netflix.hystrix.contrib.sample.stream.HystrixSampleSseServlet.doGet(HystrixSampleSseServlet.java:74)
    at …
Run Code Online (Sandbox Code Playgroud)

java spring-boot hystrix java-11

11
推荐指数
1
解决办法
1057
查看次数

怎么说hystrix不会触发hystrix命令中的一些例外的回退

我们通过直接扩展HystrixCommand类来使用hystrix功能.但是对于一些业务异常,正在触发hystrix的回退方法.

我不希望触发某些业务特定异常的hystrix回退.如何在没有基于注释的情况下实现它?

提前致谢..!

java netflix hystrix

10
推荐指数
1
解决办法
7815
查看次数

如何使用hystrix重试

我有一个封装REST调用的hystrix命令.如果发生故障(例如超时),我想进行单次重试,如果发生故障,则返回适当的错误.

我可以看到Hystrix不支持重试.使用Hystrix的唯一方法是将主逻辑放入getFallback()方法.但它看起来并不正确.

那么,用hystrix实现超时的正确方法是什么?

java hystrix retry-logic

10
推荐指数
1
解决办法
8840
查看次数

Spring环境下,我在新项目中还应该使用Hystrix吗?

看来Hystrix 的生命周期已接近尾声,而 Netflix 堆栈现在已经有点过时了。

我们正在为一个全新的项目构建一个堆栈,我们需要一个断路器,我们的默认选择是 Hystrix,因为它是众所周知的并且受到团队的赞赏。

如今Hystrix已完全集成到Spring Cloud中,是否有计划很快将其删除?

spring spring-boot hystrix spring-cloud-netflix

10
推荐指数
3
解决办法
9995
查看次数

Resilience4j 与 Hystrix。什么是最好的容错能力?

当我最初学习 Spring Boot 时,我已经了解了spring cloud netflix hystrix断路器。有很多选项,例如多个应用程序属性和用于容错的注释基声明。除此之外,它也没有什么重要的阈值。最重要的是,hystrix数据可以通过hystrix dashboard提示hystrix streams。通过使用,turbine我们可以组合多个hystrix streams概览微服务。这是我的经验hystrix

现在我需要实现一个Resilience4j基本上支持相同容错行为的要求。我是新手Resilience4j,我想在开始之前了解这两个容错选项的主要区别。根据我的研究,Resilience4j这是一个比hystrix. 我很高兴了解专家的事实并谢谢您。

fault-tolerance circuit-breaker spring-boot hystrix resilience4j

10
推荐指数
2
解决办法
1万
查看次数

javanica中的Hystrix异步方法没有在spring-boot java应用程序中运行

我正在使用spring-cloud-starter(即具有所有微服务功能的spring boot).当我在使用javanica @HystrixCommand注释的组件中创建hystrix方法时,请按照javanica github网站(https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica)上的说明进行操作该方法运行async,无论我是使用'Future <>'还是Reactive执行'Observable <>',都没有运行/执行,
java.lang.ClassCastException: springbootdemo.EricComponent$1 cannot be cast to springbootdemo.Eric每当我尝试拉取结果(在Future <>的情况下)或得到回调(在Reactive Execution的情况下......并且println不会触发,所以它确实没有运行).

public class Application { ...
}
@RestController
@RequestMapping(value = "/makebunchofcalls/{num}")
class EricController { ..

    @RequestMapping(method={RequestMethod.POST})
    ArrayList<Eric> doCalls(@PathVariable Integer num) throws IOException {
        ArrayList<Eric> ale = new ArrayList<Eric>(num);
        for (int i =0; i<num; i++) {
            rx.Observable<Eric> oe = this.ericComponent.doRestTemplateCallAsync(i);
            oe.subscribe(new Action1<Eric>() {
                @Override
                public void call(Eric e) {  // AT RUNTIME, ClassCastException
                    ale.add(e);
                }
            });
        }

        return ale;
    }

@Component
class EricComponent { …
Run Code Online (Sandbox Code Playgroud)

java hystrix spring-cloud

9
推荐指数
1
解决办法
2920
查看次数

无法通过spring.cloud.config.enabled:false禁用Spring Cloud Config

让我先说明我没有直接使用Spring Cloud Config,它可以通过Spring Cloud Hystrix入门传递.

仅使用时@EnableHystrix,Spring Cloud也会尝试查找配置服务器,但由于我没有使用,因此预计会失败.据我所知,该应用程序运行正常,但问题出在状态检查中.健康显示,DOWN因为没有配置服务器.

浏览项目的源代码,我希望spring.cloud.config.enabled=false禁用此功能链,但这不是我所看到的.

升级到1.0.0.RC1(添加此属性)并使用@EnableCircuitBreaker:

{
    status: "DOWN",
    discovery: {
        status: "DOWN",
        discoveryClient: {
            status: "DOWN",
            error: "org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.client.discovery.DiscoveryClient] is defined"
        }
    },
    diskSpace: {
        status: "UP",
        free: 358479622144,
        threshold: 10485760
    },
    hystrix: {
        status: "UP"
    },
    configServer: {
        status: "DOWN",
        error: "org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http: //localhost: 8888/bootstrap/default/master":Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect" …
Run Code Online (Sandbox Code Playgroud)

spring netflix spring-boot hystrix spring-cloud

9
推荐指数
4
解决办法
2万
查看次数

hystrixCommand注释 - commandKey的目的是什么

使用这里描述的 spring的Hystrix注释

我想知道commandKey param是什么.在以下上下文中,我想知道此参数的含义:

   @HystrixCommand(groupKey="UserGroup", commandKey = "GetUserByIdCommand")
public User getUserById(String id) {
    return userResource.getUserById(id);
}
Run Code Online (Sandbox Code Playgroud)

注意这里的commandKey被定义为GetUserByIdCommand,这与线程池有什么关系吗?是否意味着具有该命令键的任何内容都使用相同的线程池,如果是这样的话,这意味着它对于每个具有故障恢复的方法都有其自己的commandKey的良好实践?

我有大约8个类,我想在其中注释方法.我会用这个注释一些类方法,但我想知道如何构造commandKeys?我应该使用所有相同的,或每个类相同或所有独特的等.

java spring hystrix

9
推荐指数
1
解决办法
7023
查看次数

Zuul/Ribbon/Hystrix没有在不同的实例上重试

背景

我正在使用Spring云Brixton.RC2,与Zuul和Eureka一起使用.

我有一个网关服务@EnableZuulProxybook-service一个status方法.通过配置,我可以status通过休眠一段规定的时间来模拟方法的工作.

Zuul路线很简单

zuul.routes.foos.path=/foos/**
zuul.routes.foos.serviceId=reservation-service
Run Code Online (Sandbox Code Playgroud)

我运行了两个实例book-service.当我将休眠时间设置为低于Hystrix超时阈值(1000毫秒)时,我可以看到请求同时发送到图书服务的两个实例.这很好用.

问题

据我所知,如果Hystrix命令失败,Ribbon应该可以在另一台服务器上重试该命令.这应该使故障对客户端透明.

我阅读了Ribbon配置并在Zuul中添加了以下配置:

zuul.routes.reservation-service.retryable=true //not sure which one to try
zuul.routes.foos.retryable=true //not sure which one to try

ribbon.MaxAutoRetries=0 // I don't want to retry on the same host, I also tried with 1 it doesn't work either
ribbon.MaxAutoRetriesNextServer=2
ribbon.OkToRetryOnAllOperations=true
Run Code Online (Sandbox Code Playgroud)

现在我更新配置,以便只有一个服务睡眠时间超过1秒,这意味着我有一个健康服务,一个健康服务.

当我调用网关时,调用会发送到两个实例,一半调用返回500.在网关中,我看到Hystrix超时:

com.netflix.zuul.exception.ZuulException: Forwarding error
    [...]
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: reservation-service timed-out and no fallback available.
    [...]
Caused by: java.util.concurrent.TimeoutException: null
Run Code Online (Sandbox Code Playgroud)

为什么Ribbon不会在另一个实例上重试调用?

我在这里想念什么吗?


参考

  • 与此 …

hystrix spring-cloud netflix-zuul netflix-ribbon spring-cloud-netflix

9
推荐指数
1
解决办法
3278
查看次数