-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Move the IOCP thread pool on windows to managed code #46610
Comments
@kouvel I wonder if it makes sense to use worker threads to dequeue work from the IO Completion Port instead of having different IO threads and worker threads (similar to how we have these time sensitive work items that run after the normal work items). |
Yea I think using thread pool threads for polling would be better, maybe not with the time-sensitive queue though, as its latency could be too high. A question may be about cases where having multiple epoll threads is currently better (larger machines), I think the better batching and timing of polls may compensate for it some, depends on the delay/work involved in polling and queuing the completions, and differences in timing with larger batches. On Windows IO completions also run out-of-order and in parallel with normal work items, there would be behavioral differences there that would need to be accounted for / experimented with. |
I agree that it would be great to get rid of separate IO threads. This causes some weird issues, e.g. there are no work sharing queues on IO threads (at least last time I checked -- maybe this has changed)?
Trying this out seems pretty straightforward to do, and we can run lots of perf tests like TechEmpower to analyze the impact. |
IO threads are a concept that is not widely understood in the .NET community. It would be a useful simplification if this went away. |
@kouvel this should be closed right? |
Yea I think this can be closed, IO completion handling was moved to the portable thread pool implementation and IO completions run on worker threads after #64834. Polling for IO on worker threads needs some experimentation. |
Today the managed thread pool implementation moved worker threads and the gate thread but doesn't include IO threads to handle IOCP completions. Lots of complex logic (like handling multiple app domains) and overhead could be removed (and it would be easier to experiment with) by moving the logic into managed code:
Other benefits include having this pool be usable on the NativeAOT branch (which currently uses the windows thread pool for IOCP).
The other follow on and possibly unrelated item that might be interesting here is looking at unifying/centralizing how we poll for IO similar to how other platforms do (assuming it doesn't regress performance).
cc @kouvel @geoffkizer @stephentoub @jkotas
The text was updated successfully, but these errors were encountered: