Overview
Loadmonger uses a JSON configuration file. This page talks about the various parts of the configuration file in a top down fashion.
Top Level Object
The top level object contains the following attributes:
- callStrategy - One of the following
- ROUND_ROBIN - Call definitions are executed in order by the clients, when one call definition completes, the next one in the list of call definitions is executed.
- RANDOM - Call definitions are selected in random fashion from the pool of available call definitions. All calls have an equal probability of being selected.
- WEIGHTED_RANDOM - Call definitions are selected in random fashion from the pool of available call definitions. The frequency with which a call is selected is governed by the weight assigned to the call definition. Higher weights have a higher relative frequency of selection.
- clients - The number of clients (e.g. Client Worker Threads) that will be created for the test.
- duration - How long the test will last.
- logMode - One of the following
- DISBURSED - The metric harvester thread will log metrics from each client in a separate file.
- CONDENSED - The metric harvester thread will log metrics from each client into a single file.
- Note: The client thread standard error and standard output files are never condensed only the metrics output.
- substitutionValueStrategies - An array of Substitution Value Strategy Definition objects
- inputDataStrategies - An array of Input Data Strategy Definition objects
- responseGroups - An array of Response Group definition objects.
- headerSets - An array of Header Set definition objects.
- calls - An array of call definition objects.
Substitution Value Strategy Objects
A Substitution Value Strategy (a.k.a Value Provider Strategy) object defines a strategy for providing substitution values for value substitution templates of the form '@{someProviderId}'. They contain the following attributes:
- id - A unique identifier for the object that can be referenced in other parts of the test definition. This value is the value that goes in the @ substitution template (e.g. 'someProviderId' as exampled above).
- strategy - The java class name employed by the Value Provider Strategy. Note: you can develop your own Value Provider Strategy and incorporate them into your testing simply by adding your implementations to the classpath.
- strategyArgs - A JSON array containing valid JSON which is understood by the Substitution Value Strategy implementation. This JSON is passed to the implementation during the init phase of the strategy.
An Input Data Strategy Object contains the following attributes:
* id - A unique identifier for the object that can be referenced in other parts of the test definition.
* strategy - The java class name employed by the Input Data Strategy. Note: you can develop your own Input Data Strategy objects and incorporate them into your testing simply by adding your implementations to the classpath.
* strategyArgs - A JSON array containing valid JSON which is understood by the Input Data Strategy implementation. This JSON is passed to the implementation during the init phase of the strategy.
LoadMonger comes with the following stock Input Data Strategy implementations
Generates random JSON for upload in a request. The arguments to this strategy consist of a single object with the following attributes:
- contentType - The mime content type. By default this is "application/json", but can be overriden with this attribute.
- encoding - The character set to use. For example "UTF-8"
- isChunked - either true or false. If true then chunked encoding will be used in the upload.
- chunkSize - if isChunked is true then this is the size of chunks to be sent (currently it does not matter what value is used here as long as it is greater than 0)
- jsonSize - the minimum size of the JSON content to be generated in characters. The generator will stop generating random content as close as can be reasonably obtained to this size. But should always generate content at least this size.
Provides the contents of a specific file for upload in a request. The arguments to this strategy consist of a single object with the following attributes:
- contentType - The mime content type for example "application/x-www-form-urlencoded"
- encoding - The character set to use. For example "UTF-8"
- isChunked - either true or false. If true then chunked encoding will be used in the upload.
- chunkSize - if isChunked is true then this is the size of chunks to be sent (currently it does not matter what value is used here as long as it is greater than 0)
- path - the path on the local file system where the content to be sent resides.
Randomly selects from a pool of files one file to be used for upload in the request. The arguments to this strategy consist of a list of objects with the following attributes:
- contentType - The mime content type for example "application/x-www-form-urlencoded"
- encoding - The character set to use. For example "UTF-8"
- isChunked - either true or false. If true then chunked encoding will be used in the upload.
- chunkSize - if isChunked is true then this is the size of chunks to be sent (currently it does not matter what value is used here as long as it is greater than 0)
- path - the path on the local file system where the content to be sent resides.
A Header Set Definition object contains the following attributes:
- id - A unique identifier for the object that can be referenced in other parts of the test definition.
- headers - An array containing individual Header Definition Objects.
A Header Definition Object contains the following attributes:
- name - the header name (e.g. Cache-Control or Content-Type)
- value - the header value (as seen in raw HTTP). Note, values may contain value templates such as ${token} which are substituted for the actual values passed in on the command line.
Call Definition Objects
A Call Definition Object contains the following attributes:
- name - A name that will be output in logs for the call made. Only used when using the "LOGRESULT" value in the onFail or onSuccess attribute.
- url - The URL with value templates that is to be called. For example: "http://${hostName}/myservice/users" The ${hostname} will get the actual value of the hostname command line argument. See command line arguments.
- headersRef - the id of some Header Set Definition Object defined within the test definition.
- connectTimeout - timeout that is used for the Http Connect timeout. It is expressed as a string consisting of an integer value and a unit. For example ("5 seconds", "300 miliseconds") etc.
- readTimeout - timeout that is used for the Http Read timeout. It is expressed as a string consisting of an integer value and a unit. For example ("5 seconds", "300 miliseconds") etc.
- paceRequests - the amount of time that the client should wait after completing this call before executing the next call. It is expressed as a string consisting of an integer value and a unit. For example ("5 seconds", "300 miliseconds") etc.
- failOn - An array of CallResult enumeration values which will cause the call to execute the onFail action. If the result of the HTTP call is not in the failOn list then the onSuccess action will be executed on completion of the call.
- onFail - The action to take when the result of the HTTP call matches one of the failOn codes. It will be one of the following:
- METER - The metrics will be recorded but the Client Worker thread's standard error file will not be written to.
- LOGRESULT - The metrics will be recorded and in addition a brief summary of the call executed will be written to the Client Worker thread's standard error file.
- DUMP - The metrics will be recorded and in addition a detailed entry containing all relevant details of the call executed will be written to the Client Worker thread's standard error file.
- onSuccess - The action to take when the result of the HTTP call does not match one of the failOn codes. It will be one of the following:
- METER - The metrics will be recorded but the Client Worker thread's standard out file will not be written to.
- LOGRESULT - The metrics will be recorded and in addition a brief summary of the call executed will be written to the Client Worker thread's standard out file.
- DUMP - The metrics will be recorded and in addition a detailed entry containing all relevant details of the call executed will be written to the Client Worker thread's standard out file.
- selectionWeight - a weighting value. The higher the number the higher the likelihood that the call definition will be selected when WEIGHTED_RANDOM selection is used.
- requestMethod - one of the standard HTTP method types { "GET", "PUT" "POST", "DELETE", "HEAD" or "OPTIONS" }
- inputDataStrategyRef - for HTTP methods that support input data { "PUT" and "POST" } this will be the id of some Input Data Strategy Definition object within the test definition.