Class RFuzz::Session
In: lib/rfuzz/session.rb
Parent: Object

Creates a small light DSL for running RFuzz sessions against a web server. It configures a basic client and randomizer that you then use to conduct sessions and record statistics about the activity.



client  [R] 
counts  [RW] 
rand  [R] 
runs  [RW] 
tracking  [RW] 

Public Class methods

Sets up a session that you then operate by calling Session#run. Most of the functions do not work unless they are inside a Session#run call.

Available options are:

  • :host => Required. Which host.
  • :port => Required. Which port.
  • :words => Dictionary to load for the words passed to RandomGenerator.

You can then pass any options you need to pass to the created RFuzz::HttpClient.

Public Instance methods

Called inside a run to do a count of a measurement.

Used inside Session#run to wrap an attempted request or potentially failing action and then count the exceptions thrown.

Takes the counts for all the runs and produces an array suitable for CSV output. Use Session#counts to access the counts directly.

Begin a run of count length wher a block is run once and statistics are collected from the client passed to the block. When calls you can pass in the following options:

  • :sample => Defaults to [:request], but will record any of [:request, :connect, :send_request, :read_header, :read_body, :close]
  • :save_as => A tuple of ["runs.csv", "counts.csv"] (or whatever you want to call them).

Once you call run, the block you pass it is given an HttpClient and a RandomGenerator. Each run will reset the HttpClient so you can pretend it is brand new.

Takes the samples for all runs and returns an array suitable for passing to CSV or some other table output. If you want to access the runs directly then just use the Session#runs attribute.

Called inside a run to collect a stat you want with the given count. The stat should be a string or symbol, and count should be a number (or float).

Lets you track some value you need to report on later. Doesn‘t do any calculations and is matched for each run. You then access Session#tracking which is an Array of runs, each run being a Hash. Inside the hash is the tracking you registerd by {name => [val1, val2]}.

Writes the counts to the given file as a CSV.

Writes the runs to the given file as a CSV.