Fix high cpu usage#19
Merged
Az107 merged 2 commits intoAz107:masterfrom Apr 9, 2025
miky-rola:high-cpu-usage
Merged
Conversation
Az107
requested changes
Apr 9, 2025
Owner
Az107
left a comment
There was a problem hiding this comment.
Let’s bring back the priority list for now, and optimice it later to justify the complexity.
Apart of that , well job
| }; | ||
| let pool: Arc<(Mutex<VecDeque<TcpStream>>, Condvar)> = | ||
| Arc::new((Mutex::new(VecDeque::new()), Condvar::new())); | ||
| let priority_list: Arc<Mutex<Vec<usize>>> = Arc::new(Mutex::new(Vec::new())); |
Owner
There was a problem hiding this comment.
This handles the load balancing of the threads.
It not provides a significant performance boost (~3%), but maybe we could improve the LB system
Az107
approved these changes
Apr 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Connection Management: The logic ensures that idle or closed connections are cleaned up to free resources, while active connections are kept alive for better performance.
Non-blocking I/O: Handling [WouldBlock] errors allows the server to remain responsive and process multiple connections simultaneously.
Keep-Alive Support: Adding support for persistent connections improves efficiency by reducing the overhead of establishing new connections for every request.
Chunked Responses: Writing responses incrementally ensures that large responses do not block the server, enabling it to handle other requests concurrently.