falcon 0.36.4 → 0.37.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/falcon/adapters/input.rb +32 -11
- data/lib/falcon/adapters/output.rb +20 -1
- data/lib/falcon/adapters/rack.rb +60 -39
- data/lib/falcon/adapters/response.rb +23 -1
- data/lib/falcon/adapters/rewindable.rb +10 -3
- data/lib/falcon/command.rb +2 -0
- data/lib/falcon/command/host.rb +22 -3
- data/lib/falcon/command/paths.rb +4 -0
- data/lib/falcon/command/proxy.rb +14 -0
- data/lib/falcon/command/redirect.rb +12 -0
- data/lib/falcon/command/serve.rb +27 -16
- data/lib/falcon/command/supervisor.rb +15 -1
- data/lib/falcon/command/top.rb +16 -0
- data/lib/falcon/command/virtual.rb +15 -0
- data/lib/falcon/configuration.rb +69 -7
- data/lib/falcon/controller/host.rb +12 -0
- data/lib/falcon/controller/proxy.rb +13 -0
- data/lib/falcon/controller/redirect.rb +7 -0
- data/lib/falcon/controller/serve.rb +17 -2
- data/lib/falcon/controller/virtual.rb +17 -0
- data/lib/falcon/endpoint.rb +8 -0
- data/lib/falcon/{configuration/proxy.rb → environments.rb} +9 -5
- data/lib/falcon/environments/application.rb +72 -0
- data/lib/falcon/{configuration/application.rb → environments/lets_encrypt_tls.rb} +21 -20
- data/lib/falcon/{configuration/lets_encrypt_tls.rb → environments/proxy.rb} +13 -6
- data/lib/falcon/{configuration → environments}/rack.rb +14 -2
- data/lib/falcon/{configuration → environments}/self_signed_tls.rb +9 -1
- data/lib/falcon/{configuration → environments}/supervisor.rb +19 -5
- data/lib/falcon/{configuration → environments}/tls.rb +39 -5
- data/lib/falcon/extensions/openssl.rb +1 -0
- data/lib/falcon/middleware/proxy.rb +26 -5
- data/lib/falcon/middleware/redirect.rb +11 -0
- data/lib/falcon/{verbose.rb → middleware/verbose.rb} +34 -26
- data/lib/falcon/proxy_endpoint.rb +21 -0
- data/lib/falcon/server.rb +8 -2
- data/lib/falcon/service/application.rb +24 -2
- data/lib/falcon/service/generic.rb +18 -0
- data/lib/falcon/service/proxy.rb +6 -0
- data/lib/falcon/service/supervisor.rb +13 -1
- data/lib/falcon/services.rb +21 -0
- data/lib/falcon/tls.rb +4 -2
- data/lib/falcon/version.rb +1 -1
- data/lib/rack/handler/falcon.rb +8 -2
- metadata +64 -121
- data/.editorconfig +0 -5
- data/.github/FUNDING.yml +0 -3
- data/.github/workflows/development.yml +0 -60
- data/.gitignore +0 -14
- data/.rspec +0 -3
- data/Gemfile +0 -17
- data/README.md +0 -316
- data/examples/beer/config.ru +0 -57
- data/examples/beer/falcon.rb +0 -8
- data/examples/benchmark/config.ru +0 -39
- data/examples/benchmark/falcon.rb +0 -6
- data/examples/csv/config.ru +0 -31
- data/examples/google/falcon.rb +0 -14
- data/examples/hello/config.ru +0 -22
- data/examples/hello/falcon.rb +0 -24
- data/examples/hello/preload.rb +0 -7
- data/examples/internet/config.ru +0 -54
- data/examples/memory/allocations.rb +0 -39
- data/examples/memory/config.ru +0 -14
- data/examples/push/client.rb +0 -29
- data/examples/push/config.ru +0 -28
- data/examples/push/index.html +0 -14
- data/examples/push/script.js +0 -2
- data/examples/push/style.css +0 -4
- data/examples/redis/Gemfile +0 -9
- data/examples/redis/config.ru +0 -28
- data/examples/sequel/Gemfile +0 -4
- data/examples/sequel/config.ru +0 -8
- data/examples/sequel/data.sqlite3 +0 -0
- data/examples/server/standalone.rb +0 -27
- data/examples/sinatra/Gemfile +0 -7
- data/examples/sinatra/Gemfile.lock +0 -53
- data/examples/sinatra/config.ru +0 -16
- data/examples/trailers/config.ru +0 -34
- data/examples/trailers/falcon.rb +0 -8
- data/falcon.gemspec +0 -45
- data/gems/rack1.gemfile +0 -4
- data/gems/rack3.gemfile +0 -4
- data/lib/falcon/adapters/early_hints.rb +0 -49
- data/logo-square.afdesign +0 -0
- data/logo.afdesign +0 -0
- data/logo.svg +0 -107
- data/server.rb +0 -21
- data/tasks/benchmark.rake +0 -103
data/examples/sinatra/Gemfile
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
async (1.9.1)
|
5
|
-
nio4r (~> 2.3)
|
6
|
-
timers (~> 4.1)
|
7
|
-
async-container (0.5.0)
|
8
|
-
async (~> 1.0)
|
9
|
-
async-io (~> 1.4)
|
10
|
-
async-http (0.24.3)
|
11
|
-
async (~> 1.6)
|
12
|
-
async-io (~> 1.12)
|
13
|
-
http-2 (~> 0.9.0)
|
14
|
-
async-io (1.12.1)
|
15
|
-
async (~> 1.3)
|
16
|
-
falcon (0.15.2)
|
17
|
-
async-container (~> 0.5.0)
|
18
|
-
async-http (~> 0.24.0)
|
19
|
-
async-io (~> 1.9)
|
20
|
-
rack (>= 1.0)
|
21
|
-
samovar (~> 1.3)
|
22
|
-
hitimes (1.2.6)
|
23
|
-
http-2 (0.9.1)
|
24
|
-
mapping (1.1.1)
|
25
|
-
mustermann (1.0.2)
|
26
|
-
nio4r (2.3.1)
|
27
|
-
rack (2.0.8)
|
28
|
-
rack-protection (2.0.3)
|
29
|
-
rack
|
30
|
-
rainbow (2.2.2)
|
31
|
-
rake
|
32
|
-
rake (13.0.1)
|
33
|
-
samovar (1.8.0)
|
34
|
-
mapping (~> 1.0)
|
35
|
-
rainbow (~> 2.0)
|
36
|
-
sinatra (2.0.3)
|
37
|
-
mustermann (~> 1.0)
|
38
|
-
rack (~> 2.0)
|
39
|
-
rack-protection (= 2.0.3)
|
40
|
-
tilt (~> 2.0)
|
41
|
-
tilt (2.0.8)
|
42
|
-
timers (4.1.2)
|
43
|
-
hitimes
|
44
|
-
|
45
|
-
PLATFORMS
|
46
|
-
ruby
|
47
|
-
|
48
|
-
DEPENDENCIES
|
49
|
-
falcon
|
50
|
-
sinatra
|
51
|
-
|
52
|
-
BUNDLED WITH
|
53
|
-
1.16.1
|
data/examples/sinatra/config.ru
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
#!/usr/bin/env falcon --verbose serve -c
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# Save this as `config.ru`, make it executable and then run it (or run falcon serve by hand)
|
5
|
-
|
6
|
-
# Middleware that responds to incoming requests:
|
7
|
-
require 'sinatra/base'
|
8
|
-
class MyApp < Sinatra::Base
|
9
|
-
get "/" do
|
10
|
-
response = Faraday.get 'http://sushi.com/nigiri/sake.json'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# Build the middleware stack:
|
15
|
-
use MyApp # Then, it will get to Sinatra.
|
16
|
-
run lambda {|env| [404, {}, []]} # Bottom of the stack, give 404.
|
data/examples/trailers/config.ru
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env falcon --verbose serve -c
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'async'
|
5
|
-
|
6
|
-
class RequestLogger
|
7
|
-
def initialize(app)
|
8
|
-
@app = app
|
9
|
-
end
|
10
|
-
|
11
|
-
def call(env)
|
12
|
-
logger = Async.logger.with(level: :debug, name: "middleware")
|
13
|
-
|
14
|
-
Async(logger: logger) do
|
15
|
-
@app.call(env)
|
16
|
-
end.wait
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
use RequestLogger
|
21
|
-
|
22
|
-
run lambda {|env|
|
23
|
-
start_time = Async::Clock.now
|
24
|
-
|
25
|
-
server_timing = ->{
|
26
|
-
"app;dur=#{Async::Clock.now - start_time}"
|
27
|
-
}
|
28
|
-
|
29
|
-
[
|
30
|
-
200,
|
31
|
-
[["trailers", "server-timing"], ["server-timing", server_timing]],
|
32
|
-
["Hello World"]
|
33
|
-
]
|
34
|
-
}
|
data/examples/trailers/falcon.rb
DELETED
data/falcon.gemspec
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/falcon/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "falcon"
|
6
|
-
spec.version = Falcon::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "A fast, asynchronous, rack-compatible web server."
|
11
|
-
spec.homepage = "https://github.com/socketry/falcon"
|
12
|
-
|
13
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
14
|
-
f.match(%r{^(test|spec|features)/})
|
15
|
-
end
|
16
|
-
|
17
|
-
spec.required_ruby_version = '~> 2.4'
|
18
|
-
|
19
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
|
22
|
-
spec.add_dependency "async", "~> 1.13"
|
23
|
-
spec.add_dependency "async-io", "~> 1.22"
|
24
|
-
spec.add_dependency "async-http", "~> 0.52.0"
|
25
|
-
spec.add_dependency "async-http-cache", "~> 0.2.0"
|
26
|
-
spec.add_dependency "async-container", "~> 0.16.0"
|
27
|
-
|
28
|
-
spec.add_dependency "rack", ">= 1.0"
|
29
|
-
|
30
|
-
spec.add_dependency 'samovar', "~> 2.1"
|
31
|
-
spec.add_dependency 'localhost', "~> 1.1"
|
32
|
-
spec.add_dependency 'build-environment', '~> 1.13'
|
33
|
-
|
34
|
-
spec.add_dependency 'process-metrics', '~> 0.2.0'
|
35
|
-
|
36
|
-
spec.add_development_dependency "async-rspec", "~> 1.7"
|
37
|
-
spec.add_development_dependency "async-websocket", "~> 0.14.0"
|
38
|
-
spec.add_development_dependency "async-process", "~> 1.1"
|
39
|
-
|
40
|
-
spec.add_development_dependency "bake"
|
41
|
-
spec.add_development_dependency "covered"
|
42
|
-
spec.add_development_dependency "bundler"
|
43
|
-
spec.add_development_dependency "rspec", "~> 3.6"
|
44
|
-
spec.add_development_dependency "bake-bundler"
|
45
|
-
end
|
data/gems/rack1.gemfile
DELETED
data/gems/rack3.gemfile
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require 'protocol/http/middleware'
|
24
|
-
|
25
|
-
module Falcon
|
26
|
-
module Adapters
|
27
|
-
class EarlyHints
|
28
|
-
PRELOAD = /<(?<path>.*?)>;.*?rel=preload/
|
29
|
-
|
30
|
-
def initialize(request)
|
31
|
-
@request = request
|
32
|
-
end
|
33
|
-
|
34
|
-
def push(path, preload: true, **options)
|
35
|
-
@request.push(path)
|
36
|
-
end
|
37
|
-
|
38
|
-
def call(headers)
|
39
|
-
headers.each do |key, value|
|
40
|
-
if key.casecmp("link").zero? and match = PRELOAD.match(value)
|
41
|
-
@request.push(match[:path])
|
42
|
-
else
|
43
|
-
Async.logger.warn(@request) {"Unsure how to handle early hints header: #{key}"}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/logo-square.afdesign
DELETED
Binary file
|
data/logo.afdesign
DELETED
Binary file
|
data/logo.svg
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
-
<svg width="100%" height="100%" viewBox="0 0 600 220" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;">
|
4
|
-
<g id="Name" transform="matrix(1,0,-0.176327,1,237.874,11.0473)">
|
5
|
-
<g transform="matrix(12.3597,0,0,0.991236,2645.68,0.928996)">
|
6
|
-
<g opacity="0.5">
|
7
|
-
<g id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,97.1636)">
|
8
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
9
|
-
</g>
|
10
|
-
<g id="a2YeZXbxK1" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,107.164)">
|
11
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
12
|
-
</g>
|
13
|
-
<g id="a2YeZXbxK2" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,117.164)">
|
14
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
15
|
-
</g>
|
16
|
-
<g id="a2YeZXbxK3" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,127.164)">
|
17
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
18
|
-
</g>
|
19
|
-
<g id="a2YeZXbxK4" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,137.164)">
|
20
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
21
|
-
</g>
|
22
|
-
<g id="a2YeZXbxK5" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,147.164)">
|
23
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
24
|
-
</g>
|
25
|
-
<g id="a2YeZXbxK6" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,157.164)">
|
26
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
27
|
-
</g>
|
28
|
-
<g id="a2YeZXbxK7" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,167.164)">
|
29
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
30
|
-
</g>
|
31
|
-
<g id="a2YeZXbxK8" serif:id="a2YeZXbxK" transform="matrix(-1.71632,0,0,0.386532,-68.0238,177.164)">
|
32
|
-
<path d="M73.939,38.385L94.531,27.962L73.939,22.859L73.939,38.385Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
33
|
-
</g>
|
34
|
-
</g>
|
35
|
-
</g>
|
36
|
-
<g transform="matrix(0.882487,0,0,0.533211,-371.748,95.1582)">
|
37
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
38
|
-
<path d="M228.068,94.768L228.068,63.178L252.768,63.178L252.768,60.058L228.068,60.058L228.068,31.978L254.068,31.978L254.068,28.858L224.688,28.858L224.688,94.768L228.068,94.768Z" style="fill:white;fill-rule:nonzero;"/>
|
39
|
-
</g>
|
40
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
41
|
-
<path d="M274.998,94.768L277.468,88.268L320.368,88.268L322.838,94.768L326.478,94.768L301.388,28.858L296.448,28.858L271.358,94.768L274.998,94.768ZM298.918,31.978L319.198,85.148L278.638,85.148L298.918,31.978Z" style="fill:white;fill-rule:nonzero;"/>
|
42
|
-
</g>
|
43
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
44
|
-
<path d="M389.658,94.768L389.658,91.648L360.538,91.648L360.538,28.858L357.158,28.858L357.158,94.768L389.658,94.768Z" style="fill:white;fill-rule:nonzero;"/>
|
45
|
-
</g>
|
46
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
47
|
-
<path d="M412.018,61.878C412.018,57.718 412.733,53.818 414.163,50.178C415.593,46.538 417.608,43.374 420.208,40.688C422.808,38.001 425.971,35.878 429.698,34.318C433.425,32.758 437.585,31.978 442.178,31.978C444.431,31.978 446.446,32.129 448.223,32.433C450,32.736 451.495,33.104 452.708,33.538C454.181,33.971 455.438,34.491 456.478,35.098L458.298,31.978C456.911,31.371 455.438,30.808 453.878,30.288C452.405,29.854 450.715,29.464 448.808,29.118C446.901,28.771 444.691,28.598 442.178,28.598C437.758,28.598 433.533,29.378 429.503,30.938C425.473,32.498 421.92,34.729 418.843,37.633C415.766,40.536 413.296,44.046 411.433,48.163C409.57,52.279 408.638,56.851 408.638,61.878C408.638,66.991 409.526,71.584 411.303,75.658C413.08,79.731 415.528,83.219 418.648,86.123C421.768,89.026 425.408,91.258 429.568,92.818C433.728,94.378 438.148,95.158 442.828,95.158C445.428,95.158 447.768,94.941 449.848,94.508C451.928,94.074 453.705,93.598 455.178,93.078C456.825,92.471 458.298,91.778 459.598,90.998L457.778,87.878C456.651,88.658 455.351,89.308 453.878,89.828C452.578,90.348 451.018,90.803 449.198,91.193C447.378,91.583 445.255,91.778 442.828,91.778C438.061,91.778 433.771,90.998 429.958,89.438C426.145,87.878 422.916,85.754 420.273,83.068C417.63,80.381 415.593,77.218 414.163,73.578C412.733,69.938 412.018,66.038 412.018,61.878Z" style="fill:white;fill-rule:nonzero;"/>
|
48
|
-
</g>
|
49
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
50
|
-
<path d="M479.878,61.878C479.878,66.471 480.745,70.783 482.478,74.813C484.211,78.843 486.595,82.374 489.628,85.408C492.661,88.441 496.193,90.824 500.223,92.558C504.253,94.291 508.565,95.158 513.158,95.158C517.751,95.158 522.063,94.291 526.093,92.558C530.123,90.824 533.655,88.441 536.688,85.408C539.721,82.374 542.105,78.843 543.838,74.813C545.571,70.783 546.438,66.471 546.438,61.878C546.438,57.284 545.571,52.973 543.838,48.943C542.105,44.913 539.721,41.381 536.688,38.348C533.655,35.314 530.123,32.931 526.093,31.198C522.063,29.464 517.751,28.598 513.158,28.598C508.565,28.598 504.253,29.464 500.223,31.198C496.193,32.931 492.661,35.314 489.628,38.348C486.595,41.381 484.211,44.913 482.478,48.943C480.745,52.973 479.878,57.284 479.878,61.878ZM513.158,91.778C508.998,91.778 505.12,90.998 501.523,89.438C497.926,87.878 494.763,85.733 492.033,83.003C489.303,80.273 487.158,77.109 485.598,73.513C484.038,69.916 483.258,66.038 483.258,61.878C483.258,57.718 484.038,53.839 485.598,50.243C487.158,46.646 489.303,43.483 492.033,40.753C494.763,38.023 497.926,35.878 501.523,34.318C505.12,32.758 508.998,31.978 513.158,31.978C517.318,31.978 521.196,32.758 524.793,34.318C528.39,35.878 531.553,38.023 534.283,40.753C537.013,43.483 539.158,46.646 540.718,50.243C542.278,53.839 543.058,57.718 543.058,61.878C543.058,66.038 542.278,69.916 540.718,73.513C539.158,77.109 537.013,80.273 534.283,83.003C531.553,85.733 528.39,87.878 524.793,89.438C521.196,90.998 517.318,91.778 513.158,91.778Z" style="fill:white;fill-rule:nonzero;"/>
|
51
|
-
</g>
|
52
|
-
<g transform="matrix(1.13316,0,0,1.87543,-27.5826,-16.1583)">
|
53
|
-
<path d="M581.278,94.768L581.278,34.708L624.178,94.768L627.558,94.768L627.558,28.858L624.178,28.858L624.178,88.918L581.278,28.858L577.898,28.858L577.898,94.768L581.278,94.768Z" style="fill:white;fill-rule:nonzero;"/>
|
54
|
-
</g>
|
55
|
-
</g>
|
56
|
-
<g transform="matrix(1,0,0,1,-396.089,86.5424)">
|
57
|
-
<path d="M211.688,18.458L262.778,18.458L262.778,41.208L239.378,41.208L239.378,50.828L262.388,50.828L262.388,72.408L239.378,72.408L239.378,105.168L211.688,105.168L211.688,18.458ZM228.068,94.768L228.068,63.178L252.768,63.178L252.768,60.058L228.068,60.058L228.068,31.978L254.068,31.978L254.068,28.858L224.688,28.858L224.688,94.768L228.068,94.768Z" style="fill-rule:nonzero;"/>
|
58
|
-
<path d="M288.518,18.458L309.318,18.458L342.208,105.168L314.908,105.168L312.048,97.368L285.788,97.368L282.928,105.168L255.628,105.168L288.518,18.458ZM304.768,78.258L298.918,63.048L293.068,78.258L304.768,78.258ZM274.998,94.768L277.468,88.268L320.368,88.268L322.838,94.768L326.478,94.768L301.388,28.858L296.448,28.858L271.358,94.768L274.998,94.768ZM298.918,31.978L319.198,85.148L278.638,85.148L298.918,31.978Z" style="fill-rule:nonzero;"/>
|
59
|
-
<path d="M344.158,18.458L373.018,18.458L373.018,82.418L396.938,82.418L396.938,105.168L344.158,105.168L344.158,18.458ZM389.658,94.768L389.658,91.648L360.538,91.648L360.538,28.858L357.158,28.858L357.158,94.768L389.658,94.768Z" style="fill-rule:nonzero;"/>
|
60
|
-
<path d="M412.018,61.878C412.018,57.718 412.733,53.818 414.163,50.178C415.593,46.538 417.608,43.374 420.208,40.688C422.808,38.001 425.971,35.878 429.698,34.318C433.425,32.758 437.585,31.978 442.178,31.978C444.431,31.978 446.446,32.129 448.223,32.433C450,32.736 451.495,33.104 452.708,33.538C454.181,33.971 455.438,34.491 456.478,35.098L458.298,31.978C456.911,31.371 455.438,30.808 453.878,30.288C452.405,29.854 450.715,29.464 448.808,29.118C446.901,28.771 444.691,28.598 442.178,28.598C437.758,28.598 433.533,29.378 429.503,30.938C425.473,32.498 421.92,34.729 418.843,37.633C415.766,40.536 413.296,44.046 411.433,48.163C409.57,52.279 408.638,56.851 408.638,61.878C408.638,66.991 409.526,71.584 411.303,75.658C413.08,79.731 415.528,83.219 418.648,86.123C421.768,89.026 425.408,91.258 429.568,92.818C433.728,94.378 438.148,95.158 442.828,95.158C445.428,95.158 447.768,94.941 449.848,94.508C451.928,94.074 453.705,93.598 455.178,93.078C456.825,92.471 458.298,91.778 459.598,90.998L457.778,87.878C456.651,88.658 455.351,89.308 453.878,89.828C452.578,90.348 451.018,90.803 449.198,91.193C447.378,91.583 445.255,91.778 442.828,91.778C438.061,91.778 433.771,90.998 429.958,89.438C426.145,87.878 422.916,85.754 420.273,83.068C417.63,80.381 415.593,77.218 414.163,73.578C412.733,69.938 412.018,66.038 412.018,61.878ZM395.638,61.878C395.638,54.944 396.851,48.683 399.278,43.093C401.705,37.503 404.998,32.714 409.158,28.728C413.318,24.741 418.171,21.686 423.718,19.563C429.265,17.439 435.158,16.378 441.398,16.378C446.338,16.378 450.736,16.854 454.593,17.808C458.45,18.761 461.765,19.844 464.538,21.058C467.745,22.444 470.518,23.961 472.858,25.608L459.208,49.658C457.821,48.618 456.305,47.621 454.658,46.668C453.185,45.974 451.43,45.303 449.393,44.653C447.356,44.003 445.038,43.678 442.438,43.678C439.751,43.678 437.281,44.154 435.028,45.108C432.775,46.061 430.803,47.361 429.113,49.008C427.423,50.654 426.101,52.583 425.148,54.793C424.195,57.003 423.718,59.364 423.718,61.878C423.718,64.391 424.216,66.753 425.213,68.963C426.21,71.173 427.575,73.101 429.308,74.748C431.041,76.394 433.078,77.694 435.418,78.648C437.758,79.601 440.315,80.078 443.088,80.078C445.861,80.078 448.331,79.731 450.498,79.038C452.665,78.344 454.485,77.564 455.958,76.698C457.691,75.744 459.208,74.618 460.508,73.318L474.158,97.368C471.818,99.274 469.045,100.964 465.838,102.438C463.065,103.651 459.728,104.778 455.828,105.818C451.928,106.858 447.465,107.378 442.438,107.378C435.678,107.378 429.438,106.273 423.718,104.063C417.998,101.853 413.058,98.754 408.898,94.768C404.738,90.781 401.488,85.993 399.148,80.403C396.808,74.813 395.638,68.638 395.638,61.878Z" style="fill-rule:nonzero;"/>
|
61
|
-
<path d="M467.658,61.878C467.658,55.638 468.85,49.744 471.233,44.198C473.616,38.651 476.866,33.819 480.983,29.703C485.1,25.586 489.931,22.336 495.478,19.953C501.025,17.569 506.918,16.378 513.158,16.378C519.398,16.378 525.291,17.569 530.838,19.953C536.385,22.336 541.216,25.586 545.333,29.703C549.45,33.819 552.7,38.651 555.083,44.198C557.466,49.744 558.658,55.638 558.658,61.878C558.658,68.118 557.466,74.011 555.083,79.558C552.7,85.104 549.45,89.936 545.333,94.053C541.216,98.169 536.385,101.419 530.838,103.803C525.291,106.186 519.398,107.378 513.158,107.378C506.918,107.378 501.025,106.186 495.478,103.803C489.931,101.419 485.1,98.169 480.983,94.053C476.866,89.936 473.616,85.104 471.233,79.558C468.85,74.011 467.658,68.118 467.658,61.878ZM479.878,61.878C479.878,66.471 480.745,70.783 482.478,74.813C484.211,78.843 486.595,82.374 489.628,85.408C492.661,88.441 496.193,90.824 500.223,92.558C504.253,94.291 508.565,95.158 513.158,95.158C517.751,95.158 522.063,94.291 526.093,92.558C530.123,90.824 533.655,88.441 536.688,85.408C539.721,82.374 542.105,78.843 543.838,74.813C545.571,70.783 546.438,66.471 546.438,61.878C546.438,57.284 545.571,52.973 543.838,48.943C542.105,44.913 539.721,41.381 536.688,38.348C533.655,35.314 530.123,32.931 526.093,31.198C522.063,29.464 517.751,28.598 513.158,28.598C508.565,28.598 504.253,29.464 500.223,31.198C496.193,32.931 492.661,35.314 489.628,38.348C486.595,41.381 484.211,44.913 482.478,48.943C480.745,52.973 479.878,57.284 479.878,61.878ZM494.958,61.878C494.958,64.391 495.435,66.753 496.388,68.963C497.341,71.173 498.641,73.101 500.288,74.748C501.935,76.394 503.863,77.694 506.073,78.648C508.283,79.601 510.645,80.078 513.158,80.078C515.671,80.078 518.033,79.601 520.243,78.648C522.453,77.694 524.381,76.394 526.028,74.748C527.675,73.101 528.975,71.173 529.928,68.963C530.881,66.753 531.358,64.391 531.358,61.878C531.358,59.364 530.881,57.003 529.928,54.793C528.975,52.583 527.675,50.654 526.028,49.008C524.381,47.361 522.453,46.061 520.243,45.108C518.033,44.154 515.671,43.678 513.158,43.678C510.645,43.678 508.283,44.154 506.073,45.108C503.863,46.061 501.935,47.361 500.288,49.008C498.641,50.654 497.341,52.583 496.388,54.793C495.435,57.003 494.958,59.364 494.958,61.878ZM513.158,91.778C508.998,91.778 505.12,90.998 501.523,89.438C497.926,87.878 494.763,85.733 492.033,83.003C489.303,80.273 487.158,77.109 485.598,73.513C484.038,69.916 483.258,66.038 483.258,61.878C483.258,57.718 484.038,53.839 485.598,50.243C487.158,46.646 489.303,43.483 492.033,40.753C494.763,38.023 497.926,35.878 501.523,34.318C505.12,32.758 508.998,31.978 513.158,31.978C517.318,31.978 521.196,32.758 524.793,34.318C528.39,35.878 531.553,38.023 534.283,40.753C537.013,43.483 539.158,46.646 540.718,50.243C542.278,53.839 543.058,57.718 543.058,61.878C543.058,66.038 542.278,69.916 540.718,73.513C539.158,77.109 537.013,80.273 534.283,83.003C531.553,85.733 528.39,87.878 524.793,89.438C521.196,90.998 517.318,91.778 513.158,91.778Z" style="fill-rule:nonzero;"/>
|
62
|
-
<path d="M565.808,18.458L588.558,18.458L612.478,51.868L612.478,18.458L639.648,18.458L639.648,105.168L616.768,105.168L592.978,71.888L592.978,105.168L565.808,105.168L565.808,18.458ZM581.278,94.768L581.278,34.708L624.178,94.768L627.558,94.768L627.558,28.858L624.178,28.858L624.178,88.918L581.278,28.858L577.898,28.858L577.898,94.768L581.278,94.768Z" style="fill-rule:nonzero;"/>
|
63
|
-
</g>
|
64
|
-
</g>
|
65
|
-
<g id="Logo" transform="matrix(1,0,0,1,709.001,7.14337)">
|
66
|
-
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
67
|
-
<path id="afwWrtpzn" d="M31.754,72.307L65.845,74.515L52.43,152.577L83.228,138.125L71.84,178.489L108.947,149.621L97.8,196.041L175.838,113.383L137.61,16.273L65.845,2.762L2.415,42.281L19.714,89.075L31.754,72.307Z" style="fill:rgb(86,86,86);fill-rule:nonzero;"/>
|
68
|
-
<path id="afwWrtpzn1" serif:id="afwWrtpzn" d="M31.754,72.307L65.845,74.515L52.43,152.577L83.228,138.125L71.84,178.489L108.947,149.621L97.8,196.041L175.838,113.383L137.61,16.273L65.845,2.762L2.415,42.281L19.714,89.075L31.754,72.307Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
69
|
-
</g>
|
70
|
-
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
71
|
-
<path id="f9Ro2kNLjt" d="M44.251,24.524L73.806,49.206L73.806,67.536L119.535,105.549L108.839,126.334L130.878,108.304L130.878,136.798L166.477,110.524L132.229,22.859L66.665,10.591L44.251,24.524Z" style="fill:rgb(102,102,102);fill-rule:nonzero;"/>
|
72
|
-
</g>
|
73
|
-
<g id="f9Ro2kNLjt1" serif:id="f9Ro2kNLjt" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
74
|
-
<path d="M107.112,106.033L73.806,75.082L67.438,113.958L107.112,106.033Z" style="fill:url(#_Linear1);fill-rule:nonzero;"/>
|
75
|
-
</g>
|
76
|
-
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
77
|
-
<path id="a2YeZXbxK9" serif:id="a2YeZXbxK" d="M74.965,38.385L94.531,27.962L73.939,22.859L65.06,28.963L74.965,38.385Z" style="fill:rgb(243,242,182);fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
78
|
-
</g>
|
79
|
-
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
80
|
-
<path id="bck4zTqCc" d="M31.138,70.92L66.327,70.003L66.665,53.621L34.89,25.682L4.551,43.331L20.728,83.297L31.138,70.92Z" style="fill:url(#_Linear2);fill-rule:nonzero;"/>
|
81
|
-
<path id="bck4zTqCc1" serif:id="bck4zTqCc" d="M31.138,70.92L66.327,70.003L66.665,53.621L34.89,25.682L4.551,43.331L20.728,83.297L31.138,70.92Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
82
|
-
</g>
|
83
|
-
<g transform="matrix(1,0,0,1,-292.6,1.20888)">
|
84
|
-
<g opacity="0.5">
|
85
|
-
<path id="c8tH4sZd3" d="M38.69,39.748L29.642,38.747L34.058,35.779L38.69,39.748Z" style="fill-rule:nonzero;"/>
|
86
|
-
<path id="c8tH4sZd31" serif:id="c8tH4sZd3" d="M38.69,39.748L29.642,38.747L34.058,35.779L38.69,39.748Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:1.21px;"/>
|
87
|
-
</g>
|
88
|
-
</g>
|
89
|
-
<g id="b4jPLXq2Q" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
90
|
-
<path d="M66.665,54.489L30.656,70.678" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:4.83px;"/>
|
91
|
-
</g>
|
92
|
-
<g id="biuXOi8NB" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
93
|
-
<path d="M79.452,29.193L71.78,33.21L68.149,26.888L79.452,29.193Z" style="fill-rule:nonzero;"/>
|
94
|
-
</g>
|
95
|
-
<g id="biuXOi8NB1" serif:id="biuXOi8NB" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
96
|
-
<path d="M79.452,29.193L71.78,33.21L68.149,26.888L79.452,29.193Z" style="fill-opacity:0;fill-rule:nonzero;stroke:black;stroke-width:1.21px;"/>
|
97
|
-
</g>
|
98
|
-
<g id="aBf8t1uYg" transform="matrix(1,0,0,1,-292.6,1.20888)">
|
99
|
-
<path d="M90.948,128.715L82.818,161.588L116.016,138.209L109.924,173.446L145.161,133.456L125.51,147.015L125.51,121.26L99.079,140.863L108.244,113.312L65.81,121.26L62.817,138.209L90.948,128.715Z" style="fill:url(#_Linear3);fill-rule:nonzero;"/>
|
100
|
-
</g>
|
101
|
-
</g>
|
102
|
-
<defs>
|
103
|
-
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.28147,40.3898,-40.3898,8.28147,75.559,73.5339)"><stop offset="0" style="stop-color:rgb(219,221,216);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(157,136,111);stop-opacity:1"/></linearGradient>
|
104
|
-
<linearGradient id="_Linear2" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-40.0703,32.5112,-32.5112,-40.0703,56.4664,35.6672)"><stop offset="0" style="stop-color:rgb(243,242,182);stop-opacity:1"/><stop offset="0.19" style="stop-color:rgb(178,177,142);stop-opacity:1"/><stop offset="0.4" style="stop-color:rgb(114,114,103);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(86,86,86);stop-opacity:1"/></linearGradient>
|
105
|
-
<linearGradient id="_Linear3" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(28.5157,44.2085,-44.2085,28.5157,93.954,114.461)"><stop offset="0" style="stop-color:rgb(159,139,114);stop-opacity:1"/><stop offset="1" style="stop-color:rgb(138,105,90);stop-opacity:1"/></linearGradient>
|
106
|
-
</defs>
|
107
|
-
</svg>
|
data/server.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#!/usr/bin/env -S ./bin/falcon virtual --bind-insecure http://[::]:1080 --bind-secure https://[::]:1443
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# You will want edit your `/etc/hosts`, adding the following:
|
5
|
-
# 127.0.0.1 benchmark.localhost beer.localhost hello.localhost
|
6
|
-
|
7
|
-
rack 'benchmark.localhost', :self_signed do
|
8
|
-
root File.expand_path("examples/benchmark/", __dir__)
|
9
|
-
end
|
10
|
-
|
11
|
-
rack 'beer.localhost', :self_signed do
|
12
|
-
root File.expand_path("examples/beer/", __dir__)
|
13
|
-
end
|
14
|
-
|
15
|
-
rack 'hello.localhost', :self_signed do
|
16
|
-
root File.expand_path("examples/hello/", __dir__)
|
17
|
-
end
|
18
|
-
|
19
|
-
proxy 'codeotaku.localhost', :self_signed do
|
20
|
-
url 'https://www.codeotaku.com'
|
21
|
-
end
|
data/tasks/benchmark.rake
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
namespace :benchmark do
|
4
|
-
task :hello do
|
5
|
-
@config_path = File.expand_path("../examples/hello/config.ru", __dir__)
|
6
|
-
@request_path = "/"
|
7
|
-
end
|
8
|
-
|
9
|
-
task :small do
|
10
|
-
@config_path = File.expand_path("../examples/benchmark/config.ru", __dir__)
|
11
|
-
@request_path = "/small"
|
12
|
-
end
|
13
|
-
|
14
|
-
task :big do
|
15
|
-
@config_path ||= File.expand_path("../examples/benchmark/config.ru", __dir__)
|
16
|
-
@request_path ||= "/big"
|
17
|
-
end
|
18
|
-
|
19
|
-
task :compare => :big do
|
20
|
-
require 'etc'
|
21
|
-
|
22
|
-
require 'async/reactor'
|
23
|
-
require 'async/process'
|
24
|
-
require 'async/clock'
|
25
|
-
require 'async/io/stream'
|
26
|
-
require 'async/http/endpoint'
|
27
|
-
|
28
|
-
host = "http://127.0.0.1:9292"
|
29
|
-
|
30
|
-
threads = Etc.nprocessors
|
31
|
-
|
32
|
-
perf = ["perf", "record", "-F", "max", "-a", "--"]
|
33
|
-
|
34
|
-
servers = [
|
35
|
-
# ["puma", "--bind", host.gsub("http", "tcp")],
|
36
|
-
["puma", "--workers", threads.to_s, "--bind", host.gsub("http", "tcp")],
|
37
|
-
# ["rbspy", "record", "--", "falcon", "serve", "--threaded", "--bind", host, "--config"]
|
38
|
-
["falcon", "serve", "--bind", host, "--config"],
|
39
|
-
# ["falcon", "serve", "--reuse-port", "--bind", host, "--config"],
|
40
|
-
]
|
41
|
-
|
42
|
-
Async.logger.info!
|
43
|
-
|
44
|
-
endpoint = Async::HTTP::Endpoint.parse(host)
|
45
|
-
|
46
|
-
servers.each do |command|
|
47
|
-
::Async::Reactor.run do |task|
|
48
|
-
begin
|
49
|
-
server_status = nil
|
50
|
-
|
51
|
-
# This computes the startup time:
|
52
|
-
start_time = Async::Clock.now
|
53
|
-
|
54
|
-
server_task = task.async do
|
55
|
-
$stderr.puts "Starting #{command.first}"
|
56
|
-
server_status = Async::Process.spawn(*command, @config_path)
|
57
|
-
end
|
58
|
-
|
59
|
-
begin
|
60
|
-
unless server_status.nil?
|
61
|
-
raise RuntimeError, "Server failed to start: #{server_status}"
|
62
|
-
end
|
63
|
-
|
64
|
-
socket = endpoint.connect
|
65
|
-
|
66
|
-
request = Protocol::HTTP::Request.new("http", "localhost", "GET", @request_path)
|
67
|
-
stream = Async::IO::Stream.new(socket)
|
68
|
-
protocol = Async::HTTP::Protocol::HTTP1.client(stream)
|
69
|
-
|
70
|
-
response = protocol.call(request)
|
71
|
-
|
72
|
-
Async.logger.info(response, "Headers:", response.headers.to_h) {"Response body size: #{response.read.bytesize}"}
|
73
|
-
|
74
|
-
response.close
|
75
|
-
|
76
|
-
socket.close
|
77
|
-
rescue Errno::ECONNREFUSED, Errno::ECONNRESET
|
78
|
-
task.sleep 0.01
|
79
|
-
|
80
|
-
retry
|
81
|
-
end
|
82
|
-
|
83
|
-
end_time = Async::Clock.now
|
84
|
-
|
85
|
-
Async.logger.info(command) {"** Took #{end_time - start_time}s to first response."}
|
86
|
-
|
87
|
-
threads.times do |n|
|
88
|
-
c = (2**n).to_s
|
89
|
-
puts "Running #{command.first} with #{c} concurrent connections..."
|
90
|
-
|
91
|
-
# Async::Process.spawn("curl", "-v", "#{host}/small")
|
92
|
-
|
93
|
-
# Async::Process.spawn("ab", "-n", "2000", "#{host}/small")
|
94
|
-
|
95
|
-
Async::Process.spawn("wrk", "-c", c.to_s, "-t", (n+1).to_s, "-d", "2", "#{host}#{@request_path}")
|
96
|
-
end
|
97
|
-
ensure
|
98
|
-
server_task.stop
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|