Load Test Output
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.

Example Command

Simply run
python3 ./runBatchLoadtest.py
When the program is done, the output files
worker_<n>_requests.csv
,
WorldMap.png
,
DeliveredLoad.png
,
ResponseTimesByRegion.png
, will be put in a directory
./data/loadtest_<datestamp>

Running a Longer Ramped Load Test

Below is the output of a longer 500 second Load Test with 30 devices, using the following settings in
runBatchLoadtest.py
: set
rampUpRate = 0.0125, duration = 500, timeLimit = 20*60, frameTimeLimit = 740, endFrame = 30, nWorkers = 54
, and re-run
python3 ./runBatchLoadtest.py
Here are example outputs:
Load Test Output
Load Test Output
Load Test Output

Substituting Your Own LoadTest Client

With this simple framework, you can easily substitute your own LoadTest client to process the frames of the Batch job. Just edit the
runBatchLoadtest.py
file to change the
workerScriptPath
to call your LoadTest client. You may need to install different dependencies in the
installerCmd
line.
Pro Tip: When you are experimenting with getting your code running on a Neocortix Scalable Compute instance, it may be easiest to spin up a single instance and get it installed and running there, before running it at scale as a part of a Batch job.