-
Notifications
You must be signed in to change notification settings - Fork 3k
[erts][socket] Add {otp, scheduler_polling} option #10336
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
[erts][socket] Add {otp, scheduler_polling} option #10336
Conversation
CT Test Results 4 files 196 suites 1h 53m 59s ⏱️ For more details on these failures, see this check. Results for commit 39c0f96. ♻️ 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 |
6d43492 to
1e68e98
Compare
1e68e98 to
39c0f96
Compare
| - **`scheduler_polling`** - `t:boolean/0` \- | ||
| On platforms with scheduler polling support, controls whether this socket's | ||
| file descriptor may be automatically migrated to a scheduler-specific pollset | ||
| after 10+ consecutive select operations from the same process. | ||
|
|
||
| Default: `true` on platforms with support, `false` otherwise. | ||
|
|
||
| Set to `false` to disable migration for sockets accessed by multiple processes | ||
| (e.g., listening socket with multiple acceptor processes). | ||
|
|
||
| On platforms without scheduler polling support, attempting to set to `true` | ||
| returns `{error, enotsup}`. Setting to `false` is always allowed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we already have a config, I wonder if it would make more sense to make this config the count, rather than true/false with an "arbitrary" count of 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would users know when to enable this option?
Some docs or guidance for it could help, something like, "if you have these many sockets of this type, you might benefit from it" or "if you enable this you'll increase your latency but improve throughput" etc.
Maybe there is a way to automatically set this behind the scenes, based on some heuristic (socket is accepting vs receiving moslty)?
I think this option only made sense at the time due to my then misunderstanding of how scheduler pollset worked (specifically: I thought there was a pollset per scheduler, not a singular global scheduler pollset). Thanks to @sverker's clarification, I don't think this particular option actually makes sense on its own. As in:
|
Thanks for explaining, Andrew. That makes sense. |
Building on top of #10323 (as it relates to #10322), this adds a new option to socket:
This also adds a new field to the struct returned by
enif_system_info()namedscheduler_polling_supportso thatprim_socket_nif.cdoesn't need to depend directly onerl_poll.h.