-
Notifications
You must be signed in to change notification settings - Fork 2.9k
perf: improve getNetConnections function and Websocket handling #11269
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
- Reduced message queue size in WebSocket client from 100 to 32. - Introduced atomic boolean to track client closure state. - Added SendPayload method to handle message sending with queue management. - Updated ProcessData function to utilize SendPayload for sending responses. - Expanded netTypes to include both IPv4 and IPv6 protocols in network connection retrieval. - Improved net connection processing by using a map for process names, enhancing efficiency.
- Added synchronization with sync.Once for safe closure of WebSocket client. - Updated message queue size to a constant for better maintainability. - Implemented context timeouts for process data retrieval to prevent blocking. - Improved network connection handling by utilizing a more efficient method for retrieving connections. - Introduced a new function to determine connection types based on protocol family.
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
- Updated getNetConnections function to improve efficiency by using maps for process names and connections. - Introduced a new helper function to retrieve process names from the filesystem or process context. - Enhanced filtering logic for network connections based on process ID, name, and port. - Increased initial capacity for connection results to optimize performance.
- Updated the SendPayload method to be more succinctly named Send for clarity. - Ensured the method continues to handle message sending while maintaining existing functionality.
…ty and efficiency - Replaced SendPayload method calls with Send for consistency in WebSocket message handling. - Enhanced getNetConnections function by refining process name retrieval and filtering logic. - Improved error handling in getProcessNameWithContext for better robustness.
- Removed unnecessary synchronization for closing the WebSocket client. - Updated the Read method to handle message reading directly without a separate Close method. - Ensured the Socket is closed properly after reading messages to prevent resource leaks.
|
lgtm |
What this PR does / why we need it?
Summary of your change
Please indicate you've done the following: