kino 0.7.1-aarch64-linux → 0.8.0-aarch64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -9,16 +9,19 @@ Ruby threads cannot run Ruby code in parallel, so production setups fork
9
9
  a process per core and pay for each copy in memory. Kino runs your code
10
10
  on every core in **one small process**. A **Rust** (tokio + hyper)
11
11
  front-end owns the network, parallel **Ractors** run your Rack 3 app,
12
- and a threaded fallback mode runs everything else, Rails included.
13
-
14
- * **Fast.** On a real 8-core server, every Kino mode is **1.5-1.7×**
15
- ahead of a Puma fork cluster on I/O-light endpoints—with native
16
- **HTTP/2** adding another **+79%** over HTTP/1.1 on the same server.
17
- Ractor mode also wins on pure CPU, **+25%**.
12
+ and a threaded fallback mode runs everything else. Rails main partially
13
+ runs on Ractors too (see [Rails on Ractors](doc/rails-on-ractors.md)).
14
+
15
+ * **Fast.** On a real 8-core server, Kino's ractor mode is **1.5-1.6×**
16
+ ahead of a Puma fork cluster on I/O-light endpoints (threaded mode
17
+ 1.1-1.4×)—with native **HTTP/2** adding another **+41%** over
18
+ HTTP/1.1 on the same server (+58% over TLS).
19
+ Ractor mode also wins on pure CPU, **+14%**.
18
20
  [Benchmarks](#benchmarks) below.
19
- * **A fraction of the memory.** About **~8×** on the simplistic bench
20
- Ractor app, and about **4× less memory** than a Puma cluster serving
21
- Rails in fallback threaded mode.
21
+ * **A fraction of the memory.** About **~7×** on the simplistic bench
22
+ Ractor app (14× on a Ruby 4.1 development build), and about **6.7×
23
+ less memory** than a Puma cluster serving Rails (measured in threaded
24
+ mode, before Rails could run on Ractors).
22
25
  * **Parallel without forking.** Ractor mode runs CPU work **more than
23
26
  5× faster** than Kino's own GVL-bound threaded mode, in the same
24
27
  small process.
@@ -46,11 +49,17 @@ and a threaded fallback mode runs everything else, Rails included.
46
49
  - [Config file and CLI](#config-file-and-cli)
47
50
  - [`kino --check`](#kino---check)
48
51
  - [Request timeouts](#request-timeouts)
52
+ - [Lifecycle hooks](#lifecycle-hooks)
53
+ - [Elastic pool](#elastic-pool-experimental)
54
+ - [Stuck-worker quarantine](#stuck-worker-quarantine)
49
55
  - [Stats](#stats)
50
56
  - [Logging](#logging)
51
57
  - [Timer waits](#timer-waits)
52
58
  - [Rack 3 compliance](#rack-3-compliance)
53
- - [Rails](#rails)
59
+ - [Streaming responses](#streaming-responses)
60
+ - [WebSockets](#websockets-experimental)
61
+ - [Fibers inside Kino workers](#fibers-inside-kino-workers-experimental)
62
+ - [Rails](#rails-1)
54
63
 
55
64
  ## Why
56
65
 
@@ -67,142 +76,151 @@ notes live in [doc/architecture.md](doc/architecture.md).
67
76
 
68
77
  ## Benchmarks
69
78
 
70
- Measured on a real server: AWS **c7a.2xlarge** (8-core AMD EPYC 9R14,
79
+ Measured on a real server: AWS **c8a.2xlarge** (8-core AMD EPYC 9R45,
71
80
  16 GB, Amazon Linux 2023). This is a realistic app-server size.
72
81
 
73
82
  **These tables run a tiny synthetic Rack app**—plaintext, a 10 KB body,
74
83
  a CPU-bound `fib`, a 5 ms wait—deliberately small, to measure the server
75
84
  rather than an app. It is Ractor-shareable, so Kino runs it in `:ractor`
76
85
  mode (and `:threaded` for comparison). **A real Rails app is a different
77
- story:** it is *not* Ractor-shareable, so it runs only in Kino's
78
- `:threaded` fallback, with its own numbers—see [Rails](#rails) below.
79
- Ruby 4.0.6 with YJIT (re-measured 2026-09), every server at its
80
- defaults: Puma forks 8 workers × 3 threads, Kino stays in one process
86
+ story:** the Rails numbers were measured in Kino's `:threaded` mode,
87
+ before Rails could run on Ractors, and are reported separately—see
88
+ [Rails](#rails) below.
89
+ Ruby 4.0.9 with YJIT (re-measured 2026-11), every server at 8 workers:
90
+ Puma forks 8 workers × 3 threads, Kino stays in one process
81
91
  (8 workers; 1 thread each in ractor modes, 3 in threaded). Numbers are
82
- req/s by wrk (8-second windows, 64 connections, same host).
83
- Methodology: [doc/benchmarks.md](doc/benchmarks.md).
92
+ req/s by wrk (8-second windows, 64 connections, same host, no CPU
93
+ pinning), the median of 3 boots.
94
+ [Methodology](doc/benchmarks.md#methodology).
84
95
 
85
96
  | endpoint | Kino :ractor | + lanes | :ractor, `workers 32`² | Kino :threaded | Puma (cluster) |
86
97
  |-------------|-------------:|--------:|-----------------------:|---------------:|---------------:|
87
- | /plaintext | 222,980 | **244,652** | 115,553 | 213,104 | 142,094 |
88
- | /10k | 175,182 | **188,365** | 103,147 | 132,009 | 125,116 |
89
- | /cpu (fib) | **76,695**¹| 71,830 | 54,062 | 13,463 | 61,329 |
90
- | /io (5 ms) | 1,548 | 1,556 | **5,388** | 4,722 | 4,699 |
91
- | /io_native | 1,570 | 1,573 | **6,207** | 4,695 | 4,693 |
92
-
93
- Memory tells two different stories depending on the app, both by **PSS**
94
- (proportional set size; see note) after sustained load.
95
-
96
- **The tiny benchmark app** (Ractor-shareable, so Kino runs it in `:ractor`
97
- or `:threaded`). Kino is **~8× lighter in :ractor mode, ~10× in :threaded**
98
- than the Puma cluster—the gap stays large because a trivial app is almost
99
- all private per-worker heap, which copy-on-write can't share:
98
+ | /plaintext | 465,055 | **525,155** | 245,612 | 394,053 | 291,409 |
99
+ | /10k | 375,470 | **409,085** | 203,154 | 285,270 | 251,357 |
100
+ | /cpu (fib) | **118,095**¹| 111,751 | 83,713 | 20,187 | 103,653 |
101
+ | /io (5 ms) | 1,553 | 1,566 | **5,721** | 4,738 | 4,729 |
102
+ | /io_native | 1,578 | 1,579 | **6,264** | 4,740 | 4,729 |
103
+
104
+ Memory, by **PSS** (proportional set size;
105
+ [why](doc/benchmarks.md#methodology)) after sustained load. On the tiny
106
+ app Kino is **~7× lighter in :ractor mode, ~11× in :threaded** than the
107
+ Puma cluster—a trivial app is almost all private per-worker heap, which
108
+ copy-on-write can't share:
100
109
 
101
110
  | tiny app, Kino | Kino (one process) | Puma cluster (8 workers) | ratio |
102
111
  |-----------------|-------------------:|-------------------------:|------:|
103
- | :ractor (8×1) | **135 MB** | 1,072 MB | ~8× |
104
- | :threaded (8×3) | **107 MB**³| 1,072 MB | ~10× |
112
+ | :ractor (8×1) | **167 MB** | 1,171 MB | ~7× |
113
+ | :threaded (8×3) | **110 MB**³| 1,171 MB | ~11× |
105
114
 
106
- **A real Rails app** (not Ractor-shareable—Kino's `:threaded` fallback
107
- only, [below](#rails)). The gap is **~4×**, smaller because Rails' large
108
- framework *is* shared copy-on-write across Puma's forks:
115
+ On a real Rails app (in `:threaded` mode, [below](#rails)) the gap is
116
+ **~6.7×**: Puma's forks share the Rails framework copy-on-write, but
117
+ each fork keeps its own heap:
109
118
 
110
119
  | Rails hello-world | Kino :threaded | Puma cluster (8 workers) | ratio |
111
120
  |-------------------|---------------:|-------------------------:|------:|
112
- | **PSS** | **95 MB** | **405 MB** | ~4× |
113
-
114
- "+ lanes" is the experimental per-worker-queue dispatcher (`lanes true`).
115
- It posts the fastest plaintext/10k of any configuration here. Details:
116
- [doc/benchmarks.md](doc/benchmarks.md#lane-dispatch-experimental-lanes-true).
117
-
118
- ¹ Stock settings, no tuning. Ractor mode beats the fork cluster on pure
119
- CPU by +25% (+17% with lanes; Puma 8.0.2 narrowed this from the +34%
120
- measured against 7.x). Threaded mode shows the GVL ceiling that every
121
- single-process Ruby server hits. The old CPU-tuning recipe stays
122
- retired: its `threads 1` half **is** the default, and its
123
- `tokio_threads 1` half still costs on real hardware; see
124
- [doc/benchmarks.md](doc/benchmarks.md#cpu-bound-tuning).
125
-
126
- ² Wait-bound throughput is slots ÷ wait, and the default columns bring
127
- 8 single-thread workers against the cluster's 24 threads. Kino slots
128
- are threads, not processes—when your app waits a lot, raise `workers`.
129
- The `workers 32` column is that tuning: **+15% over the cluster on /io
130
- (+32% via `Kino.sleep`)** while still ahead of it on pure CPU, all in
131
- one small process. The cost is the CPU-light rows (32 ractors
132
- oversubscribe 8 cores); pick the topology your app's wait profile
133
- needs. See
134
- [doc/benchmarks.md](doc/benchmarks.md#why-io-lags-in-ractor-mode-on-linux).
135
-
136
- ³ With `MALLOC_ARENA_MAX=2` (the standard Ruby deployment setting;
137
- Heroku's default). Without it, 24 threads churning 10 KB responses
138
- through one glibc heap balloon to ~647 MB—an arena-fragmentation
139
- footgun, not a leak, and ractor mode sidesteps it. See
140
- [doc/benchmarks.md](doc/benchmarks.md#memory-under-load-and-the-glibc-arena-footgun).
121
+ | **PSS** | **96 MB** | **640 MB** | ~6.7× |
122
+
123
+ "+ lanes" is the experimental per-worker-queue dispatcher (`lanes true`),
124
+ the fastest plaintext/10k of any configuration here
125
+ ([lanes](doc/benchmarks.md#lane-dispatch-experimental-lanes-true)).
126
+
127
+ ¹ Stock settings, no tuning: ractor mode beats the fork cluster on pure
128
+ CPU by +14% (+8% with lanes); threaded mode shows the GVL ceiling that
129
+ every single-process Ruby server hits
130
+ ([CPU tuning](doc/benchmarks.md#cpu-bound-tuning)).
131
+
132
+ ² Wait-bound throughput is slots ÷ wait, and Kino slots are threads, not
133
+ processes: `workers 32` is **+21% over the cluster on /io (+32% via
134
+ `Kino.sleep`)** in one small process, at 16-19% behind it on /plaintext,
135
+ /10k and /cpu on Ruby 4.0.9 (ahead on every row on
136
+ [Ruby 4.1](#ruby-41-development-build);
137
+ [why](doc/benchmarks.md#why-io-lags-in-ractor-mode-on-linux)).
138
+
139
+ ³ With `MALLOC_ARENA_MAX=2`, the standard Ruby deployment setting
140
+ (144 MB without it;
141
+ [arenas](doc/benchmarks.md#memory-under-load-and-the-glibc-arena-footgun)).
141
142
 
142
143
  A common first idea is to keep your current server and wrap the app in
143
- a ractor pool. We measured that too (same box; the analysis is in the
144
- doc):
144
+ a ractor pool. We measured that too, with Kino at 8×3 for the wrappers'
145
+ 24 slots ([analysis](doc/benchmarks.md#the-ractor-pool-wrapper-comparison)):
145
146
 
146
147
  | endpoint | Kino :ractor (8×3) | Puma + ractor wrapper | Falcon + ractor wrapper |
147
148
  |------------|-------------------:|----------------------:|------------------------:|
148
- | /plaintext | **190,206** | 22,055 | 107,203 |
149
- | /cpu (fib) | **68,230** | 16,528 | 50,101 |
150
- | /io (5 ms) | **4,477** | 1,482 | 1,545 |
149
+ | /plaintext | **412,687** | 40,675 | 241,390 |
150
+ | /cpu (fib) | **108,063** | 33,322 | 94,417 |
151
+ | /io (5 ms) | **4,629** | 1,509 | 1,564 |
152
+
153
+ ### Ruby 4.1 (development build)
151
154
 
152
- (The Kino column here runs 8×3—the same 24 slots the wrappers get—so
153
- the /io row is comparable; the main table's ractor column runs the 8×1
154
- default.)
155
+ Ruby 4.0.9 is the released Ruby, and the primary number above. The same
156
+ box and method on a **development build** of Ruby 4.1 (`4.1.0dev`,
157
+ master f2d62c677e of 2026-11-21, YJIT on), which can move before 4.1 is
158
+ released:
159
+
160
+ | endpoint, Ruby 4.1 dev | Kino :ractor | + lanes | :ractor, `workers 32` | Kino :threaded | Puma (cluster) |
161
+ |-------------|-------------:|--------:|-----------------------:|---------------:|---------------:|
162
+ | /plaintext | 512,945 | **608,283** | 463,223 | 378,380 | 269,662 |
163
+ | /10k | 447,144 | **515,785** | 388,306 | 275,927 | 218,884 |
164
+ | /cpu (fib) | 128,097 | 112,276 | **128,109** | 19,739 | 99,379 |
165
+ | /io (5 ms) | 1,558 | 1,542 | **6,102** | 4,702 | 4,728 |
166
+ | /io_native | 1,576 | 1,581 | **6,314** | 4,738 | 4,730 |
167
+
168
+ | tiny app, Ruby 4.1 dev | Kino (one process) | Puma cluster (8 workers) | ratio |
169
+ |-----------------|-------------------:|-------------------------:|------:|
170
+ | :ractor (8×1) | **52 MB** | 746 MB | ~14× |
171
+ | :threaded (8×3), `MALLOC_ARENA_MAX=2` | **150 MB** | 746 MB | ~5× |
172
+
173
+ Ruby 4.1 collects garbage per Ractor: **every ractor column rises** on
174
+ /plaintext and /10k, **`workers 32` gains about 90% there** and leads
175
+ the cluster on every row, and **`:ractor` memory falls to 52 MB**, 14×
176
+ lighter than the cluster; `:threaded` and Puma lose 2-13% on
177
+ /plaintext, /10k and /cpu. The rest, with the Ruby 4.1 wrapper, HTTP/2
178
+ and Rails tables:
179
+ [doc/benchmarks.md](doc/benchmarks.md#ruby-41-development-build).
155
180
 
156
181
  ### HTTP/2 head-to-head
157
182
 
158
183
  Kino speaks HTTP/2 natively, so it skips the usual nginx-termination
159
- hop. Same box as the tables above; all over TLS, h2load, 64 in-flight,
160
- same app:
184
+ hop. Same box, Ruby 4.0.9; all over TLS, h2load, 64 in-flight, same app:
161
185
 
162
186
  | /plaintext | req/s | /upload (64 KB) |
163
187
  |-------------------------------|------------:|----------------:|
164
- | Kino native h2 | **164,044** | **19,226** |
165
- | Kino HTTP/1.1 (same boot) | 80,789 | 17,210 |
166
- | nginx h2 → Kino HTTP/1.1 | 109,219 | 1,217¹ |
167
- | Falcon (native h2) | 55,637 | 18,838 |
188
+ | Kino native h2 | **355,281** | **52,635** |
189
+ | Kino HTTP/1.1 (same boot) | 225,264 | 47,940 |
190
+ | nginx h2 → Kino HTTP/1.1 | 245,741 | 1,224¹ |
191
+ | Falcon (native h2) | 100,399 | 49,162 |
168
192
 
169
- Native h2 **doubles** HTTP/1.1 throughput on the same TLS server
170
- (+79% on cleartext h2c; fewer, larger socket operations, and HPACK
171
- spares re-sending cookies) and is **+50% over fronting the same Kino
172
- with nginx**—the proxy hop is pure cost. Uploads, h2's classic weak
173
- spot, run at HTTP/1 parity. Full matrix, cleartext h2c lanes, and
174
- methodology: [doc/benchmarks.md](doc/benchmarks.md#http2); reproduce
175
- with `bench/h2.sh`.
193
+ Native h2 is **+58%** over HTTP/1.1 on the same TLS server (+41% on
194
+ cleartext h2c) and **+45% over fronting the same Kino with nginx**—the
195
+ proxy hop is pure cost. Uploads, h2's classic weak spot, run ahead of
196
+ HTTP/1.1 over TLS (+10%) and within 3% of it in cleartext
197
+ ([full matrix](doc/benchmarks.md#http2); `bench/h2.sh`).
176
198
 
177
- ¹ nginx default-config h2 request-body flow control; see the doc.
199
+ ¹ Not an HTTP/2 cost: nginx spools a body larger than
200
+ `client_body_buffer_size` to a temporary file; with a larger buffer, or
201
+ `proxy_request_buffering off`, the lane runs at 51-52k.
178
202
 
179
203
  ### Rails
180
204
 
181
- Rails is not Ractor-shareable today, so Kino serves it in `:threaded`
182
- fallback—one GVL-bound process. On the same box (`examples/rails-hello`,
183
- edge Rails, production, 8×5):
205
+ These Rails numbers were measured in `:threaded` mode, one GVL-bound
206
+ process, before Rails could run on Ractors. On the same box, Ruby 4.0.9
207
+ (the controller-only hello app, kept as the bench subject in
208
+ `bench/rails_hello.ru`; edge Rails, production, 8×5):
184
209
 
185
210
  | Rails hello-world | req/s | memory (PSS) |
186
211
  |------------------------------|-------:|-------------:|
187
- | Kino :threaded (one process) | 2,731 | **95 MB** |
188
- | Puma cluster (8 workers) | 15,422 | 405 MB |
212
+ | Kino :threaded (one process) | 7,660 | **96 MB** |
213
+ | Puma cluster (8 workers) | 34,688 | 640 MB |
189
214
 
190
215
  The honest trade-off: Puma's fork cluster uses all 8 cores, so it serves
191
- ~5.6× the throughput—at ~4× the memory. Ractor-mode Rails would close
192
- the throughput gap at one-process memory cost; the upstream blockers are
193
- tracked in [doc/rails-on-ractors.md](doc/rails-on-ractors.md).
194
-
195
- In short: on the tiny synthetic app, ractor mode beats fork-level CPU parallelism (**5.7×** Kino's
196
- own GVL-bound threaded mode, +25% over the cluster) in one process, at
197
- about 1/8th of the cluster's memory by PSS (~4× on a real Rails app).
198
- Every Kino mode is 1.5-1.7× ahead of the cluster on I/O-light endpoints,
199
- and native HTTP/2 adds +79% over HTTP/1.1 on top. The macOS numbers
200
- (secondary; everything there hits the loopback ceiling) and the
201
- YJIT × Ractors gotcha are in [doc/benchmarks.md](doc/benchmarks.md).
216
+ ~4.5× the throughput—at ~6.7× the memory. Ractor-mode Rails is not
217
+ benchmarked yet ([what runs](doc/rails-on-ractors.md)).
202
218
 
203
- Reproduce: `bench/run.sh [seconds] [concurrency]` for the main table,
204
- `bench/studies.sh` for the follow-ups (CPU recipe, topology, scaling,
205
- sharded I/O, logging, memory), `bench/h2.sh` for the HTTP/2 matrix.
219
+ Reproduce: `bench/run.sh [seconds] [concurrency]` for the main table
220
+ (the [exact commands](doc/benchmarks.md#methodology)), `bench/studies.sh`
221
+ for the follow-ups (CPU recipe, topology, scaling, sharded I/O, logging,
222
+ memory), `bench/h2.sh` for HTTP/2. The macOS numbers and the
223
+ YJIT × Ractors gotcha are in [doc/benchmarks.md](doc/benchmarks.md).
206
224
 
207
225
  ## Install
208
226
 
@@ -252,93 +270,42 @@ end
252
270
  Kino::Server.run(app, port: 9292) # traps INT/TERM; Ctrl-C drains gracefully
253
271
  ```
254
272
 
255
- Or embedded, with everything spelled out:
256
-
257
- ```ruby
258
- server = Kino::Server.new(app,
259
- bind: "127.0.0.1", # or "unix:///run/kino.sock" behind a proxy
260
- port: 9292, # 0 = ephemeral; read back via server.port
261
- workers: Kino.available_parallelism, # ractors (parallelism); the default
262
- max_workers: nil, # experimental: grow past workers under load (see Elastic pool)
263
- scale_down_after: 30, # seconds idle before an extra worker retires
264
- threads: 1, # per worker; ractor default 1, threaded default 3
265
- mode: :auto, # :auto | :ractor | :threaded
266
- queue_depth: 1024, # bounded queue; overflow → 503
267
- queue_timeout: 5.0, # seconds before 503 on a full queue
268
- request_timeout: nil, # seconds before a slow response becomes a 504 (nil = off)
269
- max_connections: 8192, # cap concurrent connections; default: most of ulimit -n
270
- max_body_size: 50 * 1024 * 1024, # bytes before a 413; nil = let a proxy handle it
271
- on_error: ->(e, env) { ErrorTracker.capture(e) }, # after the client got its 500
272
- shutdown_timeout: 30, # drain deadline
273
- control_bind: "127.0.0.1:9293", # monitoring: /stats /metrics /ready /live; port 0 reads back via server.control_port
274
- control_token: ENV["KINO_CONTROL_TOKEN"], # optional Bearer auth for /stats + /metrics
275
- tls: { cert: "cert.pem", key: "key.pem" }, # file paths or inline PEM
276
- http2: true, # ALPN h2 on TLS + plaintext h2c; false = HTTP/1 only
277
- )
278
- server.start
279
- server.shutdown # graceful: drain → deadline → abort stragglers
280
- ```
273
+ To embed it, `Kino::Server.new(app, **options)` returns a server you
274
+ `start` and `shutdown` (graceful: drain → deadline → abort stragglers);
275
+ [every option](doc/configuration.md#server-options), spelled out.
281
276
 
282
277
  ### Modes
283
278
 
284
- - **`:ractor`**: `workers` Ractors × `threads` Threads each. The app must
285
- be `Ractor.shareable?` (frozen middleware, `shareable_proc` endpoints).
286
- Forcing `:ractor` with an unshareable app raises
287
- `Kino::UnshareableAppError`. A crashed ractor returns 500 to its
288
- in-flight requests right away, then respawns.
289
- - **`:threaded`**: the same machinery on `workers × threads` plain
290
- Threads. Runs **any** Rack app, including Rails, today. Parallel for
291
- I/O, serialized by the GVL for CPU.
292
- - **`:auto`** (default): `:ractor` when the app is shareable, otherwise
293
- a warning and `:threaded`. One caveat: a *class* used as a Rack app
294
- always counts as "shareable" (classes are), even if calling it touches
295
- unshareable state. Force `:threaded` for those.
279
+ **`:ractor`** runs `workers` Ractors × `threads` Threads each, and the
280
+ app must be `Ractor.shareable?` (frozen middleware, `shareable_proc`
281
+ endpoints). **`:threaded`** is the same machinery on plain Threads and
282
+ runs **any** Rack app, including all of Rails. **`:auto`** (default)
283
+ picks `:ractor` when the app is shareable, otherwise a warning and
284
+ `:threaded`. Either way a crashed worker thread is replaced while the
285
+ others serve on ([Modes](doc/configuration.md#modes)).
296
286
 
297
287
  ### Sharded I/O
298
288
 
299
- `io_shards true` (off by default) moves HTTP I/O from Tokio's shared
300
- multi-thread runtime onto current-thread shards: one thread accepts and
301
- hands each connection to the least-loaded shard, which then owns it for
302
- its lifetime—no work-stealing, no cross-thread wakeups on the hot path.
303
- On the 8-core reference box fast handlers gain +1-3% (best with
304
- `io_threads 8`); the win grows with scheduler contention, so measure on
305
- your own core count. Ruby-bound endpoints are unchanged. Orthogonal to
306
- `mode`: it reshapes the Rust side only.
307
-
308
- ```ruby
309
- # kino.rb
310
- io_shards true
311
- io_threads 8 # optional; default: half the available CPUs
312
- ```
289
+ `io_shards true` (off by default) moves HTTP I/O onto current-thread
290
+ shards, each owning its connections for their lifetime: no
291
+ work-stealing, no cross-thread wakeups on the hot path.
292
+ [Sharded I/O](doc/configuration.md#sharded-io) says when it pays.
313
293
 
314
294
  ### HTTP/2
315
295
 
316
- On by default, on both transports, with nothing to configure:
317
-
318
- - **TLS binds** advertise `h2` via ALPN, so browsers and h2-capable
319
- clients negotiate HTTP/2 and everything else stays on HTTP/1.1.
320
- - **Plaintext binds** serve prior-knowledge h2c: a client that opens
321
- with the HTTP/2 preface (an h2-preferring load balancer, a gRPC-style
322
- backend hop, `curl --http2-prior-knowledge`) gets HTTP/2; ordinary
323
- clients are HTTP/1.1 exactly as before. Browsers never do h2 on
324
- plaintext, so a certificate-less kino behaves identically for them.
325
-
326
- The Rack side is spec-complete on h2: `SERVER_PROTOCOL` is `"HTTP/2"`,
327
- `HTTP_HOST`/`SERVER_NAME`/`SERVER_PORT` come from the `:authority`
328
- pseudo-header (h2 requests carry no Host header), split cookie headers
329
- are rejoined with `"; "`, and streamed uploads flow through the same
330
- backpressured body channel as HTTP/1. Streams multiplex into the same
331
- worker slots as keep-alive requests—`workers × threads` bounds
332
- concurrency either way. (`rack.hijack` stays out on h2 as it is on h1;
333
- the protocol has no 101 upgrade to hijack anyway.) `http2 false` pins
334
- the server to HTTP/1 and drops `h2` from ALPN.
296
+ On by default, with nothing to configure: TLS binds advertise `h2` via
297
+ ALPN, plaintext binds serve prior-knowledge h2c, every other client
298
+ stays on HTTP/1.1, and `http2 false` pins the server to HTTP/1. What
299
+ the Rack side sees: [HTTP/2](doc/configuration.md#http2).
335
300
 
336
301
  ## Config file and CLI
337
302
 
338
303
  Settings can live in a Puma-style Ruby DSL file: `kino.rb` in the
339
304
  working directory, or `config/kino.rb` (the Rails layout), is picked up
340
305
  automatically; `-C PATH` names any other. Precedence: explicit kwargs
341
- and CLI flags > config file > defaults.
306
+ and CLI flags > config file > defaults. `kino --init` writes a sample
307
+ that documents every directive; the flags and a sample file are in
308
+ [doc/configuration.md](doc/configuration.md#config-file-and-cli).
342
309
 
343
310
  ```ruby
344
311
  # kino.rb
@@ -348,77 +315,30 @@ threads 1
348
315
  mode :ractor
349
316
  ```
350
317
 
351
- ```sh
352
- kino --init # write a fully commented sample kino.rb
353
- kino # config.ru + kino.rb, port 9292
354
- kino --check # explain whether the app can run in :ractor mode
355
- kino -C config/kino.rb -p 3000 -w 4 -m ractor my_app.ru
356
- ```
357
-
358
- The generated sample documents every directive, including the Rails
359
- settings and the performance notes.
360
-
361
318
  ## `kino --check`
362
319
 
363
- When an app cannot run in `:ractor` mode, Kino can tell you why, instead
364
- of leaving you with a bare `Ractor::IsolationError`. The check changes
365
- nothing (it does not freeze your objects) and names each blocker:
366
- captured variables with the place they were defined, instance variables
367
- by path, and the class-level instance variable trap that catches
368
- class-style apps:
369
-
370
- ```
371
- $ kino --check
372
- check: app is NOT Ractor-shareable
373
- - app (Proc at app.rb:12)—captures `cache` = {} (Hash) (unshareable)
374
- - app (HelloApp).@instance—class-level ivar holds #<HelloApp…>—classes
375
- pass Ractor.shareable?, but reading this from a worker ractor raises
376
- Ractor::IsolationError on the first request
377
- hints: freeze config at boot; build endpoints with Ractor.shareable_proc;
378
- keep per-worker resources in Ractor.store_if_absent; or run mode :threaded.
379
- ```
380
-
381
- Exit status is 0/1, so it works in CI. The programmatic form is
382
- `Kino::Check.report(app)`.
320
+ When an app cannot run in `:ractor` mode, `kino --check` tells you why,
321
+ instead of leaving you with a bare `Ractor::IsolationError`. It changes
322
+ nothing and names each blocker: captured variables with the place they
323
+ were defined, instance variables by path, and the class-level instance
324
+ variable trap that catches class-style apps. Exit status is 0/1, so it
325
+ works in CI ([sample output](doc/configuration.md#kino---check)).
383
326
 
384
327
  ## Request timeouts
385
328
 
386
- `request_timeout: seconds` (or `request_timeout 30` in `kino.rb`) limits
387
- how long the app may take to produce a response. Past the deadline the
388
- client gets an immediate **504** while the handler keeps running; its
389
- late response is dropped without harm. Off by default. The handler is
390
- deliberately *not* killed, because interrupting arbitrary Ruby mid-flight
391
- is unsafe. A stuck handler still occupies its worker slot until it
392
- returns, so set the deadline above your slowest legitimate endpoint and
393
- watch `stats[:timeouts]`.
394
-
395
- Timeouts guard your app; the network intake guards itself. New
396
- connections past `max_connections` (default: most of `ulimit -n`) wait
397
- in the kernel backlog; request bodies past `max_body_size` (default
398
- 50 MB, `nil` delegates to a fronting proxy) get a **413**; and fixed
399
- deadlines drop slow-header clients (15 s), stalled TLS handshakes
400
- (10 s), and uploads stalled mid-body (30 s). When a worker catches an
401
- app or delivery error,
402
- `on_error ->(error, env) { ErrorTracker.capture(error) }` is called
403
- after the client got its 500—the only place a tracker sees errors
404
- raised while the response was being written (in `:ractor` mode, build
405
- the handler with `Ractor.shareable_proc`).
329
+ `request_timeout 30` (off by default) answers an app slower than that
330
+ with an immediate **504**; the handler is deliberately *not* killed,
331
+ because interrupting arbitrary Ruby mid-flight is unsafe. The network
332
+ intake guards itself with `max_connections`, `max_body_size` (a **413**)
333
+ and fixed deadlines for slow clients, and `on_error` hands what a worker
334
+ caught to your error tracker ([more](doc/configuration.md#request-timeouts)).
406
335
 
407
336
  ## Lifecycle hooks
408
337
 
409
- Kino fires four lifecycle hooks alongside `on_error`, split by firing context.
410
-
411
- **Worker-context hooks** run inside the worker and are available to all workers:
412
- - `after_worker_boot { |worker_id| }`: runs once before the worker begins serving, with its slot id. In `:ractor` mode it runs inside the worker ractor and must be `Ractor.shareable_proc`.
413
- - `after_request_complete { |env, status| }`: fires inside the worker after each successful response. This is the hot path—leave it unset for zero cost. In `:ractor` mode it must be `Ractor.shareable_proc`.
414
-
415
- **Main-context hooks** run on the main thread, outside workers, and are plain procs:
416
- - `after_boot { }`: fires once after the worker pool is up. Wire readiness here—sd_notify, a "server ready" metric, and so on.
417
- - `on_worker_exit { |worker_index, error| }`: fires when a worker exits, with its index and the crash cause (or nil on a clean exit).
418
-
419
- `after_worker_boot`'s argument is the worker's slot id, while in `:ractor` mode `on_worker_exit`'s argument identifies the exited ractor (`0`..`workers - 1`)—a different number space—so don't correlate boot and exit by that number in `:ractor` mode.
420
-
421
- A raising hook is logged and never kills a worker.
338
+ `after_worker_boot` and `after_request_complete` run inside the worker;
339
+ `after_boot` and `on_worker_exit` run on the main thread. A raising
340
+ hook is logged and never kills a worker
341
+ ([arguments](doc/configuration.md#lifecycle-hooks)).
422
342
 
423
343
  ## Elastic pool (experimental)
424
344
 
@@ -431,237 +351,148 @@ max_workers 16 # reached only under load
431
351
  scale_down_after 30 # seconds idle before an extra worker retires
432
352
  ```
433
353
 
434
- Or `Kino::Server.new(app, workers: 4, max_workers: 16)`. Leave
435
- `max_workers` unset and the pool is fixed at `workers`, as before.
354
+ While requests wait in the queue, Kino adds a worker every 100 ms.
355
+ **Use it when your app waits**: on databases, upstream services, slow
356
+ clients. [Elastic pool](doc/operations.md#elastic-pool-experimental).
436
357
 
437
- While requests wait in the queue, Kino adds a worker every 100 ms until
438
- the queue clears or the pool hits `max_workers`. When the load passes,
439
- workers above `workers` retire one at a time after `scale_down_after`
440
- seconds idle, each finishing its current request first. Same behavior
441
- in `:ractor` and `:threaded` mode.
358
+ ## Stuck-worker quarantine
442
359
 
443
- **Use it when your app waits**: on databases, upstream services, slow
444
- clients. With `workers` at your core count, all workers can be blocked
445
- on I/O while cores sit idle; a higher ceiling puts those cores to work,
446
- and a ractor starts in microseconds, so the pool follows load closely.
447
- Pure CPU work gains nothing past the core count. In `:ractor` mode Ruby
448
- itself runs at most `RUBY_MAX_CPU` ractors' Ruby code at once (default
449
- 8), and Kino warns at boot when the pool can exceed it. On a bigger box:
360
+ `quarantine_timeout 60` quarantines a dispatch slot whose request has
361
+ run past the deadline and spawns a replacement worker to restore
362
+ capacity; the wedged worker is never interrupted or force-killed.
363
+ [Quarantine](doc/operations.md#stuck-worker-quarantine).
450
364
 
451
- ```sh
452
- RUBY_MAX_CPU=16 kino
453
- ```
365
+ ## Stats
454
366
 
455
- **Watch it breathe** in `server.stats`, `GET /stats` and `GET /metrics`:
367
+ `server.stats` returns a live snapshot, and `kill -USR1 <pid>` logs it
368
+ as one line. `control_bind "127.0.0.1:9293"` serves a read-only
369
+ **control plane** from the native layer on its own thread, so it keeps
370
+ answering even while every Ruby worker is busy or stuck: `/stats` as
371
+ JSON, `/metrics` for Prometheus, and `/ready` and `/live` probes.
372
+ [Every counter](doc/operations.md#stats).
456
373
 
457
374
  ```sh
458
- $ curl -s localhost:9293/stats | jq '{workers, max_workers, active_workers, scale_ups, scale_downs}'
375
+ $ curl -s localhost:9293/stats | jq '{state, mode, workers, queued, in_flight, served, rejected}'
459
376
  {
460
- "workers": 4,
461
- "max_workers": 16,
462
- "active_workers": 9,
463
- "scale_ups": 12,
464
- "scale_downs": 7
377
+ "state": "ready",
378
+ "mode": "ractor",
379
+ "workers": 8,
380
+ "queued": 0,
381
+ "in_flight": 0,
382
+ "served": 200,
383
+ "rejected": 0
465
384
  }
466
385
  ```
467
386
 
468
- Prometheus gets `kino_max_workers`, `kino_active_workers`,
469
- `kino_scale_ups_total` and `kino_scale_downs_total`. `after_worker_boot`
470
- fires for every worker the pool adds, `on_worker_exit` (with a nil
471
- cause) for every one it retires.
387
+ ## Logging
472
388
 
473
- ## Stuck-worker quarantine
389
+ With one log line per request, `Kino::Logger` sustained **1.7× the
390
+ throughput of a shared `::Logger`** (155k vs 90k req/s on the 2026-09
391
+ c7a.2xlarge benchmark box): a lock-free channel feeds a Rust flusher
392
+ thread, so request threads never take a log mutex and never make a
393
+ write syscall. `log_requests true` adds an access log with a timing
394
+ breakdown:
474
395
 
475
- `quarantine_timeout: seconds` (or `quarantine_timeout 60` in `kino.rb`)
476
- quarantines a dispatch slot whose request has run longer than the deadline
477
- and spawns a replacement worker to restore capacity—distinct from
478
- `request_timeout`, which gives the client a 504 but leaves the slot
479
- occupied. `quarantine_max` (default: the worker count in `:ractor` mode,
480
- workers × threads in `:threaded`) caps the total number of replacement
481
- events over the process lifetime—past it the monitor stops replacing and
482
- the server runs at reduced capacity.
483
-
484
- The wedged worker is never interrupted or force-killed, and its slot stays
485
- quarantined for good. In `:threaded` mode, if the blocked thread
486
- eventually returns, it keeps serving requests on that same slot—but the
487
- slot itself stays flagged quarantined (busy_ms reported as 0) for the rest
488
- of the process; in `:ractor` mode the wedged ractor (and its supervisor
489
- thread) leaks until the process exits, since a wedged ractor cannot be
490
- safely interrupted. Monitor quarantine activity via `server.stats`
491
- (top-level `quarantined` count and per-slot `worker_status[].quarantined`
492
- flag), `GET /stats` (same), and `GET /metrics` (`kino_quarantined_workers`
493
- gauge and `kino_quarantine_replacements_total` counter).
396
+ ```
397
+ 2026-08-22 14:03:11 +0300 → GET /users?q=1 from 127.0.0.1
398
+ 2026-08-22 14:03:11 +0300 ← 200 GET /users?q=1 12.4ms (ruby 9.1ms [gc 0.8ms; 1.5k obj]; kino 3.2ms; wait 0.1ms)
399
+ ```
494
400
 
495
- ## Stats
401
+ Rails and Rack setup, the trade-offs and Kino's own server lines:
402
+ [Logging](doc/operations.md#logging).
496
403
 
497
- `server.stats` returns a live snapshot: the configuration plus counters
498
- from the native layer (one relaxed atomic per request, no measurable
499
- cost):
404
+ ## Timer waits
500
405
 
501
- ```ruby
502
- server.stats
503
- # => {mode: :ractor, lanes: false, workers: 8, threads: 1, batch: 1,
504
- # respawns: 0, queued: 0, in_flight: 2, served: 1041, rejected: 0,
505
- # timeouts: 0, worker_status: [...]}
506
- # plus lane_depths: [...] when lane dispatch is on
507
- ```
406
+ `Kino.sleep(seconds)` is a high-resolution sleep on the OS clock with
407
+ the GVL released, for explicit timer waits in handlers, as MRI's own
408
+ `sleep` wakes up late inside non-main ractors
409
+ ([numbers](doc/benchmarks.md#why-io-lags-in-ractor-mode-on-linux)).
410
+ Ordinary blocking I/O does not need it, and under a
411
+ [`worker_loop`](doc/worker-loop.md#waiting-the-right-way) use `sleep`.
508
412
 
509
- From the outside, `kill -USR1 <pid>` logs the same snapshot as one line
510
- (pair it with `pidfile` to find the pid):
413
+ ## Rack 3 compliance
511
414
 
512
- ```
513
- kino[4213] main: stats mode=:ractor lanes=false workers=8 threads=1 batch=1 respawns=0 queued=0 in_flight=2 served=1041 rejected=0 timeouts=0
514
- ```
415
+ The spec suite runs every test app under `Rack::Lint` over real sockets:
416
+ streaming request bodies, enumerable and callable response bodies,
417
+ lowercase and multi-value headers, HEAD/204 semantics, and
418
+ `rack.hijack`, full and partial, on HTTP/1.1 requests that ask to
419
+ upgrade ([Rack 3](doc/streaming.md#rack-3-compliance)).
515
420
 
516
- For pull-based monitoring, `control_bind "127.0.0.1:9293"` (or a
517
- `unix://` path) serves a read-only **control plane** from the native
518
- layer on its own thread—it keeps answering even while every Ruby worker
519
- is busy or stuck, and reports `draining` through a graceful shutdown:
520
-
521
- - `GET /stats`—the same snapshot as `server.stats`, as JSON (plus
522
- `state` and `version`).
523
- - `GET /metrics`—Prometheus text format (`kino_requests_served_total`,
524
- `kino_queue_depth`, `kino_ready`, …).
525
-
526
- Both `/stats` and `/metrics` also break the counters down per dispatch
527
- slot: `/stats` carries a `worker_status` array (`index`, `served`,
528
- `in_flight`, `busy_ms`) and `/metrics` emits `kino_worker_*{worker="N"}`
529
- series, one entry per execution slot (`workers × threads`)—a crashed
530
- worker's slot is never reused, so it stays in the list with its counters
531
- frozen where they stopped, meaning the array (and its `worker="N"` metric
532
- series) grows by one across every respawn. `busy_ms` is how long the
533
- slot's current request has been running (0 when idle), so a single slot
534
- climbing while the rest sit at 0 is your stuck worker.
535
-
536
- The `/stats` response and `server.stats` carry `queue_time` (count and
537
- summed seconds), and `/metrics` exposes `kino_request_queue_seconds`—a
538
- Prometheus histogram of queue-wait time, the worker-saturation signal.
539
- Counts admitted requests only; a 503 after queue wait goes to `rejected`,
540
- not `queue_time`.
541
-
542
- - `GET /ready`—`200` when serving, `503` while booting or draining:
543
- wire it to your load balancer or Kubernetes readiness probe.
544
- - `GET /live`—`200` whenever the process is alive: the liveness probe.
545
-
546
- `control_token "..."` puts `/stats` and `/metrics` behind
547
- `Authorization: Bearer`; the probes stay open.
421
+ ## Streaming responses
548
422
 
549
- ## Logging
423
+ A body that does not respond to `to_ary` streams, and a client slower
424
+ than the app makes the next write wait for it, with the GVL released.
425
+ Once the client has gone, the next write raises `Kino::ClientGone`, so
426
+ an endless server-sent event feed or LLM token stream ends there and
427
+ frees its worker ([Streaming](doc/streaming.md#streaming-responses)).
550
428
 
551
- With one log line per request, `Kino::Logger` sustained **1.7× the
552
- throughput of a shared `::Logger`** (155k vs 90k req/s on the benchmark
553
- box). There are two native pieces. Both write through a lock-free
554
- channel to a Rust flusher thread, so request threads never take a log
555
- mutex and never make a write syscall:
556
-
557
- - **Access log** (`log_requests true`): two records per request to
558
- stdout, including the 503s that never reach your app. The arrival line
559
- is queued before the app runs, so a request that hangs shows as an
560
- arrow with no answer; the completion line carries the status, the
561
- total, and a timing breakdown: `ruby` is the time the request spent in
562
- Ruby (with the GC pause and the objects allocated during it), `kino`
563
- the server's own overhead, `wait` the queue time before a worker took
564
- it. Recommended in development; cheap enough for production. On color
565
- terminals the completion line is tinted by status class: 2xx green,
566
- 3xx yellow, 4xx maroon, 5xx bright red:
567
-
568
- ```
569
- 2026-08-22 14:03:11 +0300 → GET /users?q=1 from 127.0.0.1
570
- 2026-08-22 14:03:11 +0300 ← 200 GET /users?q=1 12.4ms (ruby 9.1ms [gc 0.8ms; 1.5k obj]; kino 3.2ms; wait 0.1ms)
571
- ```
572
-
573
- The GC and allocation figures come from the VM's process-wide
574
- counters, so they appear only where one request at a time can own
575
- them: in `:threaded` mode, or in `:ractor` mode with `workers 1`.
576
- Parallel ractors would bill each other's work, so there the breakdown
577
- is `(ruby; kino; wait)` alone.
578
-
579
- - **`Kino::Logger`**: a `::Logger` over the same async sink, for your
580
- app's own logging (`Kino::Logger.new("log/production.log")`, or no
581
- argument for stdout). The raw IO-like device is `Kino::Logger::Device`,
582
- for integrations that want bytes without `::Logger` formatting. The
583
- device is frozen and Ractor-shareable, so one device serves every
584
- worker.
585
-
586
- `Kino::Logger` in a **Rails** app: it is a real `::Logger` subclass, so
587
- it fits anywhere Rails expects a logger:
429
+ ## WebSockets (experimental)
588
430
 
589
- ```ruby
590
- # config/environments/production.rb, simplest forms:
591
- config.logger = Kino::Logger.new # stdout
592
- config.logger = Kino::Logger.new("log/production.log") # file
593
- # both file and stdout:
594
- config.logger = ActiveSupport::BroadcastLogger.new(
595
- Kino::Logger.new("log/production.log"), Kino::Logger.new
596
- )
597
- # tagged logging wraps it like any ::Logger:
598
- config.logger = ActiveSupport::TaggedLogging.new(Kino::Logger.new)
599
- ```
600
-
601
- From a plain **Rack** app, give middleware the logger, or hand
602
- `Rack::CommonLogger` the raw device (it just calls `write`):
431
+ Kino runs WebSockets natively: Rust does the handshake, framing, pings,
432
+ the close handshake and topic fan-out, and your callbacks run on the
433
+ worker that accepted the socket, so an idle socket costs Ruby nothing.
434
+ Native WebSockets need `lanes true`; Action Cable and other libraries
435
+ with their own stack get `rack.hijack` in either mode.
603
436
 
604
437
  ```ruby
605
- # config.ru
606
- use Rack::CommonLogger, Kino::Logger::Device.new # access-style app log
607
- run MyApp
438
+ module Chat
439
+ def self.on_open(ws) = ws.subscribe("chat")
440
+ def self.on_message(ws, data) = Kino::WebSocket.publish("chat", data)
441
+ end
442
+
443
+ app = Ractor.shareable_proc do |env|
444
+ if env["rack.upgrade?"] == :websocket
445
+ env["rack.upgrade"] = Chat
446
+ [101, {}, []] # the headers go into the 101; the status is ignored
447
+ else
448
+ [200, {"content-type" => "text/plain"}, ["hello"]]
449
+ end
450
+ end
608
451
  ```
609
452
 
610
- (If you only want request lines, prefer Kino's own `log_requests true`.
611
- It is free for your Ruby threads, and it also sees the 503s that never
612
- reach Rack.)
613
-
614
- Graceful shutdown drains both logs fully. A hard crash can lose the tail
615
- of the buffer, and when you log faster than the disk can take (over 100k
616
- lines/s), the sink drops lines instead of blocking request threads.
617
- These trade-offs are measured in
618
- [doc/benchmarks.md](doc/benchmarks.md#logging-costs).
619
-
620
- **Server lines.** Everything Kino says about itself (draining, a crash
621
- and its respawn, a hook that raised, quarantine, the stats line,
622
- `rack.errors`) reads `kino[<pid>] <source>: message`, the source being
623
- the worker that spoke, `worker-3` (or `worker-3/thread-2` in a
624
- multi-threaded ractor), or `main`. On color terminals the label is dim
625
- for notes, yellow for warnings, red for errors; the message stays plain.
626
- A failed request gets a report instead of a bare backtrace: the request
627
- line, the error, and where it raised in your code, then the trace with
628
- your frames first, relative to the working directory, and the rest
629
- folded:
453
+ [doc/websockets.md](doc/websockets.md) is the guide: callbacks, flow
454
+ control, topics, limits, close codes, `rack.hijack` and Action Cable.
630
455
 
631
- ```
632
- kino[4213] worker-2: 500 GET /boom · RuntimeError: kaboom (app.rb:12:in 'explode')
633
- app.rb:12:in 'explode'
634
- /usr/lib/ruby/gems/4.0.0/gems/rack-3.2.7/lib/rack/builder.rb:...
635
- … 38 more
636
- ```
456
+ ## Fibers inside Kino workers (experimental)
637
457
 
638
- Hooks can log through the same channel with `Kino::Log.info`, `.warn`,
639
- and `.error`; it is safe inside worker ractors.
458
+ With `worker_loop`, your own fiber scheduler runs inside each worker. A
459
+ request that waits (a database permit, an upstream call, a slow client)
460
+ suspends only its fiber, and the worker takes the next request
461
+ meanwhile, with no extra thread and no extra wake-up per request. Kino
462
+ still owns the Ractors, threads, dispatch and HTTP, and ships no
463
+ scheduler and depends on none; Async is the example:
640
464
 
641
- ## Timer waits
465
+ ```ruby
466
+ # kino.rb
467
+ require "async"
642
468
 
643
- `Kino.sleep(seconds)` is a high-resolution sleep on the OS clock with
644
- the GVL released. MRI's own `sleep` wakes up late inside non-main
645
- ractors (details and numbers in [doc/benchmarks.md](doc/benchmarks.md)).
646
- Use `Kino.sleep` for explicit timer waits in handlers. Ordinary blocking
647
- I/O does not need it.
469
+ threads 1
470
+ worker_loop Ractor.shareable_proc { |worker|
471
+ Sync do |task|
472
+ worker.serve(concurrency: 32) { |job| task.async { job.call } }
473
+ end
474
+ }
475
+ ```
648
476
 
649
- ## Rack 3 compliance
477
+ [doc/worker-loop.md](doc/worker-loop.md) is the guide.
650
478
 
651
- The spec suite runs every test app under `Rack::Lint` over real sockets:
652
- streaming request bodies (forward-only `rack.input`), enumerable and
653
- callable (full-duplex stream) response bodies, lowercase and multi-value
654
- headers, HEAD/204 semantics. Full hijack is left out on purpose; it is
655
- optional in Rack 3.
479
+ ### Inline connections
480
+
481
+ A `worker_loop` server serves plain HTTP/1.1 connections on its worker
482
+ threads, with nothing to configure and no hand-off, wake-up or task per
483
+ request. TLS, HTTP/2 and anything outside a strict subset of HTTP/1.1
484
+ stay with hyper ([Inline connections](doc/worker-loop.md#inline-connections)).
656
485
 
657
486
  ## Rails
658
487
 
659
- Rails (edge) runs on Kino today in `:threaded` mode (`rails server -u
660
- kino`, or the `kino` CLI); see `examples/rails-hello`. Ractor-mode Rails
661
- is blocked upstream. The exact
662
- blockers, the `Ruby::Box` findings, and what would unlock it are written
663
- up in [doc/rails-on-ractors.md](doc/rails-on-ractors.md). The example
664
- ships a probe script that re-tests against whatever Rails you bundle.
488
+ Rails main partially runs on Ractors: `Rails.application.ractorize!`
489
+ makes a production app shareable, and `examples/rails-hello` runs in
490
+ `:ractor` mode with Active Record on SQLite and a live feed over Kino's
491
+ native WebSockets, following Shopify's
492
+ [ractor-safe-rails](https://github.com/Shopify/ractor-safe-rails)
493
+ template. Apps that need what is not Ractor-safe yet, such as Action
494
+ Cable, stay on `:threaded`, where Action Cable runs unmodified
495
+ ([what works](doc/rails-on-ractors.md)).
665
496
 
666
497
  ## Development
667
498
 
@@ -681,7 +512,7 @@ For the Rust network stack, thanks to [Sean McArthur](https://github.com/seanmon
681
512
 
682
513
  ## Assisted by
683
514
 
684
- Claude Code (Fable 5, Opus 4.8).
515
+ Claude Code (Fable 5.2, Opus 5.5).
685
516
 
686
517
  ## Contributing
687
518