Remove QoS throttle on MacOS
Opened 19 months ago
Last modified 18 months ago
#2625assigneddefect
Remove QoS throttle on MacOS
Reported by:joggerOwned by:Meeh Priority: minor Milestone: undecided Component: installer Version: 0.9.42 Keywords:
Cc: Zlatin Balevsky Parent Tickets:
Sensitive: no
Description
We must reverse the change made by #1430, which lacked proper research.
Read everything here: https://arstechnica.com/gadgets/2013/10/os-x-10-9/13/
Long story short: The scheduler batches together activations of our threads. There are > 20ms pauses which can be seen as DELAYED on the /jobs page. Apps without a gui default to much lower scheduler priority even on an idle machine. taskinfo reports for i2p:
effective policy
eff role: TASK_UNSPECIFIED (PRIO_DARWIN_ROLE_DEFAULT)
eff latency qos: LATENCY_QOS_TIER_UNSPECIFIED
eff thruput qos: THROUGHPUT_QOS_TIER_UNSPECIFIED
with a gui we get:
effective policy
eff role: TASK_BACKGROUND_APPLICATION (PRIO_DARWIN_ROLE_UI_NON_FOCAL)
eff latency qos: LATENCY_QOS_TIER_0
eff thruput qos: THROUGHPUT_QOS_TIER_0
A short test with two threads looping endlessly over locking the same object confirmed this. 20% average CPU from the command line, 45% CPU when put into a Swing Hello World app.
Removing the awt.headless from the i2prouter script resulted in 30% more CPU allocated and less idle wakeups, so i2p was getting longer batches of runtime. Also saw a bit more traffic and more participating tunnels.
This is still not perfect, it just reduces the occurrence of those ultra-long pauses.