Here's what's in my head: having everything reactive is actually an utopia.
Everyone of us need to talk to external providers (or just suppose we don't have a reactive driver for mysql/mongodb whatevah).
So I said: I want to achieve the minimum goal which is having the same number of
request per second. I tried with just CompletableFuture
because I know we have
AsyncRestTemplate
that we can use with DeferredResult
.
Given the same number of threads for:
ExecutorService
on the nonblocking exampleserver.tomcat.max-threads=500
on the blocking example
With the same Gatling tests I got this results:
NORMAL
================================================================================
---- Global Information --------------------------------------------------------
> request count 500 (OK=500 KO=0 )
> min response time 6574 (OK=6574 KO=- )
> max response time 14832 (OK=14832 KO=- )
> mean response time 9861 (OK=9861 KO=- )
> std deviation 2694 (OK=2694 KO=- )
> response time 50th percentile 10058 (OK=10058 KO=- )
> response time 75th percentile 10272 (OK=10272 KO=- )
> response time 95th percentile 14615 (OK=14615 KO=- )
> response time 99th percentile 14650 (OK=14650 KO=- )
> mean requests/sec 31.25 (OK=31.25 KO=- )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms 0 ( 0%)
> 800 ms < t < 1200 ms 0 ( 0%)
> t > 1200 ms 500 (100%)
> failed 0 ( 0%)
================================================================================
COMPLETABLE FUTURE
================================================================================
---- Global Information --------------------------------------------------------
> request count 500 (OK=500 KO=0 )
> min response time 7016 (OK=7016 KO=- )
> max response time 15416 (OK=15416 KO=- )
> mean response time 10438 (OK=10438 KO=- )
> std deviation 2772 (OK=2772 KO=- )
> response time 50th percentile 10485 (OK=10485 KO=- )
> response time 75th percentile 10868 (OK=10868 KO=- )
> response time 95th percentile 15357 (OK=15357 KO=- )
> response time 99th percentile 15398 (OK=15398 KO=- )
> mean requests/sec 31.25 (OK=31.25 KO=- )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms 0 ( 0%)
> 800 ms < t < 1200 ms 0 ( 0%)
> t > 1200 ms 500 (100%)
> failed 0 ( 0%)
================================================================================
As you can see I reached the same number of requests per seconds.
The nonblocking example has a little increment in timings
but that's expected because of the overhead of the CompletableFuture
+ DeferredResult
(I guess?).
So my question is: given the constraint of exposing the "blocking service" via rest resource, is there
a way to use Flux
over https in some way?