your image was dropped :((
please use some image image service and provide the URL here :))

On Tue, 21 Jan 2025 at 16:40, Owner <o8076...@gmail.com> wrote:

> Hey Tomcat,
>
> Andy here. I'm not sure if this is the place to ask this question, but I
> wanted to check regarding performances of virtual threads vs using a
> conventional worker thread pool.
>
> I set up an endpoint with a CPU task of calculating factorials like the
> below:
>
> @GetMapping("/fullCPU")
>     public void allCPU() throws InterruptedException {
>         factorialCalculator();
>     }
>
> public void factorialCalculator() {
>         int numberOfOperations = 35;
>         BigInteger factorial = BigInteger.ONE;
>         int n = 4000;
>         for (int i = 1; i <= numberOfOperations; i++) {
>             for (int j = 1; j <= n; j++) {
>                 factorial = factorial.multiply(BigInteger.valueOf(j));
>             }
>             factorial = BigInteger.ONE;
>         }
>
> When enabling virtual threads (using spring.virtual.threads.enabled with
> Tomcat 10.1.33), the results I get are as follows. I utilise JMeter to do
> stress testing -
> [image: image.png]
> Is there a reason why for CPU tasks, the performance for virtual threads
> is so much worse? Theoretically both virtual threads and platform threads
> should take the same amount of CPU time right?
>
> Thank you!
>
> Regards,
> Andy
>


-- 
Best regards,
Maxim

Reply via email to