microservices - 上传大文件时断路器打开
问题描述
我有一个具有以下微服务架构师的现有项目。Client --> API Gateway(Spring cloud 使用 Hystrix 作为断路器) --> UploadService. 上传小文件(POST /upload/video
)时一切正常。但是当文件较大时,上传时间很长,Hystrix 将打开并返回回退。
有没有人对我的案例进行过练习,或者我如何设置仅POST /upload/video
在 Hystrix 上请求的超时?
解决方案
看来您需要在 Hystric 客户端中配置更大的超时时间;在您的示例中,这是“API 网关(使用 Hystrix 作为断路器的 Spring 云)”
我想您的代码将如下所示:
HystrixCommand.Setter yourHystrixCommand; ... blah your HystrixCommand
HystrixCommandProperties.Setter hystrixCommandPropertiesSetter = HystrixCommandProperties.Setter();
hystrixCommandPropertiesSetter.withExecutionTimeoutInMilliseconds(yourDesiredTimeoutValue);
yourHystrixCommand.andCommandPropertiesDefaults(commandProperties);
编辑:
这里的“Hystrix 客户端”是指使用 Hystrix 的客户端软件。
推荐阅读
- python - 如何使用 nginx 和 gunicorn 使我的 python-flask 网站 24*7 可用
- html - 如何创建这种类型的形状,里面有文字?
- javascript - javascript 函数表达式是否类似于或基于 s 表达式?
- python - 使用 lxml 在根元素之前/之后访问处理指令
- java - 如何编写 Java 代码从 excel 表中读取 2 个查询并比较它们的数据库记录?
- php - 从值中获取子字符串作为数组中的键
- sql-server - Xp_CmdShell Powershell 脚本未找到有效模块
- javascript - 有没有办法列出机器人所在的 Discord 服务器的所有 ID?
- python - 总是得到没有文件存在
- c++ - 如何避免循环冻结用户界面(最小示例)