benchmark-http 0.17.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bin/benchmark-http +2 -1
- data/lib/benchmark/http/command/concurrency.rb +10 -10
- data/lib/benchmark/http/command/hammer.rb +11 -11
- data/lib/benchmark/http/command/latency.rb +8 -8
- data/lib/benchmark/http/command/spider.rb +8 -8
- data/lib/benchmark/http/command/wait.rb +9 -9
- data/lib/benchmark/http/command.rb +17 -17
- data/lib/benchmark/http/links_filter.rb +5 -5
- data/lib/benchmark/http/spider.rb +14 -14
- data/lib/benchmark/http/statistics.rb +2 -2
- data/lib/benchmark/http/version.rb +2 -2
- data/readme.md +3 -3
- data.tar.gz.sig +0 -0
- metadata +5 -19
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3559537d92b2efd74e3cf7b45444befd593248242d175e1206134a1aebd963a1
|
4
|
+
data.tar.gz: 28e3e49a4ed3555553624c0a1a4518dcb3275e88f966862e3d3969d82db88b2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9909037132e21ed3e2442efd745f18dd0479deca04d9f0d34935a2a7b8666d232084cceaeab544cc0717e869f725c88b31eba257621f0e3d613b61c9ca01228
|
7
|
+
data.tar.gz: 84eb3116458217f57132a204ed47498edb30922537c2fb5f0921ec0f1c4d48a068111be1f0353cfbda54612215d6b3adfaf67953db07e8a295bfaab390f5ba71
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bin/benchmark-http
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
5
|
#
|
@@ -20,7 +21,7 @@
|
|
20
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
22
|
# THE SOFTWARE.
|
22
23
|
|
23
|
-
require_relative
|
24
|
+
require_relative "../lib/benchmark/http"
|
24
25
|
|
25
26
|
begin
|
26
27
|
Benchmark::HTTP::Command.call
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../seconds"
|
7
|
+
require_relative "../statistics"
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
9
|
+
require "async"
|
10
|
+
require "async/http/client"
|
11
|
+
require "async/http/endpoint"
|
12
12
|
|
13
|
-
require
|
13
|
+
require "samovar"
|
14
14
|
|
15
15
|
module Benchmark
|
16
16
|
module HTTP
|
@@ -19,9 +19,9 @@ module Benchmark
|
|
19
19
|
self.description = "Determine the optimal level of concurrency."
|
20
20
|
|
21
21
|
options do
|
22
|
-
option
|
23
|
-
option
|
24
|
-
option
|
22
|
+
option "-t/--threshold <factor>", "The acceptable latency penalty when making concurrent requests", default: 1.2, type: Float
|
23
|
+
option "-c/--confidence <factor>", "The confidence required when computing latency (lower is less reliable but faster)", default: 0.99, type: Float
|
24
|
+
option "-m/--minimum <count>", "The minimum number of connections to make", default: 1, type: Integer
|
25
25
|
end
|
26
26
|
|
27
27
|
many :hosts, "One or more hosts to benchmark"
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../seconds"
|
7
|
+
require_relative "../statistics"
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
9
|
+
require "async"
|
10
|
+
require "async/http/client"
|
11
|
+
require "async/http/endpoint"
|
12
12
|
|
13
|
-
require
|
13
|
+
require "samovar"
|
14
14
|
|
15
15
|
module Benchmark
|
16
16
|
module HTTP
|
@@ -20,10 +20,10 @@ module Benchmark
|
|
20
20
|
|
21
21
|
options do
|
22
22
|
option "-k/--concurrency <count>", "The number of simultaneous connections to make.", default: 1, type: Integer
|
23
|
-
option
|
23
|
+
option "-c/--count <integer>", "The number of requests to make per connection.", default: 10_000, type: Integer
|
24
24
|
|
25
|
-
option
|
26
|
-
option
|
25
|
+
option "-i/--interval <integer>", "The time to wait between measurements.", default: nil, type: Integer
|
26
|
+
option "--alpn-protocols <name,name>", "Force specific ALPN protocols during connection negotiation.", default: nil, type: String
|
27
27
|
end
|
28
28
|
|
29
29
|
many :urls, "The urls to hammer."
|
@@ -70,7 +70,7 @@ module Benchmark
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def alpn_protocols
|
73
|
-
@options[:alpn_protocols]&.split(
|
73
|
+
@options[:alpn_protocols]&.split(",")
|
74
74
|
end
|
75
75
|
|
76
76
|
def run(url)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2019-
|
4
|
+
# Copyright, 2019-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../seconds"
|
7
|
+
require_relative "../statistics"
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
9
|
+
require "async"
|
10
|
+
require "async/http/client"
|
11
|
+
require "async/http/endpoint"
|
12
12
|
|
13
|
-
require
|
13
|
+
require "samovar"
|
14
14
|
|
15
15
|
module Benchmark
|
16
16
|
module HTTP
|
@@ -20,7 +20,7 @@ module Benchmark
|
|
20
20
|
|
21
21
|
options do
|
22
22
|
option "-k/--concurrency <count>", "The number of simultaneous connections to make.", default: 1, type: Integer
|
23
|
-
option
|
23
|
+
option "-c/--confidence <factor>", "The confidence required when computing latency (lower is less reliable but faster)", default: 0.99, type: Float
|
24
24
|
end
|
25
25
|
|
26
26
|
many :hosts, "One or more hosts to benchmark"
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
6
|
+
require_relative "../spider"
|
7
7
|
|
8
|
-
require
|
8
|
+
require "async/await"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
10
|
+
require "samovar"
|
11
|
+
require "uri"
|
12
|
+
require "console"
|
13
13
|
|
14
14
|
module Benchmark
|
15
15
|
module HTTP
|
@@ -20,8 +20,8 @@ module Benchmark
|
|
20
20
|
self.description = "Spider a website and report on performance."
|
21
21
|
|
22
22
|
options do
|
23
|
-
option
|
24
|
-
option
|
23
|
+
option "-d/--depth <count>", "The number of nested URLs to traverse.", default: 10, type: Integer
|
24
|
+
option "-h/--headers", "Print out the response headers", default: false
|
25
25
|
end
|
26
26
|
|
27
27
|
many :urls, "One or more hosts to benchmark"
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022, by Samuel Williams.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
6
|
+
require_relative "../seconds"
|
7
|
+
require_relative "../statistics"
|
8
8
|
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
9
|
+
require "async"
|
10
|
+
require "async/barrier"
|
11
|
+
require "async/http/client"
|
12
|
+
require "async/http/endpoint"
|
13
13
|
|
14
|
-
require
|
14
|
+
require "samovar"
|
15
15
|
|
16
16
|
module Benchmark
|
17
17
|
module HTTP
|
@@ -20,7 +20,7 @@ module Benchmark
|
|
20
20
|
self.description = "Measure how long it takes for an endpoint to become accessible."
|
21
21
|
|
22
22
|
options do
|
23
|
-
option
|
23
|
+
option "-w/--wait <time>", "The maximum wait time.", default: 10, type: Float
|
24
24
|
end
|
25
25
|
|
26
26
|
many :hosts, "The hosts to wait for."
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
6
|
+
require_relative "command/latency"
|
7
|
+
require_relative "command/concurrency"
|
8
|
+
require_relative "command/spider"
|
9
|
+
require_relative "command/hammer"
|
10
|
+
require_relative "command/wait"
|
11
11
|
|
12
|
-
require_relative
|
13
|
-
require
|
14
|
-
require
|
12
|
+
require_relative "version"
|
13
|
+
require "samovar"
|
14
|
+
require "console"
|
15
15
|
|
16
16
|
module Benchmark
|
17
17
|
module HTTP
|
@@ -24,17 +24,17 @@ module Benchmark
|
|
24
24
|
self.description = "An asynchronous HTTP server benchmark."
|
25
25
|
|
26
26
|
options do
|
27
|
-
option
|
28
|
-
option
|
29
|
-
option
|
27
|
+
option "--verbose | --quiet", "Verbosity of output for debugging.", key: :logging
|
28
|
+
option "-h/--help", "Print out help information."
|
29
|
+
option "-v/--version", "Print out the application version."
|
30
30
|
end
|
31
31
|
|
32
32
|
nested :command, {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
"latency" => Latency,
|
34
|
+
"concurrency" => Concurrency,
|
35
|
+
"spider" => Spider,
|
36
|
+
"hammer" => Hammer,
|
37
|
+
"wait" => Wait,
|
38
38
|
}
|
39
39
|
|
40
40
|
def verbose?
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Released under the MIT License.
|
4
4
|
# Copyright, 2018-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require
|
6
|
+
require "xrb/sanitize"
|
7
7
|
|
8
8
|
module Benchmark
|
9
9
|
module HTTP
|
@@ -19,10 +19,10 @@ module Benchmark
|
|
19
19
|
attr :links
|
20
20
|
|
21
21
|
def filter(node)
|
22
|
-
if node.name ==
|
23
|
-
@base = node[
|
24
|
-
elsif node.name ==
|
25
|
-
@links << node[
|
22
|
+
if node.name == "base"
|
23
|
+
@base = node["href"]
|
24
|
+
elsif node.name == "a" and node["href"] and node["rel"] != "nofollow"
|
25
|
+
@links << node["href"]
|
26
26
|
end
|
27
27
|
|
28
28
|
node.skip!(TAG)
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2020-
|
4
|
+
# Copyright, 2020-2024, by Samuel Williams.
|
5
5
|
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
6
|
+
require_relative "seconds"
|
7
|
+
require_relative "statistics"
|
8
|
+
require_relative "links_filter"
|
9
9
|
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
13
|
-
require
|
10
|
+
require "async"
|
11
|
+
require "async/http/client"
|
12
|
+
require "async/http/endpoint"
|
13
|
+
require "async/await"
|
14
14
|
|
15
|
-
require
|
16
|
-
require
|
15
|
+
require "uri"
|
16
|
+
require "console"
|
17
17
|
|
18
18
|
module Benchmark
|
19
19
|
module HTTP
|
@@ -76,7 +76,7 @@ module Benchmark
|
|
76
76
|
yield("HEAD", url, response) if block_given?
|
77
77
|
|
78
78
|
if response.redirection?
|
79
|
-
location = url + response.headers[
|
79
|
+
location = url + response.headers["location"]
|
80
80
|
if location.host == url.host
|
81
81
|
Console.logger.debug(self) {"Following redirect to #{location}..."}
|
82
82
|
fetch(statistics, client, location, depth&.-(1), fetched, &block).wait
|
@@ -87,8 +87,8 @@ module Benchmark
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
content_type = response.headers[
|
91
|
-
unless content_type&.start_with?
|
90
|
+
content_type = response.headers["content-type"]
|
91
|
+
unless content_type&.start_with? "text/html"
|
92
92
|
# puts "Unsupported content type: #{content_type}"
|
93
93
|
return
|
94
94
|
end
|
@@ -114,7 +114,7 @@ module Benchmark
|
|
114
114
|
urls.each do |url|
|
115
115
|
endpoint = Async::HTTP::Endpoint.parse(url, timeout: 10)
|
116
116
|
|
117
|
-
Async::HTTP::Client.open(endpoint, protocol: endpoint.protocol,
|
117
|
+
Async::HTTP::Client.open(endpoint, protocol: endpoint.protocol, limit: 4) do |client|
|
118
118
|
fetch(statistics, client, endpoint.url, &block).wait
|
119
119
|
end
|
120
120
|
end
|
data/readme.md
CHANGED
@@ -196,8 +196,8 @@ We welcome contributions to this project.
|
|
196
196
|
|
197
197
|
### Developer Certificate of Origin
|
198
198
|
|
199
|
-
|
199
|
+
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
200
200
|
|
201
|
-
###
|
201
|
+
### Community Guidelines
|
202
202
|
|
203
|
-
This project is
|
203
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benchmark-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
39
39
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
40
40
|
-----END CERTIFICATE-----
|
41
|
-
date: 2024-
|
41
|
+
date: 2024-11-18 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: async-await
|
@@ -60,28 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '0.
|
63
|
+
version: '0.83'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: '0.
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: async-io
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '1.5'
|
78
|
-
type: :runtime
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - "~>"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '1.5'
|
70
|
+
version: '0.83'
|
85
71
|
- !ruby/object:Gem::Dependency
|
86
72
|
name: console
|
87
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
153
|
- !ruby/object:Gem::Version
|
168
154
|
version: '0'
|
169
155
|
requirements: []
|
170
|
-
rubygems_version: 3.5.
|
156
|
+
rubygems_version: 3.5.22
|
171
157
|
signing_key:
|
172
158
|
specification_version: 4
|
173
159
|
summary: An asynchronous benchmark toolbox for modern HTTP servers.
|
metadata.gz.sig
CHANGED
Binary file
|