Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Does the reactor only support fallback way? #91

Open
kingluo opened this issue May 25, 2019 · 3 comments
Open

Does the reactor only support fallback way? #91

kingluo opened this issue May 25, 2019 · 3 comments

Comments

@kingluo
Copy link

kingluo commented May 25, 2019

First access of CURRENT_REACTOR would run a reactor in a background thread?
Does it mean for threadpoll executor, each thread local reactor would be running in a paired
background thread? Why not run the reactor via unpark() just like tokio (the runtime setup would init the reactor directly).

Why exists so-called fallback way? Please help to clarify it.

@yoshuawuyts
Copy link
Collaborator

Does it mean for threadpoll executor, each thread local reactor would be running in a paired
background thread?

Could you expand on this? I'm not sure I follow.

To my understanding we run a single reactor for the whole program, rather than a reactor-per-thread. This has some tradeoffs, but for us the benefit was simpler code that's easier to maintain and seems to perform about as well as the reactor-per-core design.

@kingluo
Copy link
Author

kingluo commented May 27, 2019

Yes, my misunderstanding. I check the codes again, and found the reactor is singleton instance via HANDLE_FALLBACK atomic.

and seems to perform about as well as the reactor-per-core design.

The threading sync stuffs cost nothing?

@yoshuawuyts
Copy link
Collaborator

The threading sync stuffs cost nothing?

Everything has tradeoffs. When combined with work stealing, the reactor-per-core design needs to hold references to the original reactor when performing work on a separate thread. This is very difficult to get right, and the potential performance gains didn't seem worth it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants