<p>Small question regarding a Java 11 Spring Webflux 2.6.6+ web app, containerized and deployed using Kubernetes please.</p>
<p>From the web app application logs, I am seeing things such as:</p>
<pre><code>INFO [service,1bcce5941c742568,22c0ab2133c63a77] 11 --- [or-http-epoll-2] a.b.c.SomeClass  : Some message from the reactive pipeline.
INFO [service,67cb40974712b3f4,15285d01bce9dfd5] 11 --- [or-http-epoll-4] a.b.c.SomeClass  : Some message from the reactive pipeline.
INFO [service,5011dc5e09de30b7,f58687695bda20f2] 11 --- [or-http-epoll-3] a.b.c.SomeClass  : Some message from the reactive pipeline.
INFO [service,8046bdde07b13261,5c30a56a4a603f4d] 11 --- [or-http-epoll-1] a.b.c.SomeClass  : Some message from the reactive pipeline.
</code></pre>
<p>And always, I can only see <code>[or-http-epoll-1] [or-http-epoll-2] [or-http-epoll-3] [or-http-epoll-4]</code> which I think stands for: <code>[reactor-http-epoll-N]</code></p>
<p>The problem is, no matter how much CPU I allocate from Kubernetes, it is always those 4, no less, no more.</p>
<p>I tried:</p>
<pre><code>  resources:
            requests:
              cpu: 1
              memory: 1G
            limits:
              cpu: 2
              memory: 2G

  resources:
            requests:
              cpu: 4
              memory: 4G
            limits:
              cpu: 6
              memory: 6G

  resources:
            requests:
              cpu: 10
              memory: 10G
            limits:
              cpu: 10
              memory: 10G

</code></pre>
<p>But again, always only those 4.</p>
<p>I am having a hard time understanding what is the problem here, and why am I stuck with only/always 4 &quot;or-http-epoll-&quot;.</p>
<p>Thank you</p>

PatPanda
<p>By default WebFlux uses Netty as an underlining web server. Here is how Netty determine number of threads in the pool <a href="https://github.com/reactor/reactor-netty/blob/main/reactor-netty-core/src/main/java/reactor/netty/resources/LoopResources.java#L41" rel="nofollow noreferrer">Netty - LoopResources</a></p>
<pre><code>/**
* Default worker thread count, fallback to available processor
* (but with a minimum value of 4)
*/
int DEFAULT_IO_WORKER_COUNT = Integer.parseInt(System.getProperty(
    ReactorNetty.IO_WORKER_COUNT,
    &quot;&quot; + Math.max(Runtime.getRuntime().availableProcessors(), 4)));
</code></pre>
<p>The next question, what is the current <code>Runtime.getRuntime().availableProcessors()</code>?</p>
<p>It depends on Java version. Until Java version 10, application on Docker sees CPU on the machine and not inside the container.</p>
<p>You could create a simple Java application to validate</p>
<pre><code>class TestCpu {
    public static void main(String[] args) {
       int processors = Runtime.getRuntime().availableProcessors();
       System.out.println(&quot;CPU cores: &quot; + processors);
  }
}
</code></pre>
