benchmark-http 0.11.0 → 0.14.1

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: 7a53d525fad87d3fd01937e054c06f70afd6863e1ead842c02f1457aed6046e8
4
- data.tar.gz: 5f008ffaa18ce21f8b91beaea253c334f929ef5d0e7dfbecb87ee5f17cb2f0a0
3
+ metadata.gz: f7b898f9431f2e00f2635eb1c4defb390f458faa1b5cce000834a1b5b338501e
4
+ data.tar.gz: 7f145d3680f1454aa57d328d9a9af5c8f5d342ec24c41d2494f2486fb6fb2119
5
5
  SHA512:
6
- metadata.gz: 2258aa956ac4bf36560954aa0f517f938f5fb8c5348cd0c60994b846cb6489c6a859a76fe1de8fe62faab5a912691f20b9e8f72b221c1c7b23b098fd79ae1fc1
7
- data.tar.gz: 9399cb6ffe0220222ee2b67f3949ff5e287286ad2e9ea1e06adf1438ed13ae9a5856913bf7787b0b97e8700e58cdee182c28fe983bcadc1224345226440ef4e2
6
+ metadata.gz: 3dbe27cd285207090193134aec7e7fcd94fef8263742dee41ec53c61ab8dd65998b6339ee02ae6c4e51bf03533350397076b44c41802f2986aea6874f767cd35
7
+ data.tar.gz: c85924364c69f467af407752313f22a6fd2eeb56b18df2ac3450e9c2b10758dc7cc1bb3a8f8fb30579769799451d9bfa75c09ba82c204b4250306f25c30c2b0d
@@ -21,6 +21,7 @@
21
21
  require_relative 'command/latency'
22
22
  require_relative 'command/concurrency'
23
23
  require_relative 'command/spider'
24
+ require_relative 'command/hammer'
24
25
 
25
26
  require_relative 'version'
26
27
  require 'samovar'
@@ -44,7 +45,8 @@ module Benchmark
44
45
  nested :command, {
45
46
  'latency' => Latency,
46
47
  'concurrency' => Concurrency,
47
- 'spider' => Spider
48
+ 'spider' => Spider,
49
+ 'hammer' => Hammer,
48
50
  }
49
51
 
50
52
  def verbose?
@@ -54,7 +54,7 @@ module Benchmark
54
54
 
55
55
  concurrency.times.map do
56
56
  task.async do
57
- client = Async::HTTP::Client.new(endpoint, endpoint.protocol)
57
+ client = Async::HTTP::Client.new(endpoint, protocol: endpoint.protocol)
58
58
 
59
59
  statistics.sample(confidence_factor) do
60
60
  response = client.get(request_path).tap(&:finish)
@@ -0,0 +1,114 @@
1
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative '../seconds'
22
+ require_relative '../statistics'
23
+
24
+ require 'async'
25
+ require 'async/http/client'
26
+ require 'async/http/endpoint'
27
+
28
+ require 'samovar'
29
+
30
+ module Benchmark
31
+ module HTTP
32
+ module Command
33
+ class Hammer < Samovar::Command
34
+ self.description = "Hammer a single URL and report statistics."
35
+
36
+ options do
37
+ option "-k/--concurrency <count>", "The number of simultaneous connections to make.", default: 1, type: Integer
38
+ option '-c/--count <integer>', "The number of requests to make per connection.", default: 10_000, type: Integer
39
+
40
+ option '-i/--interval <integer>', "The time to wait between measurements.", default: nil, type: Integer
41
+ end
42
+
43
+ many :urls, "The urls to hammer."
44
+
45
+ def measure_performance(concurrency, count, endpoint, request_path)
46
+ puts "I am running #{concurrency} asynchronous tasks that will each make #{count} sequential requests..."
47
+
48
+ statistics = Statistics.new(concurrency)
49
+ task = Async::Task.current
50
+ running = true
51
+
52
+ progress_task = task.async do |child|
53
+ while true
54
+ child.sleep(1)
55
+ statistics.print
56
+ end
57
+ end
58
+
59
+ concurrency.times.map do
60
+ task.async do
61
+ client = Async::HTTP::Client.new(endpoint, protocol: endpoint.protocol)
62
+
63
+ count.times do |i|
64
+ statistics.measure do
65
+ response = client.get(request_path).tap(&:finish)
66
+ end
67
+ end
68
+
69
+ client.close
70
+ end
71
+ end.each(&:wait)
72
+
73
+ progress_task&.stop
74
+
75
+ puts "I made #{statistics.count} requests in #{Seconds[statistics.sequential_duration]}. The per-request latency was #{Seconds[statistics.latency]}. That's #{statistics.per_second} asynchronous requests/second."
76
+ puts "\t Variance: #{Seconds[statistics.variance]}"
77
+ puts "\tStandard Deviation: #{Seconds[statistics.standard_deviation]}"
78
+ puts "\t Standard Error: #{Seconds[statistics.standard_error]}"
79
+
80
+ statistics.print
81
+
82
+ return statistics
83
+ end
84
+
85
+ def run(url)
86
+ endpoint = Async::HTTP::Endpoint.parse(url)
87
+ request_path = endpoint.url.request_uri
88
+
89
+ puts "I am going to benchmark #{url}..."
90
+
91
+ Async do |task|
92
+ statistics = []
93
+
94
+ base = measure_performance(@options[:concurrency], @options[:count], endpoint, request_path)
95
+ end
96
+ end
97
+
98
+ def call
99
+ while true
100
+ @urls.each do |url|
101
+ run(url).wait
102
+ end
103
+
104
+ if @interval
105
+ sleep(@interval)
106
+ else
107
+ break
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -52,7 +52,7 @@ module Benchmark
52
52
 
53
53
  concurrency.times.map do
54
54
  task.async do
55
- client = Async::HTTP::Client.new(endpoint, endpoint.protocol)
55
+ client = Async::HTTP::Client.new(endpoint, protocol: endpoint.protocol)
56
56
 
57
57
  statistics.sample(confidence_factor) do
58
58
  response = client.get(request_path).tap(&:finish)
@@ -34,8 +34,9 @@ module Benchmark
34
34
  class Spider
35
35
  include Async::Await
36
36
 
37
- def initialize(depth: nil)
37
+ def initialize(depth: nil, ignore: nil)
38
38
  @depth = depth
39
+ @ignore = ignore
39
40
  end
40
41
 
41
42
  def extract_links(url, response)
@@ -71,7 +72,14 @@ module Benchmark
71
72
  end
72
73
 
73
74
  async def fetch(statistics, client, url, depth = @depth, fetched = Set.new, &block)
74
- return if fetched.include?(url) or depth == 0
75
+ if depth&.zero?
76
+ Async.logger.warn(self) {"Exceeded depth while trying to visit #{url}!"}
77
+ return
78
+ elsif fetched.include?(url)
79
+ return
80
+ elsif @ignore&.match?(url.path)
81
+ return
82
+ end
75
83
 
76
84
  fetched << url
77
85
 
@@ -84,11 +92,11 @@ module Benchmark
84
92
  if response.redirection?
85
93
  location = url + response.headers['location']
86
94
  if location.host == url.host
87
- Async.logger.info(self) {"Following redirect to #{location}..."}
88
- fetch(statistics, client, location, depth-1, fetched, &block).wait
95
+ Async.logger.debug(self) {"Following redirect to #{location}..."}
96
+ fetch(statistics, client, location, depth&.-(1), fetched, &block).wait
89
97
  return
90
98
  else
91
- Async.logger.info(self) {"Ignoring redirect to #{location}."}
99
+ Async.logger.debug(self) {"Ignoring redirect to #{location}."}
92
100
  return
93
101
  end
94
102
  end
@@ -106,7 +114,7 @@ module Benchmark
106
114
  yield("GET", url, response) if block_given?
107
115
 
108
116
  extract_links(url, response) do |href|
109
- fetch(statistics, client, href, depth - 1, fetched, &block)
117
+ fetch(statistics, client, href, depth&.-(1), fetched, &block)
110
118
  end.each(&:wait)
111
119
  rescue Async::TimeoutError
112
120
  Async.logger.error(self) {"Timeout while fetching #{url}"}
@@ -120,7 +128,7 @@ module Benchmark
120
128
  urls.each do |url|
121
129
  endpoint = Async::HTTP::Endpoint.parse(url, timeout: 10)
122
130
 
123
- Async::HTTP::Client.open(endpoint, endpoint.protocol, connection_limit: 4) do |client|
131
+ Async::HTTP::Client.open(endpoint, protocol: endpoint.protocol, connection_limit: 4) do |client|
124
132
  fetch(statistics, client, endpoint.url, &block).wait
125
133
  end
126
134
  end
@@ -72,7 +72,7 @@ module Benchmark
72
72
  end
73
73
 
74
74
  def valid?
75
- @samples.size > 1
75
+ @samples.size > 0
76
76
  end
77
77
 
78
78
  # Computes Population Variance, σ^2.
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Benchmark
22
22
  module HTTP
23
- VERSION = "0.11.0"
23
+ VERSION = "0.14.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-09 00:00:00.000000000 Z
11
+ date: 2021-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: async-await
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: async-http
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.54'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.54'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: async-io
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -25,21 +53,21 @@ dependencies:
25
53
  - !ruby/object:Gem::Version
26
54
  version: '1.5'
27
55
  - !ruby/object:Gem::Dependency
28
- name: async-http
56
+ name: samovar
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
59
  - - "~>"
32
60
  - !ruby/object:Gem::Version
33
- version: '0.45'
61
+ version: '2.0'
34
62
  type: :runtime
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
- version: '0.45'
68
+ version: '2.0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: async-await
70
+ name: trenni-sanitize
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - ">="
@@ -53,13 +81,13 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: trenni-sanitize
84
+ name: async-rspec
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
60
88
  - !ruby/object:Gem::Version
61
89
  version: '0'
62
- type: :runtime
90
+ type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
@@ -67,21 +95,21 @@ dependencies:
67
95
  - !ruby/object:Gem::Version
68
96
  version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
- name: samovar
98
+ name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - "~>"
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '2.0'
76
- type: :runtime
103
+ version: '0'
104
+ type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - "~>"
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '2.0'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: bundler
112
+ name: covered
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -122,26 +150,18 @@ dependencies:
122
150
  - - "~>"
123
151
  - !ruby/object:Gem::Version
124
152
  version: '3.0'
125
- description:
153
+ description:
126
154
  email:
127
- - samuel.williams@oriontransfer.co.nz
128
155
  executables:
129
156
  - benchmark-http
130
157
  extensions: []
131
158
  extra_rdoc_files: []
132
159
  files:
133
- - ".editorconfig"
134
- - ".gitignore"
135
- - ".rspec"
136
- - ".travis.yml"
137
- - Gemfile
138
- - README.md
139
- - Rakefile
140
- - benchmark-http.gemspec
141
160
  - bin/benchmark-http
142
161
  - lib/benchmark/http.rb
143
162
  - lib/benchmark/http/command.rb
144
163
  - lib/benchmark/http/command/concurrency.rb
164
+ - lib/benchmark/http/command/hammer.rb
145
165
  - lib/benchmark/http/command/latency.rb
146
166
  - lib/benchmark/http/command/spider.rb
147
167
  - lib/benchmark/http/links_filter.rb
@@ -150,15 +170,16 @@ files:
150
170
  - lib/benchmark/http/statistics.rb
151
171
  - lib/benchmark/http/version.rb
152
172
  homepage: https://github.com/socketry/benchmark-http
153
- licenses: []
173
+ licenses:
174
+ - MIT
154
175
  metadata: {}
155
- post_install_message:
176
+ post_install_message:
156
177
  rdoc_options: []
157
178
  require_paths:
158
179
  - lib
159
180
  required_ruby_version: !ruby/object:Gem::Requirement
160
181
  requirements:
161
- - - "~>"
182
+ - - ">="
162
183
  - !ruby/object:Gem::Version
163
184
  version: '2.4'
164
185
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -167,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
188
  - !ruby/object:Gem::Version
168
189
  version: '0'
169
190
  requirements: []
170
- rubygems_version: 3.1.2
171
- signing_key:
191
+ rubygems_version: 3.1.6
192
+ signing_key:
172
193
  specification_version: 4
173
194
  summary: An asynchronous benchmark toolbox for modern HTTP servers.
174
195
  test_files: []
