Architecture#

Overview#

stressor is a tool, that runs a sequence of activities in one or more parallel sessions.
The most common use case is to run a test script with HTTP commands against a web server, simulating a bunch of parallel user sessions.
As a result we get metrics about reponse times, failures, resource usage, etc.

Concepts#

The stressor.run_manager.RunManager

  • Run manager

  • Session manager

  • Config manager

Class Overview#

Activities & Macros#

digraph inheritancecb7f0eef3c { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "abc.ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "base.ActivityAssertionError" [URL="rg_mod_stressor.html#stressor.plugins.base.ActivityAssertionError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Assertion failed (e.g. `assert_match` argument, ...)."]; "base.ActivityError" -> "base.ActivityAssertionError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.ActivityBase" [URL="rg_mod_stressor.html#stressor.plugins.base.ActivityBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Common base class for all activities."]; "abc.ABC" -> "base.ActivityBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.ActivityCompileError" [URL="rg_mod_stressor.html#stressor.plugins.base.ActivityCompileError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when activity constructor fails."]; "base.ActivityError" -> "base.ActivityCompileError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.ActivityError" [URL="rg_mod_stressor.html#stressor.plugins.base.ActivityError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base for all errors that are explicitly raised by activities."]; "util.StressorError" -> "base.ActivityError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.ActivityTimeoutError" [URL="rg_mod_stressor.html#stressor.plugins.base.ActivityTimeoutError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Activity timed out."]; "base.ActivityError" -> "base.ActivityTimeoutError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.MacroBase" [URL="rg_mod_stressor.html#stressor.plugins.base.MacroBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Common base class for all load-time script macros of the form ``$NAME(ARGS)``."]; "abc.ABC" -> "base.MacroBase" [arrowsize=0.5,style="setlinewidth(0.5)"]; "base.ScriptActivityError" [URL="rg_mod_stressor.html#stressor.plugins.base.ScriptActivityError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when a ScriptActivity fails."]; "base.ActivityError" -> "base.ScriptActivityError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "common.DebugMacro" [URL="rg_mod_stressor.html#stressor.plugins.common.DebugMacro",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implement `$debug()` macro, which dumps information at run-time."]; "base.MacroBase" -> "common.DebugMacro" [arrowsize=0.5,style="setlinewidth(0.5)"]; "common.EnvMacro" [URL="rg_mod_stressor.html#stressor.plugins.common.EnvMacro",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implement `$env(var_name)` macro, which resolves an environment variable at load-time."]; "base.MacroBase" -> "common.EnvMacro" [arrowsize=0.5,style="setlinewidth(0.5)"]; "common.LoadMacro" [URL="rg_mod_stressor.html#stressor.plugins.common.LoadMacro",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implement `$load(path)` macro."]; "base.MacroBase" -> "common.LoadMacro" [arrowsize=0.5,style="setlinewidth(0.5)"]; "common.SleepActivity" [URL="rg_mod_stressor.html#stressor.plugins.common.SleepActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Args:"]; "base.ActivityBase" -> "common.SleepActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "common.SleepMacro" [URL="rg_mod_stressor.html#stressor.plugins.common.SleepMacro",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implement `$sleep(duration)` macro, which is a shortcut to :class`SleepActivity`."]; "base.MacroBase" -> "common.SleepMacro" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.DeleteRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.DeleteRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "http_activities.HTTPRequestActivity" -> "http_activities.DeleteRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.GetRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.GetRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "http_activities.HTTPRequestActivity" -> "http_activities.GetRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.HTTPRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.HTTPRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "base.ActivityBase" -> "http_activities.HTTPRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.PollRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.PollRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="TODO: This activity simulates a peridodical request to a single URL."]; "http_activities.HTTPRequestActivity" -> "http_activities.PollRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.PostRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.PostRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "http_activities.HTTPRequestActivity" -> "http_activities.PostRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.PutRequestActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.PutRequestActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "http_activities.HTTPRequestActivity" -> "http_activities.PutRequestActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "http_activities.StaticRequestsActivity" [URL="rg_mod_stressor.html#stressor.plugins.http_activities.StaticRequestsActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This activity recieves a list of URLs (JavaScript, Html, CSS, Images, ...)"]; "base.ActivityBase" -> "http_activities.StaticRequestsActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "script_activities.RunScriptActivity" [URL="rg_mod_stressor.html#stressor.plugins.script_activities.RunScriptActivity",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "base.ActivityBase" -> "script_activities.RunScriptActivity" [arrowsize=0.5,style="setlinewidth(0.5)"]; "util.StressorError" [URL="rg_mod_stressor.html#stressor.util.StressorError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all exception that we deliberatly throw."]; }

Standard Stressor Activities and Macros#

Session Runner#

digraph inheritancef078d38da2 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "config_manager.ConfigManager" [URL="rg_mod_stressor.html#stressor.config_manager.ConfigManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Define and validate a run-configuration."]; "config_manager.ConfigurationError" [URL="rg_mod_stressor.html#stressor.config_manager.ConfigurationError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "util.StressorError" -> "config_manager.ConfigurationError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "context_stack.ContextStack" [URL="rg_mod_stressor.html#stressor.context_stack.ContextStack",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The context manager"]; "context_stack.RunContext" [URL="rg_mod_stressor.html#stressor.context_stack.RunContext",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Basically a dict, holding context variables as key/value pairs."]; "run_manager.RunManager" [URL="rg_mod_stressor.html#stressor.run_manager.RunManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Executes a run-configuration in parallel sessions."]; "session_manager.SessionHelper" [URL="rg_mod_stressor.html#stressor.session_manager.SessionHelper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Passed to script activities."]; "session_manager.SessionManager" [URL="rg_mod_stressor.html#stressor.session_manager.SessionManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Run a scenario in a single session."]; "session_manager.SkippedError" [URL="rg_mod_stressor.html#stressor.session_manager.SkippedError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when an activity is skipped due to `max_errors` or `max_time`."]; "util.StressorError" -> "session_manager.SkippedError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "session_manager.StoppedError" [URL="rg_mod_stressor.html#stressor.session_manager.StoppedError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when an activity stops due because the `stop_request` is set."]; "util.StressorError" -> "session_manager.StoppedError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "session_manager.User" [URL="rg_mod_stressor.html#stressor.session_manager.User",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "statistic_manager.StatisticManager" [URL="rg_mod_stressor.html#stressor.statistic_manager.StatisticManager",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Example::"]; "util.StressorError" [URL="rg_mod_stressor.html#stressor.util.StressorError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class for all exception that we deliberatly throw."]; }

Session Runner#