raptor 0.8.0 → 0.9.0

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: a9e7bfef1752060035a5e76f4d427097486aaa57c8bb184a47a3d8806d9749c8
4
- data.tar.gz: e7c86ec6597a2315d0352c90c0ea89451e7301a00cfb4592d6c63760686ac7e6
3
+ metadata.gz: 6dcf0e8beb3e5b74822eff407c51fbb0e83445ab54f75c37dad2cab2f9113ec5
4
+ data.tar.gz: 9131a6153b10e93e2e0b717355645fe485a1db0af52c3472f07a35fa4f95d64f
5
5
  SHA512:
6
- metadata.gz: c5d04b6d4412b95b4131bcdcd6223a0b96ecc906a53a2522b1423195c4cd9b0746998d6d0588f6cf01a269eca4c67af091fd649512080ea98376de099d8eb291
7
- data.tar.gz: 0e6b0fc536dccbe056c178bace6040550598aedf56ca05434714b299c09d7795092a85a41f6ffe7cb8e9a79ce6e88bd14ba231ce8a5afa6049ca4788ee6648fe
6
+ metadata.gz: 8a020f0e5c42eb4755a69c790f891aa334369d2ec58c063516893a53785574290feca84ebdd9d072b11601129f720eb2d82f52a7abbd7e0aa7bf79b17c57705c
7
+ data.tar.gz: 3b90235078097337dcade23681c4b3ae638d04094a40a5c21e81f8aac127bfa547dd8d07e7dac1adda539299ab62c3883d15d84a692942da2a1b69eed7946035
@@ -1,36 +1,94 @@
1
1
  steps:
2
- - label: ":ruby: Ruby 4.0"
3
- image: "ruby:4.0"
4
- commands:
5
- - ruby -v
6
- - bundle install
7
- - bundle exec rake ci
2
+ - group: ":linux: Linux"
3
+ key: linux
4
+ steps:
5
+ - label: ":ruby: Ruby 4.0"
6
+ image: "ruby:4.0"
7
+ commands:
8
+ - ruby -v
9
+ - bundle install
10
+ - bundle exec rake ci
8
11
 
9
- - label: ":ruby: Ruby 4.0 +YJIT"
10
- image: "ruby:4.0"
11
- env:
12
- RUBY_YJIT_ENABLE: "1"
13
- commands:
14
- - ruby -v
15
- - bundle install
16
- - bundle exec rake ci
12
+ - label: ":ruby: Ruby 4.0 +YJIT"
13
+ image: "ruby:4.0"
14
+ env:
15
+ RUBY_YJIT_ENABLE: "1"
16
+ commands:
17
+ - ruby -v
18
+ - bundle install
19
+ - bundle exec rake ci
17
20
 
18
- - label: ":ruby: Ruby head"
19
- soft_fail: true
20
- image: "rubylang/ruby:master-dev"
21
- commands:
22
- - apt-get update && apt-get install -y libyaml-dev
23
- - ruby -v
24
- - bundle install
25
- - bundle exec rake ci
21
+ - label: ":ruby: Ruby head"
22
+ soft_fail: true
23
+ image: "rubylang/ruby:master-dev"
24
+ commands:
25
+ - apt-get update && apt-get install -y libyaml-dev
26
+ - ruby -v
27
+ - bundle install
28
+ - bundle exec rake ci
26
29
 
