Tag: hystrix

Hystrix在运行时忽略超时

我正在试验一下Hystrix。 我支持文档,即使是通过’run’同步调用Hystrix命令也默认在一个线程中运行,并且应该受Hystrix中配置的超时限制。 但是当我尝试它时,似乎没有超时。 我是否误解了文档? 或者我做错了什么? 有没有办法通过同步调用获得超时行为? 更具体:我有一个’SimpleService’需要5秒才能返回。 这包含在Hystrix命令中,超时为500ms: public class WebRequestCommand extends HystrixCommand { private final SimpleService baneService; protected WebRequestCommand(SimpleService baneService) { super( Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(“test”)) .andCommandPropertiesDefaults( HystrixCommandProperties.Setter() .withExecutionIsolationThreadTimeoutInMilliseconds(500))); this.baneService = baneService; } @Override protected String run() { return baneService.connectToBane(); } @Override protected String getFallback() { return “SERVICE NOT AVAILABLE”; } } 如果我这样称呼它: WebRequestCommand webService = new […]

Hystrix命令失败,显示“超时且无可用后备”

我注意到我的应用程序中的一些命令失败了 Caused by: ! com.netflix.hystrix.exception.HystrixRuntimeException: GetAPICommand timed-out and no fallback available. out: ! at com.netflix.hystrix.HystrixCommand.getFallbackOrThrowException(HystrixCommand.java:1631) out: ! at com.netflix.hystrix.HystrixCommand.access$2000(HystrixCommand.java:97) out: ! at com.netflix.hystrix.HystrixCommand$TimeoutObservable$1$1.tick(HystrixCommand.java:1025) out: ! at com.netflix.hystrix.HystrixCommand$1.performBlockingGetWithTimeout(HystrixCommand.java:621) out: ! at com.netflix.hystrix.HystrixCommand$1.get(HystrixCommand.java:516) out: ! at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:425) out: Caused by: ! java.util.concurrent.TimeoutException: null out: !… 11 common frames omitted 这是我的Hystrix配置覆盖: hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000 hystrix.threadpool.default.coreSize=50 hystrix.threadpool.default.maxQueueSize=100 hystrix.threadpool.default.queueSizeRejectionThreshold=50 这是什么样的超时? 它是外部应用程序的读/连接超时吗? 我该如何调试呢?

将Netflix Zuul与Netflix Hystrix结合使用

我是Netflix开源项目的忠实粉丝。 他们做了一些很酷的东西。 我已经建立了一个Zuul,工作正常。 创建了所有类型的filter,并动态加载和运行。 我现在尝试做的是在filter中使用Hystrix。 我所看到的是,如果一切都很好,那一切都有效。 但是当run()方法中存在exception时,Zuul会捕获它而不是Hystrix。 所以从不调用getFallback()。 我分享了我的代码Github 。 有人知道Hystrix如何捕捉exception而不是Zuul?

Netflix Archaius动态配置

我正在将Hystrix集成到我现有的项目中,我想从xml文件中读取配置值,而不是使用Configuration Manager提供配置属性。 当在xml文件中更新值时,我希望在运行时更新Hystrix配置。 这是我关注的指南: https : //github.com/Netflix/archaius/wiki/Users-Guide 到目前为止我了解到我可以使用PolledConfigurationSource和以下代码: PolledConfigurationSource source = … AbstractPollingScheduler scheduler = … DynamicConfiguration configuration = new DynamicConfiguration(source, scheduler); ConfigurationManager.install(configuration); 如何在固定的时间间隔后将PolledConfigurationSource指向xml文件以读取属性?