title: Does Reactive programming consumes more resources than non-reactive?
body: <p>We are currently facing a performance issue with spring webFlux.
  For the sake of ascertaining the benefits of the reactive programming we have implemented a Spring Boot service which fetches data from a MongoDB and returns it via a REST API to the consumers.</p>
  
  <p>The service exists in two variants:</p>
  
  <ol>
  <li>A non-reactive implementation with Spring Boot, MongoRepository. This service returns the data as List</li>
  <li>A reactive implementation with Spring Boot, ReactiveMongoRepository, spring-boot-starter-webflux. This service returns the data as Flux.</li>
  </ol>
  
  <p>In both implementations the REST controller directly fetches the data from the repository and returns it as List resp. as Flux. No further application logic is executed.</p>
  
  <p>We conducted a small load/performance test with 100 users calling the service and we found out that the non-reactive implementation performed far better than the reactive implementation.</p>
  
  <p>As a matter of fact, not only had the non-reactive implementation a better HTTP throughput but, perhaps more interestingly, it consumed less CPU and less threads than the reactive implementation!
  This was particularly counter to expectations since we anticipated the reactive version to scale with a small number of thread as mentioned in <a href="https://spring.io/blog/2016/07/28/reactive-programming-with-spring-5-0-m1" rel="nofollow noreferrer">https://spring.io/blog/2016/07/28/reactive-programming-with-spring-5-0-m1</a></p>
  
  <p>Is there something we need to tweak in the settings?</p>
  
  <p>Has someone faced a similar issue?</p>