-
Notifications
You must be signed in to change notification settings - Fork 20
Minimize the packet processing performance overhead from session removal. #66
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
Conversation
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.
Pull Request Overview
This PR optimizes packet processing performance by removing the tokio::sync::Mutex from the session collection entry point and replacing it with a channel-based approach for session removal. This change eliminates potential contention at the critical path of incoming packet processing.
- Replaced
Arc<Mutex<AHashMap>>with plainAHashMapfor session storage - Introduced unbounded channel for asynchronous session removal notifications
- Modified function signatures to use references instead of clones where possible
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
While Tokio's locks should generally be avoided, a Mutex is used here at the entry point for incoming packets, solely for the purpose of stream removal. This could potentially become a bottleneck under high throughput, though it doesn't seem to be an issue at present.