<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I am working on optimizing a web server design for virtual threads. The test essentially hits an endpoint and returns a string. As written, after sending the string it performs a flush() - most likely sending lots of very small tcp packets. The client from another machine uses concurrent overlapping connections.</div><div class=""><br class=""></div><div class="">It you look at the attached profile (captured with the Java async profiler), you can see that the vast majority of the time is spent in the scheduler - often waiting for work.</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> ns percent samples top</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> ---------- ------- ------- ---</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 927730000 17.50% 92773 write</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 865420000 16.32% 86542 __psynch_cvwait</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 664940000 12.54% 66494 kevent</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 532900000 10.05% 53290 swtch_pri</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 324830000 6.13% 32483 read</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 221610000 4.18% 22161 __psynch_cvsignal</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 98940000 1.87% 9894 java.util.concurrent.ForkJoinPool.awaitWork</span></font></div><div class=""><font face="Courier New" class=""><span style="font-style: normal;" class=""> 58630000 1.11% 5863 jdk.internal.misc.Unsafe.park</span></font></div></div><div class=""><br class=""></div><div class="">The read & write are expected but I was surprised at how much time is attributed to the scheduler.</div><div class=""><br class=""></div><div class="">With the virtual thread per task executor, this represented:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""> Thread Stats Avg Stdev Max +/- Stdev</div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> Latency 14.63ms 5.36ms 239.72ms 97.28%</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""> Req/Sec 1.12k 140.56 5.07k 89.83%</span></div></div></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Requests/sec: 71064.54</span></div><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Transfer/sec: 9.62MB</span></div></div></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-stretch: normal; font-size: 18px; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span></div></body></html>