公司的项目是用springcloud写的,之前的上传文件大小为5M,现需求要上传到500M,
spring:
servlet:
multipart:
max-file-size: 500MB
max-request-size: 501MB
参数已经更改到500M,现在上传300M的文件提示超时,gateway的配置如下
ribbon:
ReadTimeout: 60000 #连接超时时间
ConnectTimeout: 60000 # Ribbon的数据读取超时时间
MaxAutoRetries: 1 # 本次实例的重试次数 即失败之后,重试几次
MaxAutoRetriesNextServer: 2 # 切换实例的重试次数, 即发生错误之后,切换几次实例
OkToRetryOnAllOperations: true # 是否对所有操作都进行重试
eureka:
enabled: true
eager-load:
enabled: true # 开启Ribbon的饥饿加载模式
clients: # 指定需要饥饿加载的服务名
- other
- user
- train
zuul:
host:
socket-timeout-millis: 12000
connect-timeout-millis: 12000
retryable: true # zuul开启重试
hystrix:
shareSecurityContext: true
command:
default:
circuitBreaker:
sleepWindowInMilliseconds: 100000
forceClosed: true
execution:
isolation:
thread:
# hystrix 的超时时间必须大于ribbon 的超时时间,不然重试机制不会触发, 规则为 timeoutInMilliseconds > (ConnectTimeout + ReadTimeout) * (MaxAutoRetries+1)*(MaxAutoRetriesNextServer+1)
timeoutInMilliseconds: 600000
如果把 ribbon.ReadTimeout 的时间调大,可以实现上传但是线上环境是部署的集群,如果时间调大之后,把之前的一个服务停掉,注册中心需要很长时间才能把这个服务器踢下线,就会导致这段时间有接口访问到这个台服务器上,会提示访问错误。
导出大批量的excel数据也是超时。
没有油大神知道这种问题应该怎么解决吗,因为之前没有过springcloud大文件的相关经验。