Provide documentation on when to use the MVC and when to use the WebFlux variant
Is your feature request related to a problem? Please describe.
I think there should be documentation providing reasons for why one would choose the MVC over the WebFlux variant or vice versa.
Describe the solution you'd like
A document with the pros and cons; mentioning developer experience, deployment, operational, and performance implications.
Describe alternatives you've considered
I cannot find any good information other than "some people do not want Netty"/"it's newer".
Additional context
An official performance comparison between the two variants is not strictly part of this PR but it would be nice to have regardless:
https://github.com/spring-cloud/spring-cloud-gateway/issues/3058 https://github.com/spring-cloud/spring-cloud-gateway/issues/2067 https://github.com/spencergibb/spring-cloud-gateway-bench
These do not mention why one would choose one over the other:
Getting Started with Spring Cloud Gateway Spring Cloud Gateway/Introduction
We are in the process of trying to make this determination. We have noticed the advantages that currently exist in WebFlux that are not available (yet?) in MVC. Documentation is also more comprehensive in WebFlux. I think some guidelines around these types of criteria balanced against the trajectory of development on the MVC side would be very useful
We are in the process of trying to make this determination. We have noticed the advantages that currently exist in WebFlux that are not available (yet?) in MVC. Documentation is also more comprehensive in WebFlux. I think some guidelines around these types of criteria balanced against the trajectory of development on the MVC side would be very useful
Also please also improve the API doc, e.g I just opened this route configuration in my project:
@Bean
RouterFunction<ServerResponse> userServiceRoute() {
return route("user_route")
.route(path("/users/**"), http("http://localhost:8086"))
.before(rewritePath("/users/(?<segment>.*)", "/${segment}"))
.build();
}
and I saw that http("http://localhost:8086") is deprecated.
Usually when an API is deprecated the documentation indicates the alternative to use but we simply have:
// TODO: current discovery only goes by method name
// so last one wins, so put parameterless last
@Deprecated
public static HandlerFunction<ServerResponse> http(String uri) {
return http(URI.create(uri));
}
@akuma8 please open a new issue for that, so this one can stay focused. There is a new before filter called uri().
There are numerous reasons to use one over the other: webflux is more mature by years, webmvc has a simpler programming model, some companies require a servlet container (or a specific one like tomcat), webmvc is still missing a few features. Choosing one over the other depends on your requirements.