由于ReadTimeoutException调整了ReactiveElasticsearchClient

我们一直在尝试ReactiveElasticsearchRepository,但是当服务闲置几个小时并且您尝试从Elastic Search检索超时的数据时遇到了问题。

发出前几个请求时,我们看到的是:

2019-11-06 17:31:35.858  WARN [my-service,] 56942 --- [ctor-http-nio-1] r.netty.http.client.HttpClientConnect    : [id: 0x8cf5e94d,L:/192.168.1.100:60745 - R:elastic.internal.com/192.168.1.101:9200] The connection observed an error

io.netty.handler.timeout.ReadTimeoutException: null

当我为DEBUG启用reactor.netty时,我看到它经历了尝试池中每个连接的动作:

2019-11-06 17:31:30.841 DEBUG [my-service,] 56942 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider   : [id: 0x8cf5e94d,L:/192.168.1.100:60745 - R:elastic.internal.com/192.168.1.101:9200] Channel acquired,now 1 active connections and 2 inactive connections
2019-11-06 17:31:35.858  WARN [my-service,L:/192.168.1.100:60745 - R:elastic.internal.com/192.168.1.101:9200] The connection observed an error

io.netty.handler.timeout.ReadTimeoutException: null

2019-11-06 17:31:35.881 DEBUG [my-service,L:/192.168.1.100:60745 ! R:elastic.internal.com/192.168.1.101:9200] Releasing channel
2019-11-06 17:31:35.891 DEBUG [my-service,L:/1192.168.1.100:60745 ! R:elastic.internal.com/192.168.1.101:9200] Channel cleaned,now 0 active connections and 2 inactive connections
2019-11-06 17:32:21.249 DEBUG [my-service,] 56942 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider   : [id: 0x38e99d68,L:/192.168.1.100:60744 - R:elastic.internal.com/192.168.1.101:9200] Channel acquired,now 1 active connections and 1 inactive connections
2019-11-06 17:32:26.251  WARN [my-service,] 56942 --- [ctor-http-nio-1] r.netty.http.client.HttpClientConnect    : [id: 0x38e99d68,L:/192.168.1.100:60744 - R:elastic.internal.com/192.168.1.101:9200] The connection observed an error

io.netty.handler.timeout.ReadTimeoutException: null

2019-11-06 17:32:26.255 DEBUG [my-service,L:/192.168.1.100:60744 ! R:elastic.internal.com/192.168.1.101:9200] Releasing channel
2019-11-06 17:32:26.256 DEBUG [my-service,L:/192.168.1.100:60744 ! R:elastic.internal.com/192.168.1.101:9200] Channel cleaned,now 0 active connections and 1 inactive connections
2019-11-06 17:32:32.592 DEBUG [my-service,] 56942 --- [ctor-http-nio-1] r.n.resources.PooledConnectionProvider   : [id: 0xdee3a211,L:/1192.168.1.100:60746 - R:elastic.internal.com/192.168.1.101:9200] Channel acquired,now 1 active connections and 0 inactive connections
2019-11-06 17:32:37.597  WARN [my-service,] 56942 --- [ctor-http-nio-1] r.netty.http.client.HttpClientConnect    : [id: 0xdee3a211,L:/192.168.1.100:60746 - R:elastic.internal.com/192.168.1.101:9200] The connection observed an error

io.netty.handler.timeout.ReadTimeoutException: null

2019-11-06 17:32:37.600 DEBUG [my-service,L:/192.168.1.100:60746 ! R:elastic.internal.com/192.168.1.101:9200] Releasing channel
2019-11-06 17:32:37.600 DEBUG [my-service,L:/192.168.1.100:60746 ! R:elastic.internal.com/192.168.1.101:9200] Channel cleaned,now 0 active connections and 0 inactive connections

直到最终所有活动/非活动连接都被清除,然后重新创建新的连接才能起作用。

是否有一种方法可以在后台进行调整,以限制连接在重新创建之前可以在池中保留多长时间?或者是能够处理这些超时的替代方法。

feifangongzilianjia 回答:由于ReadTimeoutException调整了ReactiveElasticsearchClient

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3147390.html

大家都在问