Say what handing a parked connection over costs

This commit is contained in:
yhirose committed 2026-11-21 11:18:32 -05:00
1 parent 0289c0f528
commit 76e1a9c4c9
3 files changed
+3 -3

No files matched your search

+1 -1
View File
@@ -931,7 +931,7 @@ With it:
- Consecutive requests on a connection may run on different threads. - Consecutive requests on a connection may run on different threads.
- When the [max queued requests](#max-queued-requests) limit is reached, only a connection that has not been served yet (or, with `SSLServer`, has not finished its TLS handshake) is closed. An established one waits for room. - When the [max queued requests](#max-queued-requests) limit is reached, only a connection that has not been served yet (or, with `SSLServer`, has not finished its TLS handshake) is closed. An established one waits for room.
- Each request pays for handing the connection over, so with no more connections than threads and very light handlers, it can serve fewer requests per second. - Handing the connection over to a worker adds roughly 10-20 µs to each request. It only shows when the client is as near as loopback and the handlers are very light: in our measurements, 2 connections on 2 threads served about a third fewer requests per second over loopback, but only a few percent fewer with a 250 µs round trip.
- A handler, a content provider and a WebSocket still hold their thread while they run. - A handler, a content provider and a WebSocket still hold their thread while they run.
- A subclass that overrides the private `process_and_close_socket()` is bypassed. - A subclass that overrides the private `process_and_close_socket()` is bypassed.
- `SSLServer` runs the TLS handshake on a worker when the client starts it. Until then the connection waits in the event loop and is closed at the keep-alive timeout, not the read timeout, and `ssl_last_error()` is not set for it. - `SSLServer` runs the TLS handshake on a worker when the client starts it. Until then the connection waits in the event loop and is closed at the keep-alive timeout, not the read timeout, and `ssl_last_error()` is not set for it.
+1 -1
View File
@@ -65,7 +65,7 @@ With keep-alive parking, a connection waiting for its next request is handed to
What changes with it: What changes with it:
- Consecutive requests on one connection may run on different threads, so don't keep per-connection state in `thread_local` variables. - Consecutive requests on one connection may run on different threads, so don't keep per-connection state in `thread_local` variables.
- With no more connections than threads and very light handlers, handing the connection over can lower the requests served per second. - Handing the connection over to a worker adds roughly 10-20 µs to each request. It only shows with very light handlers and a client as near as loopback.
- A handler, a content provider and a WebSocket still hold their thread while they run. - A handler, a content provider and a WebSocket still hold their thread while they run.
The full list is in the [README](https://github.com/yhirose/cpp-httplib/blob/master/README.md#keep-alive-parking). The full list is in the [README](https://github.com/yhirose/cpp-httplib/blob/master/README.md#keep-alive-parking).
+1 -1
View File
@@ -65,7 +65,7 @@ Keep-Aliveのパーキングを有効にすると、次のリクエストを待
有効にすると変わること: 有効にすると変わること:
- 同じ接続の連続するリクエストが、別々のスレッドで処理されることがあります。接続ごとの状態を`thread_local`変数に持たせないでください。 - 同じ接続の連続するリクエストが、別々のスレッドで処理されることがあります。接続ごとの状態を`thread_local`変数に持たせないでください。
- 接続数がスレッド数以下で、ハンドラがとても軽い場合は、接続の受け渡しのぶん毎秒の処理数が下がることがあります。 - ワーカーへの接続の受け渡しで、1リクエストあたり10〜20µsほど時間が増えます。目立つのは、ハンドラがとても軽く、クライアントがループバック並みに近いときだけです。
- ハンドラ、コンテンツプロバイダ、WebSocketは、実行中は今までどおりスレッドを占有します。 - ハンドラ、コンテンツプロバイダ、WebSocketは、実行中は今までどおりスレッドを占有します。
すべての変更点は[README](https://github.com/yhirose/cpp-httplib/blob/master/README.md#keep-alive-parking)にあります。 すべての変更点は[README](https://github.com/yhirose/cpp-httplib/blob/master/README.md#keep-alive-parking)にあります。