Performance simulation
Characteristics like response latency can be simulated.
Injecting delays
Delays can be injected via configuration or using a script driven approach. Delays are specified in milliseconds.
The delay controls the time added after any request processing has completed (scripts, plugins etc.). So, if a normal un-delayed request takes 0.05 seconds and a delay of 100ms is added, then the response will be transmitted to the client after 105ms.
Delays can be specified as an exact value, or a range. If a range is specified, then a random value (roughly uniformly distributed) will be selected between the minimum and maximum range values.
Note Delays can also be combined with failure simulation effects. For example to simulate a delay followed by a closed connection.
Configuration driven
Specify the delay
section in configuration:
For the root resource:
For a specific resource (e.g. OpenAPI or REST plugin):
# ...
resources:
- method: GET
path: /example
response:
statusCode: 200
file: "response.json"
# delay in range of 500ms-1500ms
delay:
min: 500
max: 1500
Script driven
If using Scripting, use the withDelay(exactDelay)
and withDelayRange(minDelay, maxDelay)
methods.
For an exact delay:
For a delay within a range:
Logs
You will see log entries similar to the following: