<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 14/08/2024 12:59 am, robert engels
wrote:<br>
</div>
<blockquote type="cite" cite="mid:A7EE2399-1177-49B1-B6EE-229FD46B88B3@icloud.com">
<div dir="ltr">Surprisingly, lowering the priority of the carrier
threads did not result in the same performance gains as reducing
the parallelism.<br>
</div>
</blockquote>
<p>To change priorities you also need to set ThreadPriorityPolicy=1</p>
<p><br>
</p>
<p> product(int, ThreadPriorityPolicy,
0, \<br>
"0 :
Normal. "\<br>
" VM chooses priorities that are appropriate for
normal "\<br>
"
applications. "\<br>
" On Windows applications are allowed to use higher
native "\<br>
" priorities. However, with ThreadPriorityPolicy=0,
VM will "\<br>
" not use the highest possible native
priority, "\<br>
" THREAD_PRIORITY_TIME_CRITICAL, as it may interfere
with "\<br>
" system threads. On Linux thread priorities are
ignored "\<br>
" because the OS does not support static priority
in "\<br>
" SCHED_OTHER scheduling class which is the only
choice for "\<br>
" non-root, non-realtime
applications. "\<br>
"1 :
Aggressive. "\<br>
" Java thread priorities map over to the entire range
of "\<br>
" native thread priorities. Higher Java thread
priorities map "\<br>
" to higher native thread priorities. This policy
should be "\<br>
" used with care, as sometimes it can cause
performance "\<br>
" degradation in the application and/or the entire
system. On "\<br>
" Linux/BSD/macOS this policy requires root privilege
or an "\<br>
" extended
capability.") \<br>
range(0,
1) \<br>
</p>
<p>David<br>
-------<br>
</p>
<p><br>
</p>
<blockquote type="cite" cite="mid:A7EE2399-1177-49B1-B6EE-229FD46B88B3@icloud.com">
<div dir="ltr">
<blockquote type="cite">On Aug 13, 2024, at 7:33 AM, Alan
Bateman <a class="moz-txt-link-rfc2396E" href="mailto:Alan.Bateman@oracle.com"><Alan.Bateman@oracle.com></a> wrote:<br>
<br>
</blockquote>
</div>
<blockquote type="cite">
<div dir="ltr"> On 13/08/2024 12:25, Robert Engels wrote:<br>
<blockquote type="cite" cite="mid:5040C3A9-CD49-4B20-864C-80CB7166637F@icloud.com">
:
<div class="">
<div><br class="">
</div>
<div>Using VT pollers (pollerMode=2) and default
parallelism:</div>
<div><br class="">
</div>
<div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">robertengels@macmini go-wrk % wrk -H
'Host: imac' -H 'Accept:
text/plain,text/html;q=0.9,application/xhtml+xml;q=0.9,application/xml;q=0.8,*/*;q=0.7'
-H 'Connection: keep-alive' --latency -d 20 -c 1000
--timeout 8 -t 8 <a href="https://urldefense.com/v3/__http://imac:8080/plaintext__;!!ACWV5N9M2RV99hQ!OSop_Xwpde2E9iW4xAOJ-iUfPMQ4NDkHxIr3S7UmvlgiGk94boiQLh9ZO6Btn1uwp6HY3TYdhv9yzjU8$" class="" moz-do-not-send="true">http://imac:8080/plaintext</a></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Running 20s test @ <a href="https://urldefense.com/v3/__http://imac:8080/plaintext__;!!ACWV5N9M2RV99hQ!OSop_Xwpde2E9iW4xAOJ-iUfPMQ4NDkHxIr3S7UmvlgiGk94boiQLh9ZO6Btn1uwp6HY3TYdhv9yzjU8$" class="" moz-do-not-send="true">http://imac:8080/plaintext</a></span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 8 threads and 1000 connections</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Thread Stats Avg Stdev Max
+/- Stdev</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Latency 66.76ms 137.25ms 1.70s
87.06%</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Req/Sec 14.38k 2.36k 21.94k
75.88%</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Latency Distribution</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 50% 4.74ms</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 75% 51.68ms</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 90% 263.08ms</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 99% 664.99ms</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> 2289858 requests in 20.02s, 310.10MB read</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Socket errors: connect 0, read 2135,
write 7, timeout 0</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Requests/sec: 114360.91</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo; color: rgb(0, 0, 0); font-size: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Transfer/sec: 15.49MB</span></div>
</div>
<div><br class="">
</div>
<div>and the same 8% idle.</div>
<div><br class="">
</div>
<div>So I am pretty sure my hypothesis is correct. I may
try and build a Loom / use a library to lower priority
of the carrier threads. I suspect I will see similar
performance to the reduced parallelism case.</div>
</div>
</blockquote>
<br>
With -Djdk.pollerMode=2 then the poller threads are virtual
threads and so run on the same carrier. You'll need to play
with -Djdk.readPollers=N as there isn't a good default for
this on macOS.<br>
<br>
-Alan.<br>
</div>
</blockquote>
</blockquote>
</body>
</html>