Reputation: 75
I have a Web service using Spring Boot 2.1.8 and Spring Webflux 5.1.9. This service is running on a Centos server. Everyday, lots of CocosJS game client ( mobile devices ) call some POST HTTP request to this service with some data and a client is just online some hour per day.
This is my service's router:
@Bean
public RouterFunction<ServerResponse> handleLog() {
return route(POST("/log"), (request) -> {
try {
Mono<Long> response = request.bodyToMono(Log.class)
.flatMap(l -> HandleService.handle(l));
return ServerResponse.ok().contentType(MediaType.TEXT_EVENT_STREAM).body(response, Long.class);
}
catch (Exception e) {
return ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR).body(Mono.just("FAIL BY " + e), String.class);
}
});
}
After start I saw that the number of current established TCP connection was increasing continuously (I have a server monitor tool) and reached to several thousand connection for one day.
I avoid this problem by using Spring MVP Web instead at the present time. It worked, the number of connection is always around 120.
Anyone can explain to me why Webflux keeps income connections like that. Please help! :(
Upvotes: 1
Views: 1079