-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Pure tokio #17
Pure tokio #17
Conversation
In my tests this is 2x as fast |
Hey @JackThomson2 , Thank you for the contribution! 😄 However, I do have a question regard this implementation. I created a separate thread for the TCPListener as I am planning to introduce multiple processes as well in the future. |
@JackThomson2 , what kind of tests are you using? |
Hey! This should work with multiple processes, the tokio spawn will share the load between the different cores, if you where to use this multiple times it should be fine and tokio should just work it all out! For testing I was timing your ping script and simply testing response times on chrome as well. Very crude tests but looked positive. Any questions let me know |
@sansyrox I've just pushed an update which will stop slow clients, by spawning on recieve. |
@JackThomson2 Just a clarification, now with tokio added, we won't have to spawn a process(something like this https://doc.rust-lang.org/std/process/struct.Command.html) to spread the request across different cores. Tokio will handle it automatically?
Thank you so much! I just saw it, it looks good! 🚀 |
@sansyrox Yes exactly! A better explanation can be found here https://docs.rs/tokio/1.7.1/tokio/runtime/index.html#multi-thread-scheduler but basically it uses a work stealing algorithm between cores for scheduling. |
@JackThomson2 , this looks really good. Can you change this to a normal PR so we can review it.
|
@JackThomson2 , one last thing before we merge this PR. Can you please fetch the latest changes from the main branch? |
@sansyrox Won't merging automatically rebase onto main or am I missing something? |
@JackThomson2 , I was worried that I was just showing old changes. I'll merge and check. |
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.
LGTM! 🚀
Amazing work! ✨
🙌 |
Here's another proposal which massively reduces the complexity of the project by leveraging Tokio's multi-threaded runtime
Would probably need some benching marking on your machine, for me it appears to be faster.
Jack