This script deploys the Spring Pet Clinic sample application to an AWS EC2 instance that has been configured to run Pet Clinic and MySQL in Docker containers. It uses Apache JMeter to send traffic to the application, which has a memory leak; the traffic will cause the application to use increasingly more memory, resulting in slower transaction response times.
After the initial JMeter script completes (in approximately 30 minutes), the script deploys a second version of the application that omits the buggy component. It then re-reruns the JMeter script to demonstrate that the application's performance problem has been corrected.
-
Ensure that you have the necessary Java runtime installed. JMeter 3.x requires Java 7 or higher.
-
Download and install Apache JMeter.
-
Download and install the JMeter Standard Plugins. The JMeter scripts use the Stepping Thread Group plugin.
-
Enable the Custom Thread Groups plugin:
a. Select Plugins Manager from JMeter's Options menu.
b. Tick the box next to Custom Thread Groups. Click the button labeled Apply Changes and Restart JMeter.
Before running the script, modify the following parameters:
HOST_NAME
: Public DNS of your Amazon EC2 instancePORT
: Port number on which your application is running (defaults to 80)AWS_KEY_FILE
: Name and location of the public key file (.pem) for your EC2 instanceNR_API_KEY
: New Relic API key of desired accountNR_APP_ID
: New Relic application ID. Used to set deployment markersNR_DEPLOY_USER
: User name of deployer to appear in New Relic deployment markers
- Clone this repository to your computer.
- To run the script, open a Terminal window and execute
$ ./generate-apm-data.sh
. - There is currently no API to start the thread profiler. Log into the target application in your New Relic account and start the thread profiler manually approximately 10 minutes after starting the script.
- The script assumes that JMeter is available on your $PATH. If it is not, you must edit line 72 of
generate-apm-data.sh
to include the full path to the JMeter executable. - If you receive an error that you have an unprotected private key file, execute
chmod 600 nru.pem
to make the key file accessible only to its owner (you). - Trainees may reset the REST API key on the training account. If you receive a
401 Unauthorized
error while setting deployment markers, ensure that the value ofNR_API_KEY
matches the account's REST API key. - The JMeter scripts require significant upstream bandwidth in order to generate sufficient traffic to stress the application. Don't count on being able to run it from a hotel room!