feat(wstransport): support concurrent accept (v2)#1937
Draft
Conversation
* use HttpServer.acceptStream and HttpServer.processHttpRequest for concurrent accept (depends on: status-im/nim-websock#181) * set DefaultConcurrentAccepts to 200 connections * fix parallel streaming data test * remove use of deprecated handshakeTimeout HttpServer param
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1937 +/- ##
==========================================
- Coverage 83.68% 83.60% -0.08%
==========================================
Files 145 145
Lines 23830 23868 +38
Branches 12 12
==========================================
+ Hits 19941 19954 +13
- Misses 3889 3914 +25
🚀 New features to boost your workflow:
|
Collaborator
Author
|
About the CI failures, I think the |
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.
NOTE: This is a draft PR; it depends on status-im/nim-websock#181 and addresses bug logos-messaging/logos-delivery#3634.
Rationale
Same as for the previous PR that aimed to address the same issue.
Proposed solution
The solution is to spawn a connection accept dispatcher task as part of WsTransport start.
The dispatcher task is responsible for pulling client sockets out via the new
HttpServer.acceptStream, which is less problematic than attempting to multitask theStreamServer.acceptfrom Chronos.Once a client stream is read, HTTP header validation and timeout is parallelized by asyncSpawn'ing tasks to call
HttpServer.processHttpRequestfor each incoming client connection.Changes