6.26.1 Configuring Server Thread Pools

The HTTP server is built on Netty which is designed as a non-blocking I/O toolkit in an event loop model.

To configure the number of threads used by the Netty EventLoop, you can use application.yml:

Configuring Netty Event Loop Threads

  1. micronaut:
  2. server:
  3. netty:
  4. worker:
  5. threads: 8 # number of netty worker threads
The default value is the value of the system property io.netty.eventLoopThreads or if not specified the available processors x 2

When dealing with blocking operations, Micronaut will shift the blocking operations to an unbound, caching I/O thread pool by default. You can configure the I/O thread pool using the ExecutorConfiguration named io. For example:

Configuring the Server I/O Thread Pool

  1. micronaut:
  2. executors:
  3. io:
  4. type: fixed
  5. nThreads: 75

The above configuration will create a fixed thread pool with 75 threads.