我正在运行微服务 API 的负载,其中涉及使用 Spring Reactive Webclient 调用其他微服务 API。我正在使用 Postman runner 选项卡来测试这一点。
\n首先,我以 1500 次迭代运行负载,每个请求都会调用第二个微服务,一切都按预期正常工作。\n但是当我以 5000 次迭代运行负载时,第二个微服务被调用 3500 次,并且调用次数为 1500 次。由于问题而失败
\n\n\nWebClientRequestException:待处理获取队列已达到其最大大小 1000
\n
使用默认配置的 org.springframework.web.reactive.function.client.WebClient ,下面是代码片段。
\n private WebClient webClient;\n\n @PostConstruct\n public void init() {\n this.webClient = WebClient.builder().defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)\n .build();\n }\nRun Code Online (Sandbox Code Playgroud)\n可以采取什么措施来避免这种情况?
\n我正在使用最新的 spring-boot-starter-parent 依赖项(版本 2.5.3)和 spring-webflux-5.3.9.jar jar。
\n日志:
\nreactor.core.Exceptions$ErrorCallbackNotImplemented: reactor.core.Exceptions$RetryExhaustedException: Retries exhausted: 3/3\nCaused by: reactor.core.Exceptions$RetryExhaustedException: Retries exhausted: 3/3\n at reactor.core.Exceptions.retryExhausted(Exceptions.java:290)\n at reactor.util.retry.RetryBackoffSpec.lambda$static$0(RetryBackoffSpec.java:67)\n at reactor.util.retry.RetryBackoffSpec.lambda$generateCompanion$4(RetryBackoffSpec.java:557)\n at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:375)\n at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerComplete(FluxConcatMap.java:296)\n at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:885)\n at …Run Code Online (Sandbox Code Playgroud)