27
- - label: ":ruby: Ruby head +YJIT"
28
- soft_fail: true
29
- image: "rubylang/ruby:master-dev"
30
- env:
31
- RUBY_YJIT_ENABLE: "1"
32
- commands:
33
- - apt-get update && apt-get install -y libyaml-dev
34
- - ruby -v
35
- - bundle install
36
- - bundle exec rake ci
30
+ - label: ":ruby: Ruby head +YJIT"
31
+ soft_fail: true
32
+ image: "rubylang/ruby:master-dev"
33
+ env:
34
+ RUBY_YJIT_ENABLE: "1"
35
+ commands:
36
+ - apt-get update && apt-get install -y libyaml-dev
37
+ - ruby -v
38
+ - bundle install
39
+ - bundle exec rake ci
40
+
41
+ - group: ":mac: macOS"
42
+ key: macos
43
+ steps:
44
+ - label: ":ruby: Ruby 4.0"
45
+ agents:
46
+ queue: macos
47
+ commands:
48
+ - brew install --quiet ruby@4.0
49
+ - export PATH="$(brew --prefix ruby@4.0)/bin:$PATH"
50
+ - bundle config set --local path .bundle
51
+ - ruby -v
52
+ - bundle install
53
+ - bundle exec rake ci
54
+
55
+ - label: ":ruby: Ruby 4.0 +YJIT"
56
+ agents:
57
+ queue: macos
58
+ env:
59
+ RUBY_YJIT_ENABLE: "1"
60
+ commands:
61
+ - brew install --quiet ruby@4.0
62
+ - export PATH="$(brew --prefix ruby@4.0)/bin:$PATH"
63
+ - bundle config set --local path .bundle
64
+ - ruby -v
65
+ - bundle install
66
+ - bundle exec rake ci
67
+
68
+ - label: ":ruby: Ruby head"
69
+ soft_fail: true
70
+ agents:
71
+ queue: macos
72
+ commands:
73
+ - brew unlink ruby
74
+ - brew install --HEAD --quiet ruby
75
+ - export PATH="$(brew --prefix ruby)/bin:$PATH"
76
+ - bundle config set --local path .bundle
77
+ - ruby -v
78
+ - bundle install
79
+ - bundle exec rake ci
80
+
81
+ - label: ":ruby: Ruby head +YJIT"
82
+ soft_fail: true
83
+ agents:
84
+ queue: macos
85
+ env:
86
+ RUBY_YJIT_ENABLE: "1"
87
+ commands:
88
+ - brew unlink ruby
89
+ - brew install --HEAD --quiet ruby
90
+ - export PATH="$(brew --prefix ruby)/bin:$PATH"
91
+ - bundle config set --local path .bundle
92
+ - ruby -v
93
+ - bundle install
94
+ - bundle exec rake ci
data/.dockerignore ADDED
@@ -0,0 +1,5 @@
1
+ /.bundle
2
+ /.git
3
+ /docs
4
+ /sig/generated
5
+ /tmp
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.9.0] - 2026-07-07
4
+
5
+ - Reuse a per-thread response buffer for status lines and headers
6
+ - Pin each worker to a distinct CPU when workers fit 1:1
7
+ - Batch response header and body writes into a single `writev(2)` syscall
8
+ - Close the binder as the last step of graceful shutdown
9
+ - Lower the backpressure floor for tighter load balancing on small pools
10
+ - Add load-aware `SO_REUSEPORT` routing on Linux via an attached BPF program
11
+ - Reuse per-thread read buffers across HTTP/1.1 requests
12
+ - Preserve the first `--bind` when it equals the default
13
+
3
14
  ## [0.8.0] - 2026-07-02
4
15
 
5
16
  - Add systemd `LISTEN_FDS` socket activation and `sd_notify` lifecycle messages
