-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
NIOAsyncChannel based HTTP server #269
Conversation
b78c6a6
to
6a14e21
Compare
- Use a taskGroup so we can wait for write to finish before starting new read - Make sure we flush the request body always
0dc5ba2
to
0c0da63
Compare
Don't want to encourage people to use AsyncStream while it doesn't provide back pressure
There's something wrong with the core server. Its performance is really poor on Linux |
08a6e60
to
f48ea56
Compare
* Use new NIOAsyncChannel.executeThenClose api * fix tabbing
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.
One small comment I just noticed
Sources/PerformanceTest/main.swift
Outdated
@@ -21,7 +21,7 @@ let hostname = HBEnvironment.shared.get("SERVER_HOSTNAME") ?? "127.0.0.1" | |||
let port = HBEnvironment.shared.get("SERVER_PORT", as: Int.self) ?? 8080 | |||
|
|||
// create app | |||
let elg = MultiThreadedEventLoopGroup(numberOfThreads: 2) | |||
let elg = MultiThreadedEventLoopGroup(numberOfThreads: 8) |
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.
Can we use System.coreCount
here instead?
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.
Or NIOSingletons.posixEventLoopGroup
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.
Or NIOSingletons.posixEventLoopGroup
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.
I wanted to use a set number here, which doesn't use all the machines cores. I tend to use this with wrk for performance testing. I need to assign some cores to wrk otherwise it'll clash with the server and results will be inconsistent.
Although that number should be 4 and not 8. Performance seems to top out at 4 cores on macOS for some reason. Possibly related to the limited number of connections you can make on macOS.
HTTP server using NIOAsyncChannel. This requires a bunch a changes. I'll update this PR as they are done