raptor 0.8.0 → 0.10.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: 1b7d4b6790a256864f0c2b4e8d061231c372a110493ef2846f547f4566232d5d
4
+ data.tar.gz: dc6454ad796395d9eb7ab81327410ddd2004f0e1dd0bb03857636c508e84f7bc
5
5
  SHA512:
6
- metadata.gz: c5d04b6d4412b95b4131bcdcd6223a0b96ecc906a53a2522b1423195c4cd9b0746998d6d0588f6cf01a269eca4c67af091fd649512080ea98376de099d8eb291
7
- data.tar.gz: 0e6b0fc536dccbe056c178bace6040550598aedf56ca05434714b299c09d7795092a85a41f6ffe7cb8e9a79ce6e88bd14ba231ce8a5afa6049ca4788ee6648fe
6
+ metadata.gz: 6c0198c8697a569b7caf4492cf80c64edfbe7e6d0c1b4d7be7880175655bfa36b89040d3ab5b9597db995ac469eed26a1c74b7bb7c0c3206c9c47193b3930a48
7
+ data.tar.gz: 6a73d6a927a118dea756b8012108dbdaf1f2462ea9ea5a6fbd4dabd56cfffa51a23f059f2c51c39cd5a4f41a3fc0e752022cd1963115edacecb3cd53e56b83fe
@@ -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,27 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.10.0] - 2026-07-07
4
+
5
+ - Memoize the server port string for the Rack env
6
+ - Parse the Host header without regex
7
+ - Apply `TCP_NODELAY` on the listener rather than each accepted socket
8
+ - Buffer chunked body writes up to 512KB before flushing
9
+ - Add `QUERY_STRING` to the Rack env template
10
+ - Skip intermediate array allocations when formatting response headers
11
+ - Intern common HTTP header keys in the parser
12
+ - Reuse a Rack env template across HTTP/1.1 requests
13
+
14
+ ## [0.9.0] - 2026-07-07
15
+
16
+ - Reuse a per-thread response buffer for status lines and headers
17
+ - Pin each worker to a distinct CPU when workers fit 1:1
18
+ - Batch response header and body writes into a single `writev(2)` syscall
19
+ - Close the binder as the last step of graceful shutdown
20
+ - Lower the backpressure floor for tighter load balancing on small pools
21
+ - Add load-aware `SO_REUSEPORT` routing on Linux via an attached BPF program
22
+ - Reuse per-thread read buffers across HTTP/1.1 requests
23
+ - Preserve the first `--bind` when it equals the default
24
+
3
25
  ## [0.8.0] - 2026-07-02
4
26
 
5
27
  - 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,20 @@ 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.10.0 vs Puma 8.0.2, median of 3 runs across two workload profiles: IO-bound (sleep for a random 5-50ms then
191
+ return small JSON) and CPU-bound (serialise a JSON array of 20-200 items).
191
192
 
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 |
193
+ | Protocol | Workload | Raptor | Puma | +/- vs Puma |
194
+ | --------------------- | -------- | ------------ | ------------ | ----------- |
195
+ | HTTP/1.1 | IO | 0.43k req/s | 0.41k req/s | +4.0% |
196
+ | HTTP/1.1 | CPU | 10.99k req/s | 9.22k req/s | +19.1% |
197
+ | HTTP/1.1 (keep-alive) | IO | 0.41k req/s | 0.40k req/s | +2.6% |
198
+ | HTTP/1.1 (keep-alive) | CPU | 27.42k req/s | 25.75k req/s | +6.5% |
199
+ | HTTP/2 | IO | 0.31k req/s | N/A | - |
200
+ | HTTP/2 | CPU | 26.28k req/s | N/A | - |
197
201
 
198
- > ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [arm64-darwin23]
199
- > 4 workers, 3 threads, 12 concurrent connections
202
+ > ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [aarch64-linux]
203
+ > 4 workers, 3 threads, 24 concurrent connections
200
204
 
201
205
  See [bin/benchmark](bin/benchmark) for more details.
202
206
 
@@ -206,6 +210,10 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
206
210
  extensions and run the tests. You can also run `bin/console` for an interactive prompt that will allow you to
207
211
  experiment.
208
212
 
213
+ On macOS (or any non-Linux host), `bin/dev` builds and drops you into a Docker image with Ruby and the required Linux
214
+ toolchain preinstalled, mounting the repo at `/workspace`. Run `bin/dev` for an interactive shell, or
215
+ `bin/dev <command>` for one-off commands like `bin/dev bundle exec rake` or `bin/dev bin/benchmark`.
216
+
209
217
  ## Contributing
210
218
 
211
219
  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]