【问题标题】:Circuit breaker open when uploading large file上传大文件时断路器打开
【发布时间】:2019-10-04 01:28:11
【问题描述】:

我有一个与以下微服务架构师合作的现有项目。 Client --> API Gateway(Spring cloud 使用 Hystrix 作为断路器) --> UploadService.上传小文件时(POST /upload/video)一切都很好。但是当文件较大时,上传时间很长,Hystrix 会 OPEN 并返回 fallback。

是否有人对我的案例进行过练习,或者我如何为 Hystrix 上的 POST /upload/video 请求设置超时?

【问题讨论】:

    标签: microservices spring-boot


    【解决方案1】:

    看来你需要在Hystric客户端配置更大的超时时间; 在您的示例中,这是“API 网关(使用 Hystrix 作为断路器的 Spring 云)”

    我想你的代码看起来像这样:

    HystrixCommand.Setter yourHystrixCommand; ... blah your HystrixCommand
    
    HystrixCommandProperties.Setter hystrixCommandPropertiesSetter = HystrixCommandProperties.Setter();
    hystrixCommandPropertiesSetter.withExecutionTimeoutInMilliseconds(yourDesiredTimeoutValue);
    yourHystrixCommand.andCommandPropertiesDefaults(commandProperties);
    

    这是introduction to Hystrix at Baeldung

    编辑:
    这里的“Hystrix Client”是指使用Hystrix的客户端软件。

    【讨论】:

    • 当你说“Hystrix客户端”时,你的意思是命令动态增加自己的超时时间吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-29
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    相关资源
    最近更新 更多