Class: Drnbench::RequestResponse::Configuration
- Inherits:
-
Object
- Object
- Drnbench::RequestResponse::Configuration
- Defined in:
- lib/drnbench/request-response/configuration.rb
Constant Summary collapse
- MIN_DURATION =
1
- MIN_WAIT =
0
Instance Attribute Summary collapse
-
#default_hosts ⇒ Object
Returns the value of attribute default_hosts.
-
#default_method ⇒ Object
Returns the value of attribute default_method.
-
#default_path ⇒ Object
Returns the value of attribute default_path.
-
#default_port ⇒ Object
Returns the value of attribute default_port.
-
#default_timeout ⇒ Object
Returns the value of attribute default_timeout.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#end_n_clients ⇒ Object
Returns the value of attribute end_n_clients.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#n_fast_requests ⇒ Object
Returns the value of attribute n_fast_requests.
-
#n_requests ⇒ Object
Returns the value of attribute n_requests.
-
#n_slow_requests ⇒ Object
Returns the value of attribute n_slow_requests.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#report_progressively ⇒ Object
Returns the value of attribute report_progressively.
-
#request_patterns_file ⇒ Object
Returns the value of attribute request_patterns_file.
-
#start_n_clients ⇒ Object
Returns the value of attribute start_n_clients.
-
#step ⇒ Object
Returns the value of attribute step.
-
#wait ⇒ Object
Returns the value of attribute wait.
Instance Method Summary collapse
- #default_host ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #request_patterns ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/drnbench/request-response/configuration.rb', line 32 def initialize @duration = 30 @wait = 0.01 @interval = 10 @start_n_clients = 0 @end_n_clients = 1 @step = 1 @n_requests = 1000 @mode = :http @n_slow_requests = 5 @n_fast_requests = 5 @default_hosts = ["localhost"] @default_port = 80 @default_path = "/" @default_method = "GET" @default_timeout = 5.0 @report_progressively = true @output_path = "/tmp/drnbench-result.csv" @last_default_host_index = 0 end |
Instance Attribute Details
#default_hosts ⇒ Object
Returns the value of attribute default_hosts.
25 26 27 |
# File 'lib/drnbench/request-response/configuration.rb', line 25 def default_hosts @default_hosts end |
#default_method ⇒ Object
Returns the value of attribute default_method.
26 27 28 |
# File 'lib/drnbench/request-response/configuration.rb', line 26 def default_method @default_method end |
#default_path ⇒ Object
Returns the value of attribute default_path.
26 27 28 |
# File 'lib/drnbench/request-response/configuration.rb', line 26 def default_path @default_path end |
#default_port ⇒ Object
Returns the value of attribute default_port.
26 27 28 |
# File 'lib/drnbench/request-response/configuration.rb', line 26 def default_port @default_port end |
#default_timeout ⇒ Object
Returns the value of attribute default_timeout.
26 27 28 |
# File 'lib/drnbench/request-response/configuration.rb', line 26 def default_timeout @default_timeout end |
#duration ⇒ Object
Returns the value of attribute duration.
21 22 23 |
# File 'lib/drnbench/request-response/configuration.rb', line 21 def duration @duration end |
#end_n_clients ⇒ Object
Returns the value of attribute end_n_clients.
22 23 24 |
# File 'lib/drnbench/request-response/configuration.rb', line 22 def end_n_clients @end_n_clients end |
#interval ⇒ Object
Returns the value of attribute interval.
21 22 23 |
# File 'lib/drnbench/request-response/configuration.rb', line 21 def interval @interval end |
#mode ⇒ Object
Returns the value of attribute mode.
24 25 26 |
# File 'lib/drnbench/request-response/configuration.rb', line 24 def mode @mode end |
#n_fast_requests ⇒ Object
Returns the value of attribute n_fast_requests.
23 24 25 |
# File 'lib/drnbench/request-response/configuration.rb', line 23 def n_fast_requests @n_fast_requests end |
#n_requests ⇒ Object
Returns the value of attribute n_requests.
22 23 24 |
# File 'lib/drnbench/request-response/configuration.rb', line 22 def n_requests @n_requests end |
#n_slow_requests ⇒ Object
Returns the value of attribute n_slow_requests.
23 24 25 |
# File 'lib/drnbench/request-response/configuration.rb', line 23 def n_slow_requests @n_slow_requests end |
#output_path ⇒ Object
Returns the value of attribute output_path.
27 28 29 |
# File 'lib/drnbench/request-response/configuration.rb', line 27 def output_path @output_path end |
#report_progressively ⇒ Object
Returns the value of attribute report_progressively.
27 28 29 |
# File 'lib/drnbench/request-response/configuration.rb', line 27 def report_progressively @report_progressively end |
#request_patterns_file ⇒ Object
Returns the value of attribute request_patterns_file.
21 22 23 |
# File 'lib/drnbench/request-response/configuration.rb', line 21 def request_patterns_file @request_patterns_file end |
#start_n_clients ⇒ Object
Returns the value of attribute start_n_clients.
22 23 24 |
# File 'lib/drnbench/request-response/configuration.rb', line 22 def start_n_clients @start_n_clients end |
#step ⇒ Object
Returns the value of attribute step.
22 23 24 |
# File 'lib/drnbench/request-response/configuration.rb', line 22 def step @step end |
#wait ⇒ Object
Returns the value of attribute wait.
21 22 23 |
# File 'lib/drnbench/request-response/configuration.rb', line 21 def wait @wait end |
Instance Method Details
#default_host ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/drnbench/request-response/configuration.rb', line 86 def default_host host = @default_hosts[@last_default_host_index] @last_default_host_index += 1 if @last_default_host_index == @default_hosts.size @last_default_host_index = 0 end host end |
#request_patterns ⇒ Object
77 78 79 |
# File 'lib/drnbench/request-response/configuration.rb', line 77 def request_patterns @request_patterns ||= prepare_request_patterns end |
#validate ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/drnbench/request-response/configuration.rb', line 56 def validate if @duration.nil? raise ArgumentError.new("You must specify the test duration.") end if @request_patterns_file.nil? raise ArgumentError.new("You must specify the path to the request patterns JSON file.") end end |