Skip to content

-XX:ActiveProcessorCount doesn't limit the number of available cores as we might think #73

@franz1981

Description

@franz1981
  • On quarkus 3 (without RunOnVirtualThread): -XX:ActiveProcessorCount wont't constrain the size of our (blocking) worker pool using platform threads, allowing it to consume more than the suggested number of processors
  • On quarkus 3 with RunOnVirtualThread: -XX:ActiveProcessorCount correctly enforce the Loom ForkJoin pool handling VirtualThreads to be sized correctly (in term of platform threads). This won't still honor the suggested number of processors, because we internally size the Netty event loop count equal to the number of cores (i.e -XX:ActiveProcessorCount) meaning that the total number of threads is -XX:ActiveProcessorCount * 2 (i.e. event loop count + loom fork join pool + GC threads + compiler threads) > -XX:ActiveProcessorCount
  • On Spring assuming they uses virtual threads, tomcat fully run it, and they handle blocking calls there too, meaning that the total number of platform threads honor -XX:ActiveProcessorCount

This is not correct and should be fixed.

2 suggestions here:

  1. constrain the core count for real e,g, using taskset on linux
  2. practice active benchmarking to detect CPU usage beyong what's expected (e.g. by proving pidstat output vs the server)

I know that is a bit against the purpose of keep the stress test simple, but without both this can lead to very wrong and broken results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions