After you have using the proxy recorder to generate all of the appropriate files like the gatling recording scala file (don't forget to change the request
values within the .exec calls as mentioned before), and the request_body txt file, and placed the catalog-zero modules and included it in your default node def on your site.pp, there are several modifications required for the feeder functionality.
The first thing you should do is use the generate-node-feeder.sh
bash script to generate all of the fake hostnames that will be used in the gatling simulation. It should walk you through what you need to enter in and where to put the resulting csv file.
Note: If you'd like to follow along, just check out this commit here https://github.com/briancain/gatling-puppet-load-test/commit/eddaf1dfe41e41a9b8a31aea1d999ca5824fc599
Next, you must add a line in your gatling simulation to reference the new generated csv file, as seen below. (Make sure the csv file you generated exists within simulation-runner/user-files/data
!)
val nodeNames = csv("nodes.X.csv").circular
Where "nodes.X.csv" should be replaced with the csv file you are planning to use, and X is the number of nodes you picked to simulate.
Next, we need to make a modification right below the first exec call for node. This will be adding the feeder functionality, so that it can read in the csv file. It will look like this:
val chain_0 =
feed(nodeNames)
.exec(http("node")
...
Following this, we must replace every instance of puppet-master (or your given hostname used when generating scenario) with ${node}
. This will interpolate all of the different node hostnames into those routes, thus simulating the different nodes. You will also encounter a large URL encoded string with instances of your old hostname. Those will also need to be replaced.
You will also have to do this same process in the request-bodies txt file generated by the proxy-recoirder.
HINT: If you're familiar with vims search and replace, you can use this regex to automate the process. I used puppet-master because that was the host of my puppet master. The c on the end will ask if you're sure you want to replace each instance, just to be safe. You may or may not need to escape the $, {, and }, but I did. It just depends on how you have modified your vimrc.
:%s/puppet-master/\$\{node\}/gc
Finally at the bottom, we need our request-bodies txt file to also use the interpolated node name. Make the modification to .fileBody to look like this:
.body(scala.io.Source.fromFile("./user-files/request-bodies/MyRequestScenario_request_110.txt").mkString)
Following all of this, you should be able to run the modified gatling scenario with a feeder.
I've been running the scenario within the simulation-runner
dir with these arguments
JAVA_OPTS="-Xss2M" PUPPET_GATLING_SIMULATION_CONFIG=./config/scenarios/cat-scenario.json PUPPET_GATLING_SIMULATION_ID=MyCustomSimulation PUPPET_GATLING_MASTER_BASE_URL=https://puppet-master:8140 sbt run