Comments (4)
Your "end" counter is flawed, you need to put your counter in the schedule block:
Not this:
case .end(_):
+ queue.sync {
+ if concurrentRequests > maxConcurrentRequests {
+ maxConcurrentRequests = concurrentRequests
+ print(maxConcurrentRequests)
+ }
+ concurrentRequests -= 1
+ }
+
_ = ctx.eventLoop.scheduleTask(in: delay) { () -> Void in
but this:
case .end(_):
_ = ctx.eventLoop.scheduleTask(in: delay) { () -> Void in
+ queue.sync {
+ if concurrentRequests > maxConcurrentRequests {
+ maxConcurrentRequests = concurrentRequests
+ print(maxConcurrentRequests)
+ }
+ concurrentRequests -= 1
+ }
+
(you count before the artificial "delay")
from swift-nio.
Whoops, I actually did catch this but posted an incorrect gist (I have updated it). This just adds 1. to the max (before it was 5, after it becomes 6) which is consistent with my theory that a single request seems to be blocking the next request from coming in.
from swift-nio.
How do you "spam the server"?
from swift-nio.
Ah thank you! You guessed correctly. My test environment was going between HTTP2 (for reference) and HTTP1 (for swift-nio, since it doesn't support 2 yet). Maximum number of HTTP1 connections (for my client) was 6. Increasing the maximum worked correctly.
from swift-nio.
Related Issues (20)
- Carton_\mahim cargo service~)`—’/[(‘i’)>,_/’)′[]
- visionOS Support HOT 6
- `ClientBootstrap.connect` that returns a NIOAsyncChannel hits precondition if connect fails HOT 1
- ByteToMessageProcessor: re-entrancy bugs
- FB‘,-(CI HOT 1
- ✓ HOT 1
- Proposal: Contributing HTTP Response Status Code Mappings HOT 2
- Performance tests broken (always paste a result from 3rd Jan, actual run fails) HOT 7
- TCPThroughputBenchmark has a crashing race
- NIOFileSystem uses yet another thread pool instead of NIOThreadPool HOT 3
- NIOFileSystem's BufferedWriter wants Sequence<UInt8>s and doesn't accept ByteBuffers
- NIOFileSystem's BufferedWriter produces empty files when they shouldn't be empty HOT 1
- NIOFileSystem: Should offer withTemporaryDirectory
- NIOFileSystem: BufferedReader.read(while:) doesn't say if it stopped reading because the condition was met or because or EOF HOT 1
- NIOFileSystem: BufferedReader can only return `[UInt8]` and not `ByteBuffer` HOT 2
- `NIOFileSystem` module needs to be `_NIOFileSystem`
- Occasional program crashes on ubuntu20.04 HOT 2
- When my app is submitted to the App Store, an error occurs The naming convention for 'NlOBase64 'is incorrect HOT 7
- Allocation counter tests don't work on macOS HOT 1
- Add `NIOBSDSocket.Option` for `SO_BROADCAST`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-nio.