Threading issues

How to fix this threading issue that exists only on Windows? https://spark.lucko.me/FlCb0anrpw
spark
spark is a performance profiler for Minecraft clients, servers, and proxies.
No description
No description
17 Replies
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @oakwookoak! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st3w ago
What about that would be an issue? It tells you that most threads are waiting most of the time meaning there is no work these threads have to do which is perfectly fine
oakwookoak
oakwookoakOP3w ago
server suffers huge server lag spikes because we have to wake up sleeping io threads example: we have one sudden job to complete and io threads are sleeping at this moment
dan1st
dan1st3w ago
Sure that waking up these threads is the issue? and not it just doing other work before waking up the threads? If so, what makes you sure?
oakwookoak
oakwookoakOP3w ago
well, i have to apologize first, im not a dev. additional information: we added spinwait in order to fix world saving times on windows, but this introduced mspt spikes when opening loot chest in shipwreck which contains treasure map and we reverted it.
// attempt to spin-wait before sleeping
if (!pollTasks()) {
Thread.interrupted(); // clear interrupt flag
for (int i = 0; i < 5000; i ++) {
if (pollTasks()) continue main_loop;
LockSupport.parkNanos("Spin-waiting for tasks", 10_000); // 100us
}
}
// attempt to spin-wait before sleeping
if (!pollTasks()) {
Thread.interrupted(); // clear interrupt flag
for (int i = 0; i < 5000; i ++) {
if (pollTasks()) continue main_loop;
LockSupport.parkNanos("Spin-waiting for tasks", 10_000); // 100us
}
}
dan1st
dan1st3w ago
What's mspt?
oakwookoak
oakwookoakOP3w ago
millisecond per tick
dan1st
dan1st3w ago
oh some Minecraft specific thing How are you currently waiting for tasks?
oakwookoak
oakwookoakOP3w ago
budget is 50ms and it completes in 7 seconds
oakwookoak
oakwookoakOP3w ago
probably show the code would be the best option for me... https://github.com/RelativityMC/FlowSched/tree/491bc6a731b724d44072bfb7d51eea3433214cb6
GitHub
GitHub - RelativityMC/FlowSched at 491bc6a731b724d44072bfb7d51eea34...
A collection of scheduling implementations for Java - GitHub - RelativityMC/FlowSched at 491bc6a731b724d44072bfb7d51eea3433214cb6
dan1st
dan1st3w ago
Why aren't you just using ExecutorService to submit tasks? These are well-tested performant ways to manage tasks With that, you can use PriorityBlockingQueue for ensuring priorities
oakwookoak
oakwookoakOP3w ago
because it is too basic for us
dan1st
dan1st3w ago
What capabilities are you missing? As I said, you can make it use priorities
oakwookoak
oakwookoakOP3w ago
it got rejected for an unknown reason for me message search shows last PriorityBlockingQueue reference has been written in 2021
dan1st
dan1st3w ago
If you want an efficient implementaton, use ExecutorService
JavaBot
JavaBot3w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
JavaBot
JavaBot3w ago
Post Closed
This post has been closed by <@1170276321138593886>.

Did you find this page helpful?