-
Notifications
You must be signed in to change notification settings - Fork 3k
[erts] Scheduler pollset migration only when single process enif_select #10323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: maint
Are you sure you want to change the base?
[erts] Scheduler pollset migration only when single process enif_select #10323
Conversation
CT Test Results 3 files 135 suites 49m 22s ⏱️ Results for commit c89cbee. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
|
This looks promising. I pushed two minor fixups. |
|
@sverker Yes, we tested the patches today and all the issues we were seeing appear to have been resolved. |
0b47de1 to
c89cbee
Compare
|
I rebased-squashed it for inclusion into maint (OTP-28.2). |
|
@sverker Some additional information: we've noticed a latency regression when at high CPU utilization (90%+) that seems to be due to scheduler slowdown from the large number of pollset entries per scheduler. I'll draw some ASCII art in a separate comment... |
|
@sverker Alright, so before scheduler pollsets, my understanding is that this is roughly what was happening: At high load, all of the pollset operations are still isolated to the I/O event loop and won't uniformly slow down the schedulers when there are a really large number of file descriptors in the pollsets. With the new scheduler pollset feature, we have this: First off: is this an accurate view of how this works? We tested a version of OTP where If all of this is correct, would it make sense to have a For small number of sockets, the scheduler pollset optimization should provide more of a benefit, I would think. Maybe something like: socket:setopt(Socket, {otp, scheduler_polling}, false).What do you think? |
|
There is one scheduler pollset, namely You can disable scheduler pollset with If an option would be necessary, I would prefer something less implementation specific than |
Potential fix for #10322
If I'm understanding what happens when scheduler pollset migration gets triggered: once the
state->count++ > 10, we migrate the "hot fd" to the scheduler pollset.However, the
state->count++is global, so if there are multiple processes all callingsocket:acceptat the same time, thenstate->count++ > 10could be triggered almost immediately.For things like
socket:recv, this generally would work as expected since there is typically one process calling this in a loop.However, for
socket:accept, it's more of a common practice to have multiple processes all trying to accept inbound connections.If all of that's correct, then this is my assumption:
The change here is to add a
state->last_select_pidfield and reset thestate->count = 0if we detect that the process has changed between calls toenif_select.