In this tutorial, we will show you how to use Neocortix Cloud Services Scalable Compute to run a distributed LoadTest batch job, using a Locust client, in a framework where you can easily substitute your own LoadTest client.
First, please follow the steps in the tutorial
Setting Up For Batch Jobs.
After completion of the initial setup, you will have a directory with examples,
~/ncsexamples
.
In the subdirectory
~/ncsexamples/batchMode
you will find the
runBatchLoadtest.py command.
This script creates a set of instances running on mobile devices, one instance for each load generator.
In the default example provided, we ask for 5 successful instances:
startFrame = 1,
endFrame = 5,
nWorkers = 6,
By setting
nWorkers = 6
, we slightly over-allocate instances to allow for some fraction to fail.
It will command the instances
to install Locust, and then run the Locust command (
runLocustWorker.py
) to send http requests to the target URL
(currently
https://loadtest-target.neocortix.com
).
def frameCmd( self, frameNum ):
usersPerWorker = 6 # number of simulated users per worker instance
rampUpRate = .133 # number of simulated users to spawn per second (can be fractional)
duration = 90 # number of seconds to run the test (must be integer)
csvSpec = '--csv ~/worker_%03d' % frameNum
cmd = 'cd locustWorker && python3 -u ./runLocustWorker.py --host=https://loadtest-target.neocortix.com %s --only-summary --exit-code-on-error 0 --no-web -c %d -r %f --run-time %d' % (
csvSpec, usersPerWorker, rampUpRate, duration
)
return cmd
The output of each instance will be a .csv file
worker_<n>_requests.csv
containing request response timing information for each worker. The master will create several
image files
WorldMap.png
,
DeliveredLoad.png
,
ResponseTimesByRegion.png
,
and then terminate the instances.