raptor 0.5.1 → 0.6.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: 39d5ba6964929954d0c4b4cafa93249bd71c1750a56a07f2947fee2e493f037f
4
- data.tar.gz: b9bd3c49e4dfefc990e50d14b631b1d73d697da3d236ee5c38424f57e6c686cd
3
+ metadata.gz: 7a43fe40aecdcdd5ff72bf3ecfde433611877d563e483163b868efcf0870ae39
4
+ data.tar.gz: 9e7e6761bb6cee495f6081715461cc10b4c8ebf1e6480e7f5b1c80715d28337b
5
5
  SHA512:
6
- metadata.gz: dac6fd0c4f5e0005a159103c9d27986cf322ffc44da4f5e4481751d3e38318c521fa094eb83134592c12132ab963336a75bf0350e82e59cefda4a9703b830314
7
- data.tar.gz: 2d24b52bc8700740d9ee479894159e8434012036c494889f012efbf1e5b90ea0e03968a09a5270330939f402148ea63fc4924c1951e7743e59cf4957bcec6f6c
6
+ metadata.gz: 5f792cac133140519597d727972b649781288fc2ccc4d60243bf53502a33b8a764494e2b148f1f992a3af42002a8b2b52d535dad8ee988bd7725f100541ed6ff
7
+ data.tar.gz: 1a0715da97c2c325ba70e5daa77c89d6169991034bd83f78ba1f86956e996e0a153b468e296288ba4d2a991499319628231d81b3695db2a57b8e8138ee4ac094
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.6.0] - 2026-06-02
4
+
5
+ - Raise the backpressure threshold floor so low thread counts don't throttle prematurely
6
+
3
7
  ## [0.5.1] - 2026-05-31
4
8
 
5
9
  - Fix `LoadError` when requiring the native extensions from an installed gem
data/README.md CHANGED
@@ -31,7 +31,7 @@ run proc { |_env| [200, { "content-type" => "text/plain" }, ["Hello, World!"]] }
31
31
  ```
32
32
  > bundle exec raptor -w 4 -t 3 hello_world.ru
33
33
  [Raptor 91348|main|main] Cluster initializing:
34
- [Raptor 91348|main|main] ├─ Version: 0.5.1
34
+ [Raptor 91348|main|main] ├─ Version: 0.6.0
35
35
  [Raptor 91348|main|main] ├─ Ruby Version: ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [arm64-darwin23]
36
36
  [Raptor 91348|main|main] ├─ Master PID: 91348
37
37
  [Raptor 91348|main|main] │ └─ 4 worker processes
@@ -62,12 +62,12 @@ Also works with `rackup` and `rails server`:
62
62
 
63
63
  ## (Micro) Benchmarks
64
64
 
65
- Raptor 0.5.1 vs Puma 8.0.2:
65
+ Raptor 0.6.0 vs Puma 8.0.2:
66
66
 
67
67
  | Protocol | Raptor | Puma |
68
68
  | --------------------- | ----------- | ----------- |
69
- | HTTP/1.1 | 20.1k req/s | 20k req/s |
70
- | HTTP/1.1 (keep-alive) | 61.4k req/s | 39.1k req/s |
69
+ | HTTP/1.1 | 20.2k req/s | 20k req/s |
70
+ | HTTP/1.1 (keep-alive) | 61.4k req/s | 39.2k req/s |
71
71
  | HTTP/2 | 22.8k req/s | N/A |
72
72
 
73
73
  > ruby 4.0.5 (2026-05-20 revision 64336ffd0e) +YJIT +PRISM [arm64-darwin23]
@@ -156,7 +156,7 @@ module Raptor
156
156
 
157
157
  stats_file_thread = if @stats_file
158
158
  Thread.new do
159
- Thread.current.name = "Raptor Stats File"
159
+ Thread.current.name = "Stats File Writer"
160
160
 
161
161
  write_stats_file_loop
162
162
  end
@@ -353,11 +353,10 @@ module Raptor
353
353
  request_count += 1
354
354
  @app.call(env)
355
355
  }
356
- thread_pool = AtomicThreadPool.new(name: "Raptor Workers", size: @thread_count)
356
+ thread_pool = AtomicThreadPool.new(size: @thread_count)
357
357
  request = Request.new(counting_app, @server_port, client_options: @client_options, on_error: @on_error)
358
358
  http2 = Http2.new(counting_app, @server_port, on_error: @on_error)
359
359
  ractor_pool = RactorPool.new(
360
- name: "Raptor Pipeline Workers",
361
360
  size: @ractor_count,
362
361
  worker: request.http_parser_worker
363
362
  ) do |parsed_result|
@@ -381,7 +380,7 @@ module Raptor
381
380
  Log.info "Worker #{index} booted"
382
381
 
383
382
  stats_thread = Thread.new do
384
- Thread.current.name = "Raptor Stats"
383
+ Thread.current.name = "Stats Writer"
385
384
 
386
385
  loop do
387
386
  @stats.write(
data/lib/raptor/log.rb CHANGED
@@ -40,14 +40,14 @@ module Raptor
40
40
  end
41
41
 
42
42
  # Builds the log line prefix from the current process, ractor,
43
- # and thread. Unnamed ractors and threads are reported as `main`.
43
+ # and thread. Unnamed ractors and threads are reported as `Main`.
44
44
  #
45
45
  # @return [String] the prefix
46
46
  #
47
47
  # @rbs () -> String
48
48
  def self.prefix
49
- ractor = Ractor.current.name || "main"
50
- thread = Thread.current.name || "main"
49
+ ractor = Ractor.current.name || "Main"
50
+ thread = Thread.current.name || "Main"
51
51
  "[Raptor #{Process.pid}|#{ractor}|#{thread}]"
52
52
  end
53
53
  private_class_method :prefix
@@ -116,7 +116,7 @@ module Raptor
116
116
  # @rbs () -> Thread
117
117
  def run
118
118
  Thread.new do
119
- Thread.current.name = self.class.name
119
+ Thread.current.name = "Reactor"
120
120
 
121
121
  until @queue.closed? && @queue.empty?
122
122
  begin
data/lib/raptor/server.rb CHANGED
@@ -35,6 +35,8 @@ module Raptor
35
35
  DEFAULT_REMOTE_ADDR = "127.0.0.1"
36
36
  DEFAULT_SERVER_NAME = "localhost"
37
37
 
38
+ MIN_BACKPRESSURE_THRESHOLD = 64
39
+
38
40
  # @rbs @binder: Binder
39
41
  # @rbs @reactor: Reactor
40
42
  # @rbs @thread_pool: AtomicThreadPool
@@ -73,7 +75,7 @@ module Raptor
73
75
  # @rbs () -> Thread
74
76
  def run
75
77
  Thread.new(@binder.listeners, @reactor, @running) do |server_sockets, reactor, running|
76
- Thread.current.name = self.class.name
78
+ Thread.current.name = "Server"
77
79
 
78
80
  while running.true?
79
81
  begin
@@ -83,7 +85,7 @@ module Raptor
83
85
  end
84
86
 
85
87
  next unless ready_servers
86
- next if @reactor.backlog >= (@thread_pool.size * 1.2).ceil
88
+ next if @reactor.backlog >= [(@thread_pool.size * 1.2).ceil, MIN_BACKPRESSURE_THRESHOLD].max
87
89
 
88
90
  ready_servers.each do |listener|
89
91
  accept_connection(listener, reactor)
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Raptor
5
- VERSION = "0.5.1"
5
+ VERSION = "0.6.0"
6
6
  end
@@ -31,7 +31,7 @@ module Raptor
31
31
  def self.rescued_error: (Exception error) -> void
32
32
 
33
33
  # Builds the log line prefix from the current process, ractor,
34
- # and thread. Unnamed ractors and threads are reported as `main`.
34
+ # and thread. Unnamed ractors and threads are reported as `Main`.
35
35
  #
36
36
  # @return [String] the prefix
37
37
  #
@@ -31,6 +31,8 @@ module Raptor
31
31
 
32
32
  DEFAULT_SERVER_NAME: ::String
33
33
 
34
+ MIN_BACKPRESSURE_THRESHOLD: ::Integer
35
+
34
36
  @running: AtomicBoolean
35
37
 
36
38
  @client_options: Hash[Symbol, untyped]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young