data/Dockerfile ADDED
@@ -0,0 +1,28 @@
1
+ FROM golang:bookworm AS hey-builder
2
+ RUN CGO_ENABLED=0 go install github.com/rakyll/hey@latest
3
+
4
+ FROM ruby:latest
5
+
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
+ ENV LANG=C.UTF-8
8
+ ENV LC_ALL=C.UTF-8
9
+ ENV RUBY_YJIT_ENABLE=1
10
+
11
+ RUN apt-get update && apt-get install -y --no-install-recommends \
12
+ clang \
13
+ libbpf-dev \
14
+ libelf-dev \
15
+ linux-libc-dev \
16
+ nghttp2 \
17
+ openssl \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ COPY --from=hey-builder /go/bin/hey /usr/local/bin/hey
21
+
22
+ ENV BUNDLE_PATH=/workspace/.bundle
23
+ ENV BUNDLE_APP_CONFIG=/workspace/.bundle
24
+ ENV PATH=/workspace/bin:${PATH}
25
+
26
+ WORKDIR /workspace
27
+
28
+ CMD ["bash"]
data/README.md CHANGED
@@ -37,7 +37,7 @@ run proc { |_env| [200, { "content-type" => "text/plain" }, ["Hello, World!"]] }
37
37
  ```
38
38
  > bundle exec raptor -w 4 -t 3 hello_world.ru
39
39
  [Raptor 76577|Main|Main] Cluster initializing:
40
- [Raptor 76577|Main|Main] ├─ Version: 0.8.0
40
+ [Raptor 76577|Main|Main] ├─ Version: 0.9.0
41
41
  [Raptor 76577|Main|Main] ├─ Ruby Version: ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [arm64-darwin23]
42
42
  [Raptor 76577|Main|Main] ├─ Environment: development
43
43
  [Raptor 76577|Main|Main] ├─ Master PID: 76577
@@ -187,16 +187,19 @@ Worker 1 (phase 0): pid=91351, requests=1199, busy=1/3, backlog=0, booted, last_
187
187
 
188
188
  ## (Micro) Benchmarks
189
189
 
190
- Raptor 0.8.0 vs Puma 8.0.2:
190
+ Raptor 0.9.0 vs Puma 8.0.2, median of 3 runs across two workload profiles: IO-bound (sleep for a random 5-50ms then return small JSON) and CPU-bound (serialise a JSON array of 20-200 items).
191
191
 
192
- | Protocol | Raptor | Puma |
193
- | --------------------- | ----------- | ----------- |
194
- | HTTP/1.1 | 18.1k req/s | 15.8k req/s |
195
- | HTTP/1.1 (keep-alive) | 58.2k req/s | 29.5k req/s |
196
- | HTTP/2 | 57k req/s | N/A |
192
+ | Protocol | Workload | Raptor | Puma | +/- vs Puma |
193
+ | --------------------- | -------- | ----------- | ---------- | ----------- |
194
+ | HTTP/1.1 | IO | 0.4k req/s | 0.4k req/s | +3.4% |
195
+ | HTTP/1.1 | CPU | 11.5k req/s | 9k req/s | +27.6% |
196
+ | HTTP/1.1 (keep-alive) | IO | 0.4k req/s | 0.4k req/s | +1.5% |
197
+ | HTTP/1.1 (keep-alive) | CPU | 28.8k req/s | 26k req/s | +10.9% |
198
+ | HTTP/2 | IO | 0.3k req/s | N/A | - |
199
+ | HTTP/2 | CPU | 29.6k req/s | N/A | - |
197
200
 
198
- > ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [arm64-darwin23]
199
- > 4 workers, 3 threads, 12 concurrent connections
201
+ > ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [aarch64-linux]
202
+ > 4 workers, 3 threads, 24 concurrent connections
200
203
 
201
204
  See [bin/benchmark](bin/benchmark) for more details.
202
205
 
@@ -206,6 +209,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
206
209
  extensions and run the tests. You can also run `bin/console` for an interactive prompt that will allow you to
207
210
  experiment.
208
211
 
212
+ On macOS (or any non-Linux host), `bin/dev` builds and drops you into a Docker image with Ruby and the required Linux
213
+ toolchain preinstalled, mounting the repo at `/workspace`. Run `bin/dev` for an interactive shell, or
214
+ `bin/dev <command>` for one-off commands like `bin/dev bundle exec rake` or `bin/dev bin/benchmark`.
215
+
209
216
  ## Contributing
210
217
 
211
218
  Bug reports and pull requests are welcome on GitHub at https://github.com/joshuay03/raptor. This project is intended to
data/Rakefile CHANGED
@@ -16,6 +16,24 @@ Rake::ExtensionTask.new("raptor_http2", GEMSPEC) do |ext|
16
16
  ext.lib_dir = "lib/raptor"
17
17
  end
18
18
 
19
+ Rake::ExtensionTask.new("raptor_native", GEMSPEC) do |ext|
20
+ ext.lib_dir = "lib/raptor"
21
+ end
22
+
23
+ namespace :bpf do
24
+ task :compile do
25
+ if RUBY_PLATFORM.include?("linux")
26
+ arch = `uname -m`.chomp
27
+ Dir["ext/raptor_bpf/*.bpf.c"].each do |source|
28
+ object = source.sub(/\.c\z/, ".o")
29
+ sh "clang -O2 -g -target bpf -I/usr/include/#{arch}-linux-gnu -c #{source} -o #{object}"
30
+ end
31
+ else
32
+ puts "Skipping bpf:compile on #{RUBY_PLATFORM}"
33
+ end
34
+ end
35
+ end
36
+
19
37
  namespace :rbs do
20
38
  task :generate do
21
39
  puts
@@ -23,6 +41,6 @@ namespace :rbs do
23
41
  end
24
42
  end
25
43
 
26
- task default: %i[clobber compile rbs:generate test]
44
+ task default: %i[clobber compile bpf:compile rbs:generate test]
27
45
  task build: %i[clobber compile rbs:generate]
28
46
  task ci: %i[clobber compile test]