Closed sreeram-dev closed 1 month ago
HI, Thanks for your suggestion. It is certainly possible. I did not implement it since Spring Boot suggests using WebClient instead of RestTemplate (in case that is the class you were referring to) as its preferred HTTP client for reactive and non-reactive stacks alike. Plus WebClient has a lot of test benefits in conjunction with WebTestClient.
I currently don't intend to extend the test in this direction due to time constraints, but if you would be willing to extend the project in a way that preserves the current functionality, I would certainly consider merging any PR.
https://docs.spring.io/spring-framework/reference/integration/rest-clients.html#rest-restclient
Spring Framework introduced a new client - RestClient - synchronous request handling with java fluent API.
I will look into the project.
Thanks for the link and for investigating this extension. I have not used RestClient
before and I agree it would be interesting to compare it with the blocking use of WebClient
in one of the non-reactive approaches such as loom-netty
or loom-tomcat
.
A relatively seamless way of adding RestClient
as alternative to the currently used WebClient
would be to create a new Spring Boot profile, e.g. restclient
. If it is activated, line https://github.com/chrisgleissner/loom-webflux-benchmarks/blob/3260f21f2077cd4aea58d4afe5b530b233b7e21a/src/main/java/uk/gleissner/loomwebflux/common/AbstractService.java#L35 could use a RestClient
insted of a WebClient
.
A row in a scenarios CSV file can specify any number of Spring Boot profiles. I.e. after this code change, you could then simply create a new scenarios.csv
file - e.g. src/main/scenarios/scenarios-restclient.csv
- and specify the newly created profile in there. There are some examples for this in the codebase.
Just some ideas. Feel free to use another approach as long as it preserves the existing functionality and is well-tested.
Thanks again.
Hi @sreeram-dev , I have now a PR open for the feature you suggested: https://github.com/chrisgleissner/loom-webflux-benchmarks/pull/21
Merged PR
The results for scenarios-clients.csv
have been added to the main
branch. The RestClient
based on Reactor Netty performed particularly well.
In the benchmark, It is currently noted that all approaches use WebClient.
Is it possible to add an additional scenario - Spring Rest Client with Virtual Threads?