Skip to content
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

protocols/mdns: Optimise InterfaceState::poll for low latency #2939

Merged
merged 29 commits into from
Oct 4, 2022

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Sep 24, 2022

Description

This is now in accordance with our coding guidelines. Inspired by @gallegogt's findings.

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this.

I don't yet understand what the issue was. Was self.timeout not polled early on and thus no waker registered?

self.send_buffer.push_back(build_query());
}

// 2nd priority: Keep local buffers small: Empty buffers ASAP.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we first try to send existing work (self.send_buffer.pop_front) and then add more work (self.send_buffer.push_back)? In case we do a push_back, we can do a continue to follow with a pop_front.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it makes a big difference. The timer is our only local work, i.e. nothing else will push to the buffer. When we say "prefer local work over remote work", does that not imply that whatever generates the local work has the highest priority, followed by trying to send it to the remote?

protocols/mdns/src/behaviour/iface.rs Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Contributor Author

thomaseizinger commented Sep 28, 2022

I don't yet understand what the issue was. Was self.timeout not polled early on and thus no waker registered?

The issue was that we pushed into send_buffer but then returned from the function, despite having just created more work that we could have done (i.e. send the item we just pushed in the buffer) :)

@thomaseizinger
Copy link
Contributor Author

@mxinden I addressed your comments and also went on a bit of a refactoring detour because I found some of the code hard to understand. I hope it is better now 😊

You should be able to review patch-by-patch!

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @thomaseizinger.

@mxinden
Copy link
Member

mxinden commented Sep 29, 2022

You should be able to review patch-by-patch!

That helped. Thanks.

@thomaseizinger thomaseizinger merged commit a905a36 into master Oct 4, 2022
@thomaseizinger thomaseizinger deleted the 2916-mdns-refactor-poll branch October 4, 2022 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants