title: Threading model of Spring WebFlux and Reactor
body: <p>Currently experimenting reactive programming with <strong>Spring 5.0.0.RC2</strong>, <strong>Reactor 3.1.0.M2</strong> and <strong>Spring Boot 2.0.0.M2</strong>.</p>
  
  <p>Wondering about the <strong>concurrency and threading model</strong> used by WebFlux and Reactor to properly code the application and handle the mutable state.</p>
  
  <p>The Reactor doc states that the library is considered concurrency agnostic and mentions the Scheduler abstraction. The WebFlux doc does not give information.</p>
  
  <p>Yet when using WebFlux through Spring Boot, a threading model is defined.</p>
  
  <p>From my experimentations here is what I got:</p>
  
  <ul>
  <li>The model is neither 1 event thread, nor 1 event thread + workers</li>
  <li>Several thread pools are used</li>
  <li>"<em>reactor-http-nio-3</em>" threads: probably one per core, handle the incoming HTTP requests</li>
  <li>"<em>Thread-7</em>" threads: used by async requests to MongoDB or HTTP resources</li>
  <li>"<em>parallel-1</em>" threads: one per core, created by Schedulers.parallel() from Reactor, used by delay operators and such</li>
  <li>Shared mutable state must be synchronized by the application</li>
  <li>ThreadLocal (for application state, MDC logging, etc) are not request scoped, so are not very interesting</li>
  </ul>
  
  <p>Is this correct ? What is the concurrency and threading model of WebFlux: for example what are the default thread pools?</p>
  
  <p>Thank you for the information</p>