<div class="__aliyun_email_body_block"><div  style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun"><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Previously, <a  href="https://bugs.openjdk.org/browse/JDK-8349763" target="_blank">I intended to propose adding more params for configuring virtual thread scheduling</a>. However, after carefully reading the code, I realized that in the FJP (ForkJoinPool) initialization, the corePoolSize is not actually used. I think it would be best to either remove this parameter or at least update the parameter description comment to reduce confusion for readers. </span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><img  height="760" src="cid:__aliyun173987029020175331" width="961" style="vertical-align: bottom"><img  height="148" src="cid:__aliyun173987029020175332" width="759" style="vertical-align: bottom"></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">In addition, I conducted some experiments and found that creating threads in the FJP actually does not cause significant fluctuations (approximately around 1ms). The phenomenon I encountered was actually caused by the unfair scheduling of the unpark operation. </span><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">When a virtual thread is suspended and more tasks arrive, then more tasks may wait to be awakened. The </span><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">first </span><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">virtual thread task that choose to yield may not be given execution thread resources with priority. This will increase the latency of a request, e<span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">specially under high CPU utilization</span>. I hope this part could be improved. I provide some data below. (<span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Tasks simulate a yield scenario through sleep(100)</span>. The whole execution time is about 102ms when using a normal java thread.)</span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">high CPU:</span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">[Thread-name taskid:calc-result time(ms): used-time]</span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">VirtualThread[#25]/runnable@ForkJoinPool-1-worker-4 1:495000 time(ms): 177.633408<br ></span><div  style="clear: both;">VirtualThread[#26]/runnable@ForkJoinPool-1-worker-6 2:495000 time(ms): 183.056113<br ></div><div  style="clear: both;">VirtualThread[#27]/runnable@ForkJoinPool-1-worker-6 3:495000 time(ms): 191.993923<br ></div><div  style="clear: both;">vtTimes Statistics:<br ></div><div  style="clear: both;">Mean: 132.19690011333338<br ></div><div  style="clear: both;">P50: 123.7981245<br ></div><div  style="clear: both;">P90: 164.3613794<br ></div><div  style="clear: both;">P99: 170.36093036999995<br ></div><div ><span >Max: 191.993923</span></div><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">VirtualThread[#25]/runnable@ForkJoinPool-1-worker-6 1:495000 time(ms): 185.086663<br ></span><div  style="clear: both;">VirtualThread[#26]/runnable@ForkJoinPool-1-worker-4 2:495000 time(ms): 194.068939<br ></div><div  style="clear: both;">VirtualThread[#27]/runnable@ForkJoinPool-1-worker-4 3:495000 time(ms): 203.031132<br ></div><div  style="clear: both;">vtTimes Statistics:<br ></div><div  style="clear: both;">Mean: 116.19142947333329<br ></div><div  style="clear: both;">P50: 104.2598835<br ></div><div  style="clear: both;">P90: 161.2748723<br ></div><div  style="clear: both;">P99: 185.14847699999993<br ></div><div ><span >Max: 203.031132</span></div><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">low CPU</span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;">vtTimes Statistics:<br ></span><div  style="clear: both;">Mean: 119.62772587666666<br ></div><div  style="clear: both;">P50: 120.145596<br ></div><div  style="clear: both;">P90: 123.3764946<br ></div><div  style="clear: both;">P99: 125.27045233<br ></div><div ><span >Max: 126.963864</span></div><div ><span ><br ></span></div><div ><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">From the data, we can see that the tasks which yielded <span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">earliest</span> are only awakened and resumed at the very end, resulting in long latencies.</span></div><div ><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"><br ></span></div><div ><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">Besides, <span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">I’m wondering if we could reduce latency issues under high pressure by increasing the number of threads available for executing tasks. <span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">It's a commonly used method when combining </span><strong  style="box-sizing: border-box; font-weight: 400; color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">ThreadPoolExecutor</strong><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;"> with a </span><strong  style="box-sizing: border-box; font-weight: 400; color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">SynchronousQueue</strong><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: 0.08px; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; white-space: pre-wrap; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; float: none; display: inline !important;">.</span><span ></span></span></span></div><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div><div  style="clear: both;"><span  style="color: rgb(44, 44, 54); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-size: 16px; letter-spacing: 0.08px; white-space-collapse: preserve;"><br ></span></div></div></div>