him*_*mps 5 java spring spring-boot reactor-netty spring-webflux
在Spring 5中,我们使用webclient通过SSL调用其他REST端点。当我们在wireshark上记录日志时,我们看到对于每个请求,SSL握手都在发生,并且花费大量时间。
这些是我的查询。
查询1:Webclient执行内部连接池。连接失效之前的到期时间是多少?
我们是否可以设置打开连接的时间,以便在已经定义的连接上发送新请求以避免SSL握手?
是否存在避免每个请求进行SSL握手的设置?
查询2:我们正在创建Webclient的bean,并在整个应用程序中使用它。我们需要做一些设置来启用连接池和重用现有连接以发送新请求。还有避免每次都进行SSL握手的任何设置。
@Bean(name="productDefWebClient")
public WebClient productDefWebClient() {
ConnectionProvider elasticPool = ConnectionProvider.elastic("productDef-pool");
HttpClient httpClient = HttpClient.create(elasticPool).wiretap(true);
return WebClient.builder()
.clientConnector(new ReactorClientHttpConnector(httpClient))
.defaultHeader("Accept","application/json")
.baseUrl("https://test-qa.test.com")
.build();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
127 次 |
| 最近记录: |