kino 0.4.0-aarch64-linux → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 145273ae455b0822a24794c25d449376b3ba5122f3f275c00b4a959fdafd5183
4
- data.tar.gz: c20ae1c2f111a4f6329ea25a4d9c9a0579dfa1b77765ff11e35572f8e32925ca
3
+ metadata.gz: d9cb260754fbbffdbf123d4f654ae41c92a001fcf14acb5c2bcc75275a51687a
4
+ data.tar.gz: 17e23ec4d2cccce26863df15c275d6e300e8d4327c89e340f22c47e6e7f707ae
5
5
  SHA512:
6
- metadata.gz: ed2ef3b3d79817b67da62e8271f0a420d4ee0c8976780d97e6e91ba15cddff2e1d34e830d41a8c4c8c63d65fecbeab32bec8d8568777b399c684cdfce00624f0
7
- data.tar.gz: 6d695d16998c2bdb9fe44ac709a311990c53c88ae980f136757db926ba370e5a8e379fdd098f675beae4fb126a0ce7d663b36b0a602d6933b1c2b6d3f6cdc02b
6
+ metadata.gz: fa65e8268d3e0f8c295f42b5875b75d2dc9cbdb6d768228ee12ee7c155af2a3bfbda5bc451c13ee1ad937ad7ac2d48b0dff1529e32586c9ca23f1784e2bb885c
7
+ data.tar.gz: fbad5b1bbc64478792677b472b4120e73ed25d731c3a2524c4ba6601a059a5ac08b028e78b7f1e5071fd6e29ac28ad437644da02ec867f5a6b0b912cdff4f982
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## [0.5.0] - 2026-08-29
2
+
3
+ - Add opt-in `io_shards true`: accepted HTTP connections can run on
4
+ current-thread Tokio I/O shards instead of Tokio's shared multi-thread
5
+ runtime, reducing scheduler contention on very fast handlers. `io_threads`
6
+ sets the shard count; otherwise Kino uses half the available CPUs
7
+ ([Patrik Wenger](https://github.com/paddor)).
8
+ - Update Rust dependencies: hyper 1.11.1, rb-sys 0.9.130,
9
+ rustls-webpki 0.103.15, among others.
10
+
1
11
  ## [0.4.0] - 2026-08-22
2
12
 
3
13
  - Rack handler: `rails server -u kino` and `rackup -s kino` boot Kino
data/README.md CHANGED
@@ -259,6 +259,21 @@ server.shutdown # graceful: drain → deadline → abort straggler
259
259
  always counts as "shareable" (classes are), even if calling it touches
260
260
  unshareable state. Force `:threaded` for those.
261
261
 
262
+ ### Sharded I/O
263
+
264
+ `io_shards true` (off by default) moves HTTP I/O from Tokio's shared
265
+ multi-thread runtime onto current-thread shards: one thread accepts and
266
+ hands each connection to the least-loaded shard, which then owns it for
267
+ its lifetime—no work-stealing, no cross-thread wakeups on the hot path.
268
+ Fast handlers gain double-digit throughput; Ruby-bound endpoints are
269
+ unchanged. Orthogonal to `mode`: it reshapes the Rust side only.
270
+
271
+ ```ruby
272
+ # kino.rb
273
+ io_shards true
274
+ io_threads 4 # optional; default: half the available CPUs
275
+ ```
276
+
262
277
  ## Config file and CLI
263
278
 
264
279
  Settings can live in a Puma-style Ruby DSL file: `kino.rb` in the
data/doc/architecture.md CHANGED
@@ -11,10 +11,13 @@ tokio (Rust threads) Ruby
11
11
  └──────────────────────────┘ └────────────────────────────┘
12
12
  ```
13
13
 
14
- All network I/O lives in Rust on a tokio multi-threaded runtime; hyper
15
- parses HTTP/1.1 and handles keep-alive; rustls terminates TLS. Ruby never
16
- touches a socket. Each request becomes a Rust-side `RequestCtx` pushed to a
17
- bounded flume MPMC queue; Ruby workers pull from it.
14
+ All network I/O lives in Rust on tokio runtimes; hyper parses HTTP/1.1 and
15
+ handles keep-alive; rustls terminates TLS. The default is Tokio's
16
+ multi-thread runtime. With `io_shards true`, one current-thread runtime
17
+ accepts connections and assigns them to current-thread I/O shards, where
18
+ each connection stays for its lifetime. Ruby never touches a socket. Each
19
+ request becomes a Rust-side `RequestCtx` pushed to a bounded flume MPMC
20
+ queue; Ruby workers pull from it.
18
21
 
19
22
  ## Topology
20
23
 
@@ -26,6 +26,8 @@ module Kino
26
26
  after_request_complete: nil,
27
27
  on_worker_exit: nil,
28
28
  shutdown_timeout: 30,
29
+ io_shards: false,
30
+ io_threads: nil,
29
31
  tokio_threads: nil,
30
32
  tls: nil,
31
33
  environment: nil,
@@ -148,6 +150,8 @@ module Kino
148
150
  # queue_depth 2048
149
151
  # queue_timeout 0.5
150
152
  # shutdown_timeout 15
153
+ # io_shards true
154
+ # io_threads 6
151
155
  # tokio_threads 4
152
156
  # tls cert: "cert.pem", key: "key.pem"
153
157
  #
@@ -229,6 +233,12 @@ module Kino
229
233
  # Graceful-shutdown drain deadline in seconds.
230
234
  def shutdown_timeout(seconds) = @config.set(:shutdown_timeout, seconds)
231
235
 
236
+ # Run native HTTP I/O on current-thread shards instead of Tokio's shared pool.
237
+ def io_shards(enabled = true) = @config.set(:io_shards, !!enabled)
238
+
239
+ # Native HTTP I/O shard count; default with io_shards: half available CPUs.
240
+ def io_threads(count) = @config.set(:io_threads, Integer(count))
241
+
232
242
  # Threads for the tokio (Rust I/O) runtime; default: one per core.
233
243
  def tokio_threads(count) = @config.set(:tokio_threads, Integer(count))
234
244
 
data/lib/kino/kino.so CHANGED
Binary file
data/lib/kino/server.rb CHANGED
@@ -98,6 +98,12 @@ module Kino
98
98
  @lanes = !!settings[:lanes]
99
99
  @log_requests = !!settings[:log_requests]
100
100
  @shutdown_timeout = settings[:shutdown_timeout]
101
+ @io_shards = !!settings[:io_shards]
102
+ @io_threads = Integer(settings[:io_threads]) unless settings[:io_threads].nil?
103
+ if @io_threads && @io_threads < 1
104
+ raise ArgumentError, "io_threads must be >= 1"
105
+ end
106
+ Log.warn("io_threads has no effect unless io_shards is true") if @io_threads && !@io_shards
101
107
  @tokio_threads = settings[:tokio_threads]
102
108
  @tls = validate_tls(settings[:tls])
103
109
  if @tls && unix?
@@ -145,6 +151,8 @@ module Kino
145
151
  request_timeout_ms: @request_timeout_ms,
146
152
  max_connections: @max_connections,
147
153
  max_body_size: @max_body_size,
154
+ io_shards: @io_shards,
155
+ io_threads: @io_threads,
148
156
  tokio_threads: @tokio_threads,
149
157
  tls_cert: @tls&.fetch(:cert), tls_key: @tls&.fetch(:key),
150
158
  lanes: @lanes, log_requests: @log_requests,
@@ -125,8 +125,14 @@
125
125
 
126
126
  ## Runtime
127
127
 
128
- # Threads for the Rust I/O engine. The default suits most apps; for
129
- # heavily CPU-bound apps, try 1 to leave more cores for Ruby.
128
+ # Run native HTTP I/O on current-thread shards instead of Tokio's shared
129
+ # worker pool, reducing scheduler contention on very fast handlers.
130
+ # io_shards true
131
+
132
+ # I/O shard count. Default with io_shards: half available CPUs.
133
+ # io_threads 6
134
+
135
+ # Threads for the Tokio multi-thread runtime. Default: one per available CPU.
130
136
  # tokio_threads 4
131
137
 
132
138
  ## Control plane
data/lib/kino/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Kino
4
4
  # The gem version (single source of truth; ext/kino/Cargo.toml syncs).
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
data/sig/kino.rbs CHANGED
@@ -126,6 +126,8 @@ module Kino
126
126
  def after_request_complete: (?^(Hash[String, untyped], Integer) -> void handler) ?{ (Hash[String, untyped], Integer) -> void } -> untyped
127
127
  def on_worker_exit: (?^(Integer, Exception?) -> void handler) ?{ (Integer, Exception?) -> void } -> untyped
128
128
  def shutdown_timeout: (Numeric seconds) -> untyped
129
+ def io_shards: (?boolish enabled) -> untyped
130
+ def io_threads: (int? count) -> untyped
129
131
  def tokio_threads: (int count) -> untyped
130
132
  def tls: (cert: String, key: String) -> untyped
131
133
  def environment: (String | Symbol env) -> untyped
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Yaroslav Markin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-08-22 00:00:00.000000000 Z
11
+ date: 2026-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger