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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -4
- data/lib/raptor/cluster.rb +3 -4
- data/lib/raptor/log.rb +3 -3
- data/lib/raptor/reactor.rb +1 -1
- data/lib/raptor/server.rb +4 -2
- data/lib/raptor/version.rb +1 -1
- data/sig/generated/raptor/log.rbs +1 -1
- data/sig/generated/raptor/server.rbs +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a43fe40aecdcdd5ff72bf3ecfde433611877d563e483163b868efcf0870ae39
|
|
4
|
+
data.tar.gz: 9e7e6761bb6cee495f6081715461cc10b4c8ebf1e6480e7f5b1c80715d28337b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f792cac133140519597d727972b649781288fc2ccc4d60243bf53502a33b8a764494e2b148f1f992a3af42002a8b2b52d535dad8ee988bd7725f100541ed6ff
|
|
7
|
+
data.tar.gz: 1a0715da97c2c325ba70e5daa77c89d6169991034bd83f78ba1f86956e996e0a153b468e296288ba4d2a991499319628231d81b3695db2a57b8e8138ee4ac094
|
data/CHANGELOG.md
CHANGED
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.
|
|
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.
|
|
65
|
+
Raptor 0.6.0 vs Puma 8.0.2:
|
|
66
66
|
|
|
67
67
|
| Protocol | Raptor | Puma |
|
|
68
68
|
| --------------------- | ----------- | ----------- |
|
|
69
|
-
| HTTP/1.1 | 20.
|
|
70
|
-
| HTTP/1.1 (keep-alive) | 61.4k req/s | 39.
|
|
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]
|
data/lib/raptor/cluster.rb
CHANGED
|
@@ -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 = "
|
|
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(
|
|
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 = "
|
|
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 `
|
|
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 || "
|
|
50
|
-
thread = Thread.current.name || "
|
|
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
|
data/lib/raptor/reactor.rb
CHANGED
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 =
|
|
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)
|
data/lib/raptor/version.rb
CHANGED
|
@@ -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 `
|
|
34
|
+
# and thread. Unnamed ractors and threads are reported as `Main`.
|
|
35
35
|
#
|
|
36
36
|
# @return [String] the prefix
|
|
37
37
|
#
|