Web application outputting a very large sequence of items produced by a Flux<Item>, serialized as JSON.
Observed Results
When using Spring Web Reactive in a Spring Boot 2.0.0 (snapshot) application and comparing execution times between Jetty and other server options like Tomcat or Undertow, Jetty is considerably slower than the other two, being this difference increased with the length of the sequence of items being returned by the Flux<Item> publisher being returned by the @Controller method.
Compare Jetty (intro being hit during curl execution to see the data transfer flow):
The above applications replicate the scenario using Spring Boot 2.0.0 apps with Jetty, Netty, RxNetty, Tomcat and Undertow. Note this application also tests other issues (specified in separate tickets).
Please have a look at the detailed test explanation at the linked repository's README
With stacktrace mode disabled, I got the following results with Jetty slightly more performant than Tomcat:
curl http://localhost:8084/items/1000000 > out.tomcat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 236M 0 236M 0 0 7047k 0 --:--:-- 0:00:34 --:--:-- 7076k
curl http://localhost:8081/items/1000000 > out.jetty
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 236M 0 236M 0 0 9829k 0 --:--:-- 0:00:24 --:--:-- 9826k
$ curl http://localhost:8084/items/1000000 > out.tomcat
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 236M 0 236M 0 0 6315k 0 --:--:-- 0:00:38 --:--:-- 6323k
$ curl http://localhost:8081/items/1000000 > out.jetty
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 236M 0 236M 0 0 8516k 0 --:--:-- 0:00:28 --:--:-- 8733k
Daniel Fernández opened SPR-14945 and commented
Scenario
This is the scenario:
Flux<Item>
, serialized as JSON.Observed Results
When using Spring Web Reactive in a Spring Boot 2.0.0 (snapshot) application and comparing execution times between Jetty and other server options like Tomcat or Undertow, Jetty is considerably slower than the other two, being this difference increased with the length of the sequence of items being returned by the
Flux<Item>
publisher being returned by the@Controller
method.Compare Jetty (intro being hit during
curl
execution to see the data transfer flow):With Tomcat:
Or with Undertow:
Also note that this happens both when returning JSON arrays and SSE (Server-Sent Events).
Example applications
Example applications: https://github.com/danielfernandez/test-spring-boot-reactive-netty-output
The above applications replicate the scenario using Spring Boot 2.0.0 apps with Jetty, Netty, RxNetty, Tomcat and Undertow. Note this application also tests other issues (specified in separate tickets).
Please have a look at the detailed test explanation at the linked repository's
README
Affects: 5.0 M3
Reference URL: https://github.com/danielfernandez/test-spring-boot-reactive-netty-output
Issue Links:
The text was updated successfully, but these errors were encountered: