raptor 0.3.0 → 0.5.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/.mise.toml +2 -0
- data/Brewfile +2 -0
- data/CHANGELOG.md +21 -0
- data/README.md +28 -25
- data/ext/raptor_http2/raptor_http2.c +1 -0
- data/lib/rackup/handler/raptor.rb +20 -21
- data/lib/raptor/cli.rb +46 -14
- data/lib/raptor/cluster.rb +142 -64
- data/lib/raptor/http2.rb +324 -42
- data/lib/raptor/log.rb +55 -0
- data/lib/raptor/reactor.rb +89 -53
- data/lib/raptor/request.rb +106 -61
- data/lib/raptor/server.rb +125 -51
- data/lib/raptor/stats.rb +30 -26
- data/lib/raptor/version.rb +1 -1
- data/sig/generated/raptor/cli.rbs +15 -1
- data/sig/generated/raptor/cluster.rbs +70 -38
- data/sig/generated/raptor/http2.rbs +126 -6
- data/sig/generated/raptor/log.rbs +41 -0
- data/sig/generated/raptor/reactor.rbs +44 -25
- data/sig/generated/raptor/request.rbs +36 -22
- data/sig/generated/raptor/server.rbs +63 -26
- data/sig/generated/raptor/stats.rbs +24 -20
- metadata +5 -1
|
@@ -9,13 +9,17 @@ module Raptor
|
|
|
9
9
|
# assigned a fixed-size slot in the shared region.
|
|
10
10
|
#
|
|
11
11
|
# Binary layout per slot (native byte order):
|
|
12
|
-
# pid
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
12
|
+
# pid uint32 4 bytes
|
|
13
|
+
# index uint32 4 bytes
|
|
14
|
+
# phase uint32 4 bytes
|
|
15
|
+
# requests uint64 8 bytes
|
|
16
|
+
# backlog uint32 4 bytes
|
|
17
|
+
# busy_threads uint32 4 bytes
|
|
18
|
+
# thread_capacity uint32 4 bytes
|
|
19
|
+
# started_at float64 8 bytes
|
|
20
|
+
# last_checkin float64 8 bytes
|
|
21
|
+
# booted uint8 1 byte
|
|
22
|
+
# 49 bytes total
|
|
19
23
|
class Stats
|
|
20
24
|
SLOT_FORMAT: ::String
|
|
21
25
|
|
|
@@ -25,11 +29,8 @@ module Raptor
|
|
|
25
29
|
|
|
26
30
|
@mmap: untyped
|
|
27
31
|
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
# Allocates a MAP_ANON | MAP_SHARED mmap region large enough for
|
|
31
|
-
# num_workers slots. Must be called before forking so that all
|
|
32
|
-
# worker processes share the same backing memory.
|
|
32
|
+
# Allocates the shared mmap region. Must be called before forking
|
|
33
|
+
# workers so the mapping is inherited by every child process.
|
|
33
34
|
#
|
|
34
35
|
# @param num_workers [Integer] number of worker slots to allocate
|
|
35
36
|
# @return [void]
|
|
@@ -39,21 +40,24 @@ module Raptor
|
|
|
39
40
|
|
|
40
41
|
# Writes stats for a worker slot into shared memory.
|
|
41
42
|
#
|
|
42
|
-
# @param index [Integer] slot index to write into
|
|
43
|
+
# @param index [Integer] slot index to write into; also written into the slot itself
|
|
43
44
|
# @param pid [Integer] worker process ID
|
|
45
|
+
# @param phase [Integer] cluster phase this worker was forked at
|
|
44
46
|
# @param requests [Integer] total requests handled by this worker
|
|
45
47
|
# @param backlog [Integer] current queue depth
|
|
48
|
+
# @param busy_threads [Integer] worker threads currently processing requests
|
|
49
|
+
# @param thread_capacity [Integer] worker threads configured for this worker
|
|
46
50
|
# @param started_at [Float] process start time as a Unix timestamp
|
|
47
51
|
# @param last_checkin [Float] time of last stats write as a Unix timestamp
|
|
48
52
|
# @param booted [Boolean] whether the worker has finished starting
|
|
49
53
|
# @return [void]
|
|
50
54
|
#
|
|
51
|
-
# @rbs (Integer index, pid: Integer, requests: Integer, backlog: Integer, started_at: Float, last_checkin: Float, booted: bool) -> void
|
|
52
|
-
def write: (Integer index, pid: Integer, requests: Integer, backlog: Integer, started_at: Float, last_checkin: Float, booted: bool) -> void
|
|
55
|
+
# @rbs (Integer index, pid: Integer, phase: Integer, requests: Integer, backlog: Integer, busy_threads: Integer, thread_capacity: Integer, started_at: Float, last_checkin: Float, booted: bool) -> void
|
|
56
|
+
def write: (Integer index, pid: Integer, phase: Integer, requests: Integer, backlog: Integer, busy_threads: Integer, thread_capacity: Integer, started_at: Float, last_checkin: Float, booted: bool) -> void
|
|
53
57
|
|
|
54
58
|
# Returns stats for all worker slots.
|
|
55
59
|
#
|
|
56
|
-
# @return [Array<Hash>] per-worker stat hashes with :pid, :requests, :backlog, :started_at, :last_checkin, and :booted
|
|
60
|
+
# @return [Array<Hash>] per-worker stat hashes with :pid, :index, :phase, :requests, :backlog, :busy_threads, :thread_capacity, :started_at, :last_checkin, and :booted
|
|
57
61
|
#
|
|
58
62
|
# @rbs () -> Array[Hash[Symbol, untyped]]
|
|
59
63
|
def all: () -> Array[Hash[Symbol, untyped]]
|
|
@@ -69,10 +73,10 @@ module Raptor
|
|
|
69
73
|
|
|
70
74
|
# Reads stats for a worker slot from shared memory.
|
|
71
75
|
#
|
|
72
|
-
# @param
|
|
73
|
-
# @return [Hash] stat hash with :pid, :requests, :backlog, :started_at, :last_checkin, and :booted
|
|
76
|
+
# @param slot [Integer] slot offset to read from
|
|
77
|
+
# @return [Hash] stat hash with :pid, :index, :phase, :requests, :backlog, :busy_threads, :thread_capacity, :started_at, :last_checkin, and :booted
|
|
74
78
|
#
|
|
75
|
-
# @rbs (Integer
|
|
76
|
-
def read: (Integer
|
|
79
|
+
# @rbs (Integer slot) -> Hash[Symbol, untyped]
|
|
80
|
+
def read: (Integer slot) -> Hash[Symbol, untyped]
|
|
77
81
|
end
|
|
78
82
|
end
|
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.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joshua Young
|
|
@@ -103,6 +103,8 @@ extensions:
|
|
|
103
103
|
extra_rdoc_files: []
|
|
104
104
|
files:
|
|
105
105
|
- ".buildkite/pipeline.yml"
|
|
106
|
+
- ".mise.toml"
|
|
107
|
+
- Brewfile
|
|
106
108
|
- CHANGELOG.md
|
|
107
109
|
- CODE_OF_CONDUCT.md
|
|
108
110
|
- LICENSE.txt
|
|
@@ -120,6 +122,7 @@ files:
|
|
|
120
122
|
- lib/raptor/cli.rb
|
|
121
123
|
- lib/raptor/cluster.rb
|
|
122
124
|
- lib/raptor/http2.rb
|
|
125
|
+
- lib/raptor/log.rb
|
|
123
126
|
- lib/raptor/reactor.rb
|
|
124
127
|
- lib/raptor/request.rb
|
|
125
128
|
- lib/raptor/server.rb
|
|
@@ -131,6 +134,7 @@ files:
|
|
|
131
134
|
- sig/generated/raptor/cli.rbs
|
|
132
135
|
- sig/generated/raptor/cluster.rbs
|
|
133
136
|
- sig/generated/raptor/http2.rbs
|
|
137
|
+
- sig/generated/raptor/log.rbs
|
|
134
138
|
- sig/generated/raptor/reactor.rbs
|
|
135
139
|
- sig/generated/raptor/request.rbs
|
|
136
140
|
- sig/generated/raptor/server.rbs
|