<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
On 18/02/2025 09:18, 唐佳未(佳未) wrote:<br>
<blockquote type="cite" cite="mid:58f43a55-ec2f-4f6d-8567-8e7d0d307c8f.tjw378335@alibaba-inc.com">
<div class="__aliyun_email_body_block">
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun">:
<div style="clear: both;">
<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;">
</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>
</div>
</blockquote>
<br>
In FJP, each worker thread owns a local queue. A worker thread
executes the tasks in its local queue before scanning other queues
for work.<br>
<br>
There are unowned submission queues that are used when for tasks
submitted by (mostly) platform threads. If a platform thread unparks
a virtual thread (for example, a platform thread in the TPE uses a
SQ to rendezvous with a virtual thread in your scenario, then the
task for the virtual thread will be pushed to one of these unowned
submission queues. Same thing if there is a timeout, the task to
continue the virtual thread will be pushed to an unowned submission
queue.<br>
<br>
My reading of your mail is that a virtual thread is calling
Thread.sleep and you are measuring the time until it continues. In
the "high CPU" case it may be that FJP workers only execute tasks in
their local queue so they don't scan the unowned submission queues
very often, is this what you are seeing? With the JDK 24 EA builds
it would be useful to execute `jcmd <pid>
Thread.vthread_scheduler` a few times to gets some stats as I think
this would help the discussion.<br>
<br>
-Alan<br>
<br>
</body>
</html>