data/.editorconfig DELETED
@@ -1,6 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = tab
5
- indent_size = 2
6
-
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,16 +0,0 @@
1
- language: ruby
2
- dist: xenial
3
- cache: bundler
4
-
5
- matrix:
6
- include:
7
- - rvm: 2.4
8
- - rvm: 2.5
9
- - rvm: 2.6
10
- - rvm: 2.7
11
- - rvm: jruby-head
12
- env: JRUBY_OPTS="--debug -X+O"
13
- - rvm: ruby-head
14
- allow_failures:
15
- - rvm: ruby-head
16
- - rvm: jruby-head
data/Gemfile DELETED
@@ -1,7 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'pry'
7
- end
data/README.md DELETED
@@ -1,223 +0,0 @@
1
- # Benchmark::HTTP
2
-
3
- An asynchronous HTTP benchmark tool built on top of [async], [async-io] and [async-http]. Useful for analysing server performance. Supports HTTP1 and HTTP2.
4
-
5
- [![Build Status](https://secure.travis-ci.org/socketry/benchmark-http.svg)](http://travis-ci.org/socketry/benchmark-http)
6
- [![Code Climate](https://codeclimate.com/github/socketry/benchmark-http.svg)](https://codeclimate.com/github/socketry/benchmark-http)
7
- [![Coverage Status](https://coveralls.io/repos/socketry/benchmark-http/badge.svg)](https://coveralls.io/r/socketry/benchmark-http)
8
-
9
- [async]: https://github.com/socketry/async
10
- [async-io]: https://github.com/socketry/async-io
11
- [async-http]: https://github.com/socketry/async-http
12
-
13
- ## Installation
14
-
15
- Install it yourself:
16
-
17
- $ gem install benchmark-http
18
-
19
- ## Usage
20
-
21
- You can run `benchmark-http` is a top level tool for invoking specific benchmarks.
22
-
23
- ### Spider
24
-
25
- This benchmark spiders a website and generates some statistics on general access time.
26
-
27
- ```shell
28
- $ benchmark-http spider https://www.oriontransfer.co.nz/welcome/index
29
- HEAD https://www.oriontransfer.co.nz/welcome/index -> HTTP/2.0 404 (unspecified bytes)
30
- GET https://www.oriontransfer.co.nz/welcome/index (depth = 10)
31
- GET https://www.oriontransfer.co.nz/welcome/index -> HTTP/2.0 404 (2263 bytes)
32
- HEAD https://www.oriontransfer.co.nz/products/index -> HTTP/2.0 200 (unspecified bytes)
33
- GET https://www.oriontransfer.co.nz/products/index (depth = 9)
34
- HEAD https://www.oriontransfer.co.nz/services/index -> HTTP/2.0 200 (unspecified bytes)
35
- GET https://www.oriontransfer.co.nz/services/index (depth = 9)
36
- HEAD https://www.oriontransfer.co.nz/support/index -> HTTP/2.0 200 (unspecified bytes)
37
- GET https://www.oriontransfer.co.nz/support/index (depth = 9)
38
- HEAD https://www.oriontransfer.co.nz/support/contact-us -> HTTP/2.0 307 (unspecified bytes)
39
- Following redirect to https://www.oriontransfer.co.nz/support/contact-us/index...
40
- HEAD https://www.oriontransfer.co.nz/support/terms-of-service -> HTTP/2.0 200 (unspecified bytes)
41
- GET https://www.oriontransfer.co.nz/support/terms-of-service (depth = 9)
42
- GET https://www.oriontransfer.co.nz/products/index -> HTTP/2.0 200 (3469 bytes)
43
- GET https://www.oriontransfer.co.nz/services/index -> HTTP/2.0 200 (2488 bytes)
44
- GET https://www.oriontransfer.co.nz/support/index -> HTTP/2.0 200 (2246 bytes)
45
- HEAD https://www.oriontransfer.co.nz/support/contact-us/index -> HTTP/2.0 200 (unspecified bytes)
46
- GET https://www.oriontransfer.co.nz/support/contact-us/index (depth = 8)
47
- GET https://www.oriontransfer.co.nz/support/terms-of-service -> HTTP/2.0 200 (8466 bytes)
48
- HEAD https://www.oriontransfer.co.nz/products/library-inspector/index -> HTTP/2.0 200 (unspecified bytes)
49
- GET https://www.oriontransfer.co.nz/products/library-inspector/index (depth = 8)
50
- HEAD https://www.oriontransfer.co.nz/products/truth-tables/index -> HTTP/2.0 200 (unspecified bytes)
51
- GET https://www.oriontransfer.co.nz/products/truth-tables/index (depth = 8)
52
- HEAD https://www.oriontransfer.co.nz/products/fingerprint/index -> HTTP/2.0 200 (unspecified bytes)
53
- GET https://www.oriontransfer.co.nz/products/fingerprint/index (depth = 8)
54
- HEAD https://www.oriontransfer.co.nz/services/internet-services -> HTTP/2.0 200 (unspecified bytes)
55
- GET https://www.oriontransfer.co.nz/services/internet-services (depth = 8)
56
- HEAD https://www.oriontransfer.co.nz/services/software-development -> HTTP/2.0 200 (unspecified bytes)
57
- GET https://www.oriontransfer.co.nz/services/software-development (depth = 8)
58
- HEAD https://www.oriontransfer.co.nz/services/systems-administration -> HTTP/2.0 200 (unspecified bytes)
59
- GET https://www.oriontransfer.co.nz/services/systems-administration (depth = 8)
60
- HEAD https://www.oriontransfer.co.nz/services/website-development -> HTTP/2.0 200 (unspecified bytes)
61
- GET https://www.oriontransfer.co.nz/services/website-development (depth = 8)
62
- HEAD https://www.oriontransfer.co.nz/support/contact-us/ -> HTTP/2.0 307 (unspecified bytes)
63
- Following redirect to https://www.oriontransfer.co.nz/support/contact-us/index...
64
- GET https://www.oriontransfer.co.nz/support/contact-us/index -> HTTP/2.0 200 (3094 bytes)
65
- GET https://www.oriontransfer.co.nz/products/library-inspector/index -> HTTP/2.0 200 (5592 bytes)
66
- GET https://www.oriontransfer.co.nz/products/truth-tables/index -> HTTP/2.0 200 (4160 bytes)
67
- GET https://www.oriontransfer.co.nz/products/fingerprint/index -> HTTP/2.0 200 (4414 bytes)
68
- GET https://www.oriontransfer.co.nz/services/internet-services -> HTTP/2.0 200 (3362 bytes)
69
- GET https://www.oriontransfer.co.nz/services/software-development -> HTTP/2.0 200 (3521 bytes)
70
- GET https://www.oriontransfer.co.nz/services/systems-administration -> HTTP/2.0 200 (2979 bytes)
71
- GET https://www.oriontransfer.co.nz/services/website-development -> HTTP/2.0 200 (3943 bytes)
72
- HEAD https://www.oriontransfer.co.nz/_gallery/products/library-inspector/_screenshots/large/Library%20Inspector%20(Libraries).png -> HTTP/2.0 200 (unspecified bytes)
73
- Unsupported content type: image/png
74
- HEAD https://www.oriontransfer.co.nz/_gallery/products/library-inspector/_screenshots/large/Library%20Inspector%20(Libraries%20Disassembly).png -> HTTP/2.0 200 (unspecified bytes)
75
- Unsupported content type: image/png
76
- HEAD https://www.oriontransfer.co.nz/_gallery/products/library-inspector/_screenshots/large/Library%20Inspector%20(Libraries%20QuickLook).png -> HTTP/2.0 200 (unspecified bytes)
77
- Unsupported content type: image/png
78
- HEAD https://www.oriontransfer.co.nz/_gallery/products/library-inspector/_screenshots/large/Library%20Inspector%20(App).png -> HTTP/2.0 200 (unspecified bytes)
79
- Unsupported content type: image/png
80
- HEAD https://www.oriontransfer.co.nz/_gallery/products/library-inspector/_screenshots/large/Library%20Inspector%20(App%20Headers).png -> HTTP/2.0 200 (unspecified bytes)
81
- Unsupported content type: image/png
82
- HEAD https://www.oriontransfer.co.nz/_gallery/products/truth-tables/_screenshots/large/Reformat%20Expression.png -> HTTP/2.0 200 (unspecified bytes)
83
- Unsupported content type: image/png
84
- HEAD https://www.oriontransfer.co.nz/_gallery/products/truth-tables/_screenshots/large/Large%20Tables.png -> HTTP/2.0 200 (unspecified bytes)
85
- Unsupported content type: image/png
86
- HEAD https://www.oriontransfer.co.nz/_gallery/products/truth-tables/_screenshots/large/Tutor.png -> HTTP/2.0 200 (unspecified bytes)
87
- Unsupported content type: image/png
88
- HEAD https://www.oriontransfer.co.nz/_gallery/products/truth-tables/_screenshots/large/Informative%20Text.png -> HTTP/2.0 200 (unspecified bytes)
89
- Unsupported content type: image/png
90
- HEAD https://www.oriontransfer.co.nz/_gallery/products/fingerprint/_screenshots/large/Fingerprint%20(3).png -> HTTP/2.0 200 (unspecified bytes)
91
- Unsupported content type: image/png
92
- HEAD https://www.oriontransfer.co.nz/_gallery/products/fingerprint/_screenshots/large/Fingerprint%20(2).png -> HTTP/2.0 200 (unspecified bytes)
93
- Unsupported content type: image/png
94
- HEAD https://www.oriontransfer.co.nz/_gallery/products/fingerprint/_screenshots/large/Fingerprint%20(1).png -> HTTP/2.0 200 (unspecified bytes)
95
- Unsupported content type: image/png
96
- HEAD https://www.oriontransfer.co.nz/services/training -> HTTP/2.0 200 (unspecified bytes)
97
- GET https://www.oriontransfer.co.nz/services/training (depth = 7)
98
- GET https://www.oriontransfer.co.nz/services/training -> HTTP/2.0 200 (2994 bytes)
99
- 14 samples: 13x 200; 1x 404. 15.12 requests per second. S/D: 35.69ms.
100
- ```
101
-
102
- ### Concurrency
103
-
104
- This benchmark determines the optimal level of concurrency (maximise throughput while keeping latency to a minimum).
105
-
106
- ```shell
107
- $ benchmark-http concurrency https://www.oriontransfer.co.nz/welcome/index
108
- I am going to benchmark https://www.oriontransfer.co.nz/welcome/index...
109
- I am running 1 asynchronous tasks that will each make sequential requests...
110
- I made 273 requests in 52.4s. The per-request latency was 191.79ms. That's 5.214149911737622 asynchronous requests/second.
111
- Variance: 997.437µs
112
- Standard Deviation: 31.58ms
113
- Standard Error: 0.0019114428646174592
114
- I am running 2 asynchronous tasks that will each make sequential requests...
115
- I made 177 requests in 16.8s. The per-request latency was 190.19ms. That's 10.51600772540387 asynchronous requests/second.
116
- Variance: 632.076µs
117
- Standard Deviation: 25.14ms
118
- Standard Error: 0.001889722381767832
119
- I am running 4 asynchronous tasks that will each make sequential requests...
120
- I made 8 requests in 372.49ms. The per-request latency was 186.25ms. That's 21.476841588829895 asynchronous requests/second.
121
- Variance: 0.048µs
122
- Standard Deviation: 219.819µs
123
- Standard Error: 7.771792696588776e-05
124
- I am running 8 asynchronous tasks that will each make sequential requests...
125
- I made 128 requests in 3.0s. The per-request latency was 188.10ms. That's 42.53004421587869 asynchronous requests/second.
126
- Variance: 399.781µs
127
- Standard Deviation: 19.99ms
128
- Standard Error: 0.0017672840585127617
129
- I am running 16 asynchronous tasks that will each make sequential requests...
130
- I made 184 requests in 2.2s. The per-request latency was 188.46ms. That's 84.89938672881854 asynchronous requests/second.
131
- Variance: 548.641µs
132
- Standard Deviation: 23.42ms
133
- Standard Error: 0.0017267724185582615
134
- I am running 32 asynchronous tasks that will each make sequential requests...
135
- I made 152 requests in 891.06ms. The per-request latency was 187.59ms. That's 170.58399627520865 asynchronous requests/second.
136
- Variance: 335.694µs
137
- Standard Deviation: 18.32ms
138
- Standard Error: 0.00148610620533633
139
- I am running 64 asynchronous tasks that will each make sequential requests...
140
- I made 438 requests in 1.3s. The per-request latency was 191.68ms. That's 333.89790173541496 asynchronous requests/second.
141
- Variance: 1.19ms
142
- Standard Deviation: 34.51ms
143
- Standard Error: 0.001648801656177374
144
- I am running 128 asynchronous tasks that will each make sequential requests...
145
- I made 360 requests in 533.83ms. The per-request latency was 189.81ms. That's 674.373540567776 asynchronous requests/second.
146
- Variance: 555.212µs
147
- Standard Deviation: 23.56ms
148
- Standard Error: 0.0012418759009531876
149
- I am running 256 asynchronous tasks that will each make sequential requests...
150
- I made 512 requests in 463.03ms. The per-request latency was 231.51ms. That's 1105.762787139087 asynchronous requests/second.
151
- Variance: 888.185µs
152
- Standard Deviation: 29.80ms
153
- Standard Error: 0.0013170938569343825
154
- I am running 192 asynchronous tasks that will each make sequential requests...
155
- I made 384 requests in 380.97ms. The per-request latency was 190.48ms. That's 1007.9615261872923 asynchronous requests/second.
156
- Variance: 142.770µs
157
- Standard Deviation: 11.95ms
158
- Standard Error: 0.0006097518459132856
159
- I am running 224 asynchronous tasks that will each make sequential requests...
160
- I made 448 requests in 411.79ms. The per-request latency was 205.89ms. That's 1087.9398101463066 asynchronous requests/second.
161
- Variance: 215.480µs
162
- Standard Deviation: 14.68ms
163
- Standard Error: 0.0006935294886115942
164
- I am running 240 asynchronous tasks that will each make sequential requests...
165
- I made 480 requests in 401.62ms. The per-request latency was 200.81ms. That's 1195.1473779597363 asynchronous requests/second.
166
- Variance: 292.021µs
167
- Standard Deviation: 17.09ms
168
- Standard Error: 0.0007799848849992035
169
- I am running 248 asynchronous tasks that will each make sequential requests...
170
- I made 496 requests in 432.58ms. The per-request latency was 216.29ms. That's 1146.621534849607 asynchronous requests/second.
171
- Variance: 446.681µs
172
- Standard Deviation: 21.13ms
173
- Standard Error: 0.0009489813840514241
174
- I am running 252 asynchronous tasks that will each make sequential requests...
175
- I made 504 requests in 417.86ms. The per-request latency was 208.93ms. That's 1206.1477638702509 asynchronous requests/second.
176
- Variance: 222.939µs
177
- Standard Deviation: 14.93ms
178
- Standard Error: 0.0006650854376052381
179
- I am running 254 asynchronous tasks that will each make sequential requests...
180
- I made 508 requests in 419.67ms. The per-request latency was 209.83ms. That's 1210.4835614086478 asynchronous requests/second.
181
- Variance: 177.005µs
182
- Standard Deviation: 13.30ms
183
- Standard Error: 0.0005902836562252991
184
- I am running 255 asynchronous tasks that will each make sequential requests...
185
- I made 510 requests in 434.38ms. The per-request latency was 217.19ms. That's 1174.0936493567908 asynchronous requests/second.
186
- Variance: 457.592µs
187
- Standard Deviation: 21.39ms
188
- Standard Error: 0.000947227304291054
189
- Your server can handle 255 concurrent requests.
190
- At this level of concurrency, requests have ~1.13x higher latency.
191
- ```
192
-
193
- ## Contributing
194
-
195
- 1. Fork it
196
- 2. Create your feature branch (`git checkout -b my-new-feature`)
197
- 3. Commit your changes (`git commit -am 'Add some feature'`)
198
- 4. Push to the branch (`git push origin my-new-feature`)
199
- 5. Create new Pull Request
200
-
201
- ## License
202
-
203
- Released under the MIT license.
204
-
205
- Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
206
-
207
- Permission is hereby granted, free of charge, to any person obtaining a copy
208
- of this software and associated documentation files (the "Software"), to deal
209
- in the Software without restriction, including without limitation the rights
210
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
211
- copies of the Software, and to permit persons to whom the Software is
212
- furnished to do so, subject to the following conditions:
213
-
214
- The above copyright notice and this permission notice shall be included in
215
- all copies or substantial portions of the Software.
216
-
217
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
222
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
223
- THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -1,31 +0,0 @@
1
- require_relative "lib/benchmark/http/version"
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = "benchmark-http"
5
- spec.version = Benchmark::HTTP::VERSION
6
- spec.authors = ["Samuel Williams"]
7
- spec.email = ["samuel.williams@oriontransfer.co.nz"]
8
-
9
- spec.summary = "An asynchronous benchmark toolbox for modern HTTP servers."
10
- spec.homepage = "https://github.com/socketry/benchmark-http"
11
-
12
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
13
- f.match(%r{^(test|spec|features)/})
14
- end
15
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
- spec.require_paths = ["lib"]
17
-
18
- spec.required_ruby_version = '~> 2.4'
19
-
20
- spec.add_dependency("async-io", "~> 1.5")
21
- spec.add_dependency("async-http", "~> 0.45")
22
- spec.add_dependency("async-await")
23
-
24
- spec.add_dependency("trenni-sanitize")
25
-
26
- spec.add_dependency('samovar', "~> 2.0")
27
-
28
- spec.add_development_dependency "bundler"
29
- spec.add_development_dependency "rake", "~> 10.0"
30
- spec.add_development_dependency "rspec", "~> 3.0"
31
- end