mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-11-22 20:11:46 +00:00
Run the test suite with keep-alive parking on in CI, and mark it experimental
CPPHTTPLIB_KEEPALIVE_PARKING makes every Server start with parking on. The OpenSSL jobs on Ubuntu (epoll) and macOS (kqueue) now also run the whole suite built with it, which used to be done only locally. The two tests that check the blocking path turn parking off explicitly. README and the cookbook call the feature experimental and say that a server whose event loop cannot be set up serves as it does without it.
This commit is contained in:
1 parent
00e2fd89e8
commit
a8d58085cb
8 files changed
+42
-4
No files matched your search
@@ -921,10 +921,15 @@ svr.set_keep_alive_timeout(10); // Default is 5
|
||||
|
||||
#### Keep-alive parking
|
||||
|
||||
> [!NOTE]
|
||||
> Keep-alive parking is experimental. Its behavior may change in a future release.
|
||||
|
||||
```cpp
|
||||
svr.set_keep_alive_parking(true); // Call it before listen()
|
||||
```
|
||||
|
||||
Defining `CPPHTTPLIB_KEEPALIVE_PARKING` as `true` turns it on for every `Server` from the start. If the event loop cannot be set up, the server serves as it does without it.
|
||||
|
||||
By default, a kept-alive connection holds a worker thread while it waits for its next request, so connections beyond the thread count wait for one to be closed. With keep-alive parking, a connection waiting for its next request is handed to an event loop instead, and goes back to a worker when the request arrives. An idle connection then costs a socket and a few kilobytes instead of a thread, and connections that outnumber the threads take turns.
|
||||
|
||||
With it:
|
||||
|
||||
Reference in new issue
Block a user