0% found this document useful (0 votes)
144 views34 pages

JMeter Training Lab - Intructor Guide

The document provides an instructor guide for a JMeter training lab. It outlines objectives and exercises for getting familiar with the reference application, installing JMeter, designing load test scenarios, implementing scenarios in JMeter, and executing and analyzing tests. Sections cover the basics of the application, installing JMeter, designing tests including use cases and KPIs to measure, implementing test plans in JMeter, and executing and analyzing test results.

Uploaded by

Fehmi Denguir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views34 pages

JMeter Training Lab - Intructor Guide

The document provides an instructor guide for a JMeter training lab. It outlines objectives and exercises for getting familiar with the reference application, installing JMeter, designing load test scenarios, implementing scenarios in JMeter, and executing and analyzing tests. Sections cover the basics of the application, installing JMeter, designing tests including use cases and KPIs to measure, implementing test plans in JMeter, and executing and analyzing test results.

Uploaded by

Fehmi Denguir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

JMeter Training Lab

Instructor Guide

Document Author Sword Performance Solution


Document Owner Sword Performance Solution
Document Version 0.1
Revision Period June 2016

adhoc InternationalSword Performance Solutions AG


Schützengraben 7 Schützengraben 7
CH - 4051 Basel CH - 4051 Basel

T: +41 (0) 61 723 01T:88+41 (0) 61 723 01 88


[email protected]
E: [email protected]
www.adhoc-international.com
www.sword-performance.com
Training Catalog

Table of Content

1 INTRODUCTION & BASICS .......................................................................................... 3


1.1 Objectives ............................................................................................................... 3
1.2 Exercises ................................................................................................................ 3
1.2.1 Task1: Getting initiated to the Reference Application ....................................... 3
2 JMETER INSTALLATION .............................................................................................. 4
2.1 Objective ................................................................................................................. 4
2.2 Exercises ................................................................................................................ 4
3 LOAD SCENARIO DESIGN ........................................................................................... 5
3.1 Objectives ............................................................................................................... 5
3.2 Exercise .................................................................................................................. 5
3.2.1 Preparation ...................................................................................................... 5
3.2.2 L&P Test Design .............................................................................................. 5
4 IMPLEMENTATION ..................................................................................................... 15
4.1 Objectives ............................................................................................................. 15
4.2 Exercises .............................................................................................................. 15
4.2.1 Prerequisite ................................................................................................... 15
4.2.2 Task 1: L&P Test Implementation .................................................................. 15
5 TEST SCENARIO EXECUTION & ANALYSIS ............................................................. 24
5.1 Objectives ............................................................................................................. 24
5.2 Exercises .............................................................................................................. 24
5.2.1 Prerequisites .................................................................................................. 24
5.2.2 Task 1: Environment check and validation ..................................................... 24
5.2.3 Task 2: Execute & Analyse “Search Applicants” Average Scenario ............... 26
5.2.4 Task 3: Execute & analyse a mixed scenario “Manage Applicants” .......... 30

Sword Performance Solution | JMeter Training Lab Page 2 / 34


Training Catalog

1 INTRODUCTION & BASICS


1.1 Objectives
The goal of this lab is to have hands on load testing and monitoring a reference Web
application. Along the way, you should answer some questions about the key principles of
performance engineering activities, J2EE architecture elements, as well as Load Testing and
monitoring activities.
Once you are done with this Lab, you should feel much comfortable and confident
conducting Performance Load Tests, as well as analyzing test results.
1.2 Exercises

1.2.1 Task1: Getting initiated to the Reference Application


In this part, you will discover the content of the virtual machine and take a look at the “Job
applicant" reference application.
Step 1: Connect to the reference application 172.17.8.147 using SSH

Step 2: Start Jboss application server using this command line:


nohup /home/adcuser/adhoc-ref-app/jboss-ditribution/liferay-portal-6.1.1-ce-ga2/jboss-
7.1.1/bin/standalone.sh –b 0.0.0.0 &

Step 3: Access the reference application home page (http://172.17.8.147:8080/) and log
using the following parameters:
- Login: [email protected]
- Password: test

Step 4: Perform some operations (add applicant, search applicants, update applicant,
remove applicant) in order to be familiar with the application.

Sword Performance Solution | JMeter Training Lab Page 3 / 34


Training Catalog

2 JMETER INSTALLATION
2.1 Objective
Upon completion of this lab, you should be able to setup JMeter and to start it.
2.2 Exercises
Step 1: Download the latest version of JMeter from the following
http://jmeter.apache.org/download_jmeter.cgi

Step 2: What are the available modes to start JMeter


- GUI Mode
- Server Mode
- Command Line Mode

Step 2: Start JMeter using the GUI Mode


You need just to go to the Home directory and double click on jmeter.bat

Step 3: Start JMeter using the Server Mode


You need just to go to the Home directory and double click on jmeter-server.bat

Step 4: Navigate to JMeter configuration elements

Sword Performance Solution | JMeter Training Lab Page 4 / 34


Training Catalog

3 LOAD SCENARIO DESIGN


3.1 Objectives
Upon completion of this lab, you should be able to design performance test scenarios

3.2 Exercise
3.2.1 Preparation
This exercise assumes that you have already acquired the minimum information on the
target application architecture and functionalities as well as the customer requirements.

3.2.2 L&P Test Design


Step 1: Define the objectives and scope of the load and performance tests.
The main objectives of the L&P Tests Job applicant Reference Application are:
- Assess and evaluate the application’s response time under load;
- Identify potential bottlenecks at both application and configuration levels;
- Define tuning and optimization mechanisms to apply on the target application.
-
Step 2: Describe the application main functionalities and features, set out a system
architecture overview.
The application has two basic actors as mentioned in the above section:
- Job applicant: Uses the application in order to add a new job application.
- Manager: perform basic operations on the list of job applicants: search, update and
remove.

Job Applicant Use Cases Manager use Cases

Sword Performance Solution | JMeter Training Lab Page 5 / 34


Training Catalog

The figure below presents the different interactions between the portlet “Job Application”
components:

The figure below presents the different interactions between the portlet “Job Applications
Manager” components:

Step 3: Identify test environment:


- State performance test environment elements (servers, software, etc…) and define
their roles

Software Version Function Machine


JBoss 7.1.1 Application Server 172.17.8.147
MySQL 5.5 Database Server 172.17.8.147
JDK 1.6.0_27 Java Development Kit 172.17.8.147

Sword Performance Solution | JMeter Training Lab Page 6 / 34


Training Catalog

- Clearly illustrate test environment elements and placement of each involved tool
within a deployment diagram

- List measurable KPIs on each component: In order to analyze the application


performance, following KPIs should be measured:

KPI Description
CPU utilization (%) Percentage of non idle CPU time over a specified interval
JBoss instances (Java process) CPU
% JBoss instances process usage

JVM Memory Total (KB) Provides the JVM total available memory

JVM Memory used (KB) Provides the memory used

JVM Memory usage (%) Provides the memory usage percentage

JVM Memory free Provides the memory free

JVM Thread Total Count Provides the total thread count

Response time Method execution time

Transaction Response Time Transaction execution time

Checkpoint Response Time Checkpoint execution time

Success Rate The successful users / The total users

Transaction rate Total performed transactions

JBoss Concurrent Invocations Invocation number per method


JBoss Transactions committed per
Minute Counts the number of committed transactions

JBoss Transactions rolled back per


Minute Counts the number of transactions that have been rolled back

JBoss Active Thread Count Specifies the number of active threads

JBoss Executed Threads Specifies the number of executed threads

JBoss Requests in the Queue Specifies the number of requests in the queue

JBoss Queue size The current queue size

Sword Performance Solution | JMeter Training Lab Page 7 / 34


Training Catalog

KPI Description
JBoss Available JDBC Connections The number of unused or available connections

JBoss JDBC Connections Created The total number of the created connections

JBoss JDBC Connections Destroyed The number of connections having been destroyed

- Specify Measurement tools for each layer, and identify relevant logging entries: The
table below lists the measurement tools that will be used for this lab:

Tool Function
Used to execute the load and performance tests scenarios
Apache JMeter and to monitor the test session execution: Transaction rate,
end user response time, etc.

APM Solution Used to manage the application performance by collecting


web application metrics, analyze them, identify performance
(AppDynamics /CA APM) bottlenecks and isolate root causes.

These tools are used to perform a deep analysis and to find


HPJMeter, MAT
the root cause of the application performance problems

Step 4: Design test cases


-
Identify test areas and critical business use cases : Below is an example. By the
same way, provide the description of other test cases:
Test Case Name Description
TC1 Search Applicants Search for already added applicant(s)

TC2 Remove Applicants Remove one or more Applicants

TC3 Update Applicant Update an existing Applicant

- Define test cases with respect to customer requirements: write detailed test cases
workflow and Identify test data requirements

Below is the workflow that should be executed for the test case Search Applicants:

Test Case: TC01 - Search Applicant


Step Step Description Required Data Screenshots/Expected Result(s)
S_01: Home  Enter the Application URL - The following screen is displayed:
page application URL

Sword Performance Solution | JMeter Training Lab Page 8 / 34


Training Catalog

- The following screen is displayed:

S_02: sign in  Click on “Sign In”


page button

 Entre Email Valid email - The following screen is displayed:


address Valid password
S_03: login Enter Password
 Click on “Sign
In” button

- The following screen is displayed:

 Click on “Go to >


My Public Pages”
S_04: Public
pages menu

First Name - Updated form


 Enter a pattern Last Name
string in the search Email
S_05: search box
applicants
Click “Search…”
button

 Click “Sign Out” - The following screen is displayed:


S_06: logout
button

Sword Performance Solution | JMeter Training Lab Page 9 / 34


Training Catalog

Test Case: TC02 - Remove Applicant


Step Step Description Required Data Screenshots/Expected Result(s)
Application URL - The following screen is displayed:

S_01: Home  Enter the


page application URL

- The following screen is displayed:

S_02: sign in  Click on “Sign In”


page button

 Entre Email Valid email - The following screen is displayed:


address Valid password
S_03: login Enter Password
 Click on “Sign
In” button

 Click on “Go to > - The following screen is displayed:


My Public Pages”
S_04: Public
pages menu

Sword Performance Solution | JMeter Training Lab Page 10 / 34


Training Catalog

- The selected applicant (s) is


removed from the table
 Check one or
more applicant (s)
from the list
S_05: Remove
applicants Click “Delete
Selected
Applicants” button

- The following screen is displayed:

 Click “Sign Out”


S_06: logout
button

Sword Performance Solution | JMeter Training Lab Page 11 / 34


Training Catalog

Test Case: TC03 - Update Applicant


Step Step Description Required Data Screenshots/Expected Result(s)
Application URL - The following screen is displayed:

S_01: Home  Enter the


page application URL

- The following screen is displayed:

S_02: sign in  Click on “Sign In”


page button

 Entre Email Valid email - The following screen is displayed:


address Valid password
S_03: login Enter Password
 Click on “Sign
In” button

- The following screen is displayed:

 Click on “Go to >


My Public Pages”
S_04: Public
pages menu

 Select one of the - The selected field is updated.


S_05: Update editable fields from
applicant the table: first
name, last name,

Sword Performance Solution | JMeter Training Lab Page 12 / 34


Training Catalog

email or phone
number.

Type a new entry


 Press “Enter”
key

- The following screen is displayed:

 Click “Sign Out”


S_06: logout
button

Step 5: Design test scenarios


- Depending on the performance requirements and objectives, identify scenarios
levels (Single user, Average, Peak )

Two scenarios will be executed for each test case:


o Single User
o Real Average

- Compute L&P parameters (Pacing, sleep time, rump-up…)

# Pacing Sleep Time Ramp-up


Test Scenario TC Tx / h
Users (s) (s) (u/s)
Single User Scenarios
SearchApplicantsSingle TC1 1 None 3 1 n/a
TC2
ManageApplicantsSingle 2 None 3 1 n/a
TC3
Average Load Scenarios
SearchApplicantsAverage TC1 30 120 2 1/15 900
TC2
ManageApplicantsAverage 14 30 1 1/15 1800
TC3

- State Scenario Pre and Post Condition for each scenario

Sword Performance Solution | JMeter Training Lab Page 13 / 34


Training Catalog

Test Case Pre-condition Post-Condition


SearchApplicantsSingle  One or more applicants are
 None
already added to the database
ManageApplicantsSingle  One or more applicants are  The selected applicant is
already added to the database remove/Updated
SearchApplicantsAverage  One or more applicants are
 None
already added to the database

Step 6: Design instrumentation and deployment components:


- Load Generator
o Why should we use a load generator?
Load generators are used to simulate multiple user working on the
application. This simulation is meant to generate a production-like load.
o What are the components of the Load Generator that you will use? What is
the role of each component?
JMeter will be used to load charge on the Reference Application. Load
Generator is mainly composed of:
 Controller: a JMeter instance used to capture test cases workflows,
configure, execute and monitor test scenarios
 JMeter Agent: Creates Virtual Users script players to emulate the
target application (lunched as server mode)

- Define the list of measurement tools: The measurement tools that will be used for this
test are:
o JMeter Used to launch the test and monitor its execution.
o AppDynamics based environment:
 AppDynamics Agents: Used to collect applicative and resources
related metrics.
 AppDynamics Controller: Used to host metrics gathered by
AppDynamics agents.
 AppDynamics Dashboards: Used to monitor applicative and resources
related metrics during the test execution.

- Illustrate test environment and show the used instrumentation tool on each
component (instrumentation schemas)
Refer to the “Test environment” document.

Step 7: Consolidate all responses to the instructions above and write your L&P Test Design,
(use available PTD template).

Sword Performance Solution | JMeter Training Lab Page 14 / 34


Training Catalog

4 IMPLEMENTATION
4.1 Objectives
Upon completion of this lab, you should be able to setup test environment and implement
design elements.

4.2 Exercises

4.2.1 Prerequisite
Before proceeding to next steps, ensure that the following points are checked:
- The design of test cases is accomplished
- The design of test scenarios is accomplished
- The load testing tool is installed locally
- Test environment machines are accessible

4.2.2 Task 1: L&P Test Implementation


Step 1: What is Test Plan in JMeter? Create a new performance test plan named “Job
Applicant Ref App Test Plan”
A test plan describes a series of steps JMeter will execute when run. A complete test plan
will consist of one or more Thread Groups, logic controllers, sample generating controllers,
listeners, timers, assertions, and configuration elements.
in order to create the test plan you have Just to add the Name of the test plan as following:

Sword Performance Solution | JMeter Training Lab Page 15 / 34


Training Catalog

Step 2: Create the selected 3 test cases detailed in the previous section: To do it you have
to create 3 Thread groups by right-clicking on the “Test Plan” and add a new thread group:
Add > Threads (Users) > Thread Group

Step 3: Create a default HTTP Request and define the host Name and the Port number as
global variables
- user defined variables

- Default HTTP Request: Right click “Add -> Config Element -> HTTP Request
Defaults”

Sword Performance Solution | JMeter Training Lab Page 16 / 34


Training Catalog

- In new HTTP Request Defaults element define the following parameters:


o Server name or IP to ${HostName}
o Port Number to ${PortNumber}

Step 4: Create a default Cookie Manager to support user session management

Step 5: Add a Runtime Controller and define the different steps as Transaction controllers
under each test case
- Runtime Controller

Sword Performance Solution | JMeter Training Lab Page 17 / 34


Training Catalog

- Transaction controller

Step 6: Add the sleep time


- Create a user Defined Variable to include the Variable

- Add the variable " TC1_SleepTime"

- Add a test Action as following:

Sword Performance Solution | JMeter Training Lab Page 18 / 34


Training Catalog

Step 7: Add the wait Time

Step 8: Create a Recording controller


- Right click on the “Thread Group” and add a recording controller: Add > Logic
Controller > Recording Controller

Sword Performance Solution | JMeter Training Lab Page 19 / 34


Training Catalog

Step 9: Add a new HTTP(S) Test Script Recorder


- Right click on WorkBench and add the recorder: Add -> Non-Test Elements ->
HTTP(S) Test Script Recorder

Step 10: Configure your browser to use the JMeter proxy

Sword Performance Solution | JMeter Training Lab Page 20 / 34


Training Catalog

Step 11: Return back to HTTP(S) Test Script Recorder, click on the button "start" and select
the target controller for each step. go back and navigate in the reference application to
record the different requests related to each step

Step 12: After the recoding, stop the script recorder and try to expend the transaction steps
and to check the recoded requests.

Step 13: Implement Response assertion to check the response content

Sword Performance Solution | JMeter Training Lab Page 21 / 34


Training Catalog

Step 14: Parameterize the script by adding dynamic data pools


- Create the required data pool for the variables login and password

- Add data pools entries to the script

Step 15: try to get the response of the applicant search using Regular Expression Extractor

Step 16: validate your script by re-executing it and validate responses

Step 17: Add listeners in order to monitor requests and to get test results
Note that you can import external plugins to add new and rich listeners: you can for example
use the following: https://jmeter-plugins.org/wiki/GraphsGeneratorListener/

Sword Performance Solution | JMeter Training Lab Page 22 / 34


Training Catalog

Once you are done with the above four steps, please proceed as follows:
Step 18: Configure and start monitoring agents
- Unzip the Java Agent zip file into <AppDynamics_Agent_HOME>
- Configure the agent to connect to Ayppdynamics controller
Update the file <AppDynamics_Agent_HOME>/conf/controller-info.xml with the
following properties:
<controller-host>10.66.12.9</controller-host>
<controller-port>8090</controller-port>
<account-access-key>9e515577-886d-4d2a-b839-b3d54f2e66c7</account-access-
key>
- Configure the agent with the application name, tier and node
Update the file <AppDynamics_Agent_HOME>/conf/controller-info.xml with the
following properties:
<application-name>adhocRefApp</application-name>
<tier-name>job-Applicant-Tier</tier-name>
<node-name>job-Applicant-Node</node-name>
- Configure Jboss server to start AppDynamics Agent
Add the following options to Jboss config file <JBoss_HOME>/bin/standalone.conf :
JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,com.appdynamics,com.a
ppdynamics.,com.singularity,com.singularity.,org.jboss.logmanager,org.jboss.logman
ager."

JAVA_OPTS="$JAVA_OPTS -Xbootclasspath/p:/home/adcuser/adhoc-ref-
app/Jboss-Distribution/liferay-portal-6.1.1-ce-ga2/jboss-
7.1.1/modules/org/jboss/logmanager/main/jboss-logmanager-
1.2.2.GA.jar:/home/adcuser/adhoc-ref-app/Jboss-Distribution/liferay-portal-6.1.1-ce-
ga2/jboss-7.1.1/modules/org/jboss/logmanager/log4j/main/jboss-logmanager-log4j-
1.0.0.GA.jar:/home/adcuser/adhoc-ref-app/Jboss-Distribution/liferay-portal-6.1.1-ce-
ga2/jboss-7.1.1/modules/org/jboss/logmanager/log4j/main/log4j-1.2.16.jar"

JAVA_OPTS="$JAVA_OPTS -
Djava.util.logging.manager=org.jboss.logmanager.LogManager"

export JAVA_OPTS="$JAVA_OPTS -
javaagent:<AppDynamics_Agent_HOME>/javaagent.jar"
- Restart Jboss server

Sword Performance Solution | JMeter Training Lab Page 23 / 34


Training Catalog

5 TEST SCENARIO EXECUTION & ANALYSIS


5.1 Objectives
Upon completion of this lab, you should be able to:
- Execute and monitor L&P tests
- Collect and analyze performance data

5.2 Exercises
5.2.1 Prerequisites
Before proceeding to next steps, ensure that the following points are checked:
- Test cases and test scenarios are setup on the Test Plan defined during the
previous section
- Performance test scripts are generated and validated
- Test environment machines are accessible
- Environment is properly instrumented
- The APM Tool is available and accessible
5.2.2 Task 1: Environment check and validation
The goal of the current task is to:
- Validate the test environment.
- Check the implemented scripts.
- Check if the instrumentation tools are working as expected.
- Check about the baseline metrics: Resource consumption in normal situation.

To do so, create and execute the single user scenario for each test case:
Step 1: Prepare session
- Refer to the model defined within step 5 of the section 3 and define test parameters
o Number of Users

o Sleep Time and Wait Time (defined as Test Action)

Sword Performance Solution | JMeter Training Lab Page 24 / 34


Training Catalog

o Ramp-up

o Test Duration

Note: to define the pacing, you should compute the define the wait time based on the
following formula:

Wait Time = Pacing - (Target Step Response Time + Sleep Time) * Nb Steps

Step 2: Prepare test session


- Server Configuration: Below is the JVM Options to be considered on the server:
o -Xms1024m
o -Xmx1024m
o -XX:MaxPermSize=256m
o -Xloggc:..\standalone\log\gc.log
o -verbose:gc -XX:+PrintGCDetails

Sword Performance Solution | JMeter Training Lab Page 25 / 34


Training Catalog

- Be sure that the parameter


com.adhoc.referenceapp.jobapplications.manager.UPDATE_REMOVE_DELAY is
set to 3000 ms in the file <JBoss_Distribution_Home>\liferay-portal-6.1.1-ce-
ga2\jboss-7.1.1\standalone\deployments\job-applications-manager-
portlet.war\application.properties

- Database configuration: 50000 applicants should be inserted to the database, before


stating the current scenario.
o Generate a mysql dump using the tool auto-sql-generator.jar

o Insert dump to the database:


source <PATH_TO_GENERATED_DUMP>/mysql_dump_50000.sql;

o Be sure that there are no indexes configured on the table job_Applicant.


 To check about indexes use the following command: SHOW INDEX
FROM job_Applicant;

 To remove existing indexes use the following command:


DROP INDEX `<IDX_NAME>` ON job_Applicant;
<IDX_NAME> is the name of the index.

Step 3: Start Load Generator Agents using JMeter server mode

5.2.3 Task 2: Execute & Analyse “Search Applicants” Average Scenario


5.2.3.1 Execute Scenario
Based on the scenario design defined previously, proceed as following:
Step 4: Execute test scenario on remote agents

Step 5: Monitor scenario execution


During the test execution check:
- The KPIs gathered by the instrumentation tool: Open the APM tool’s monitoring user
interface and look at:
o Resource metrics: CPU usage, Heap usage
o Applicative metrics
- The KPI gathered by the load generator
o Determine transactions rate and compare it to the expected value (use Load
Generator Properties View)
o Identify steps/pages response time (Average response time, Max response
time, 90% ...).

Sword Performance Solution | JMeter Training Lab Page 26 / 34


Training Catalog

- The application log files


Check available log files and identify potential system errors. Application log files:
They are located in /home/adcuser/adhoc-ref-app/Jboss-Distribution/liferay-
portal-6.1.1-ce-ga2/jboss-7.1.1/standalone/log
- The load generator log files
o Check available log files and identify potential system errors

Step 6: Collect test results

Once the test is finished, collect all data gathered during the test:
- KPIs
- Log files
Step 7: Check results
- Check that there is no error related to the tests execution
- Check that monitoring tools are providing applicative and resources related metrics:

5.2.3.2 Analyze Scenario Results


Step 8: Analyze collected performance data and identify performance problem(s)
- Check that the target transaction rate is reached.
- Check End User Response Time: We can observe that the response time for the step
“Search applicants” is not stable. Peak values are observable during the test that
reaches more than 5 seconds.

- Check Resource Usage


o Heap usage: There is no issue with the memory utilisation during the test.
o CPU utilisation: There is no issue with the CPU consumption

- Check Errors and Exceptions: No errors observed during the test.

- Drill down for the step “Search Applicants”:

Sword Performance Solution | JMeter Training Lab Page 27 / 34


Training Catalog

o By looking at the sequence diagram, we deduce that the step “Search


Applicants” calls mainly the method searchApplicants of class
ApplicationsManagerServiceImpl.

Note: Refer to adhoc Reference Application - Developer Guide:


o Open Business Transactions statistics by clicking on the node “adhocRefApp
> Business Transactions” in AppDynamics Dashboard

o You can see that there are stalled transactions that deal with Job Applications
Manager portlet. That confirms the response time behaviour.

Sword Performance Solution | JMeter Training Lab Page 28 / 34


Training Catalog

o Click on the stalled transactions

o Now, open one transaction to see the transaction snapshot flow map: Al
illustrated in the following graph, You can see that 60 % of the transaction is
spent on calling the database.

o Now, click on the database node “LPORTAL-MYSQL DB” to see more details
about the DB call made during the transaction:

o Now, we can see the SQL query that takes the most part of the response
time. It matches the search query.
Step 9: Find the root cause of identified problem(s) using appropriate technique/tool(s)
- The search operation is made on the table job_Applicant.
- The first thing to check in case of slow SQL query is the existence of proper indexes.
- To check if the database is properly indexed, use the following command:
- SHOW INDEX FROM job_Applicant;

Sword Performance Solution | JMeter Training Lab Page 29 / 34


Training Catalog

- We can see that the table is not properly indexed and this can be the cause of the high
response time.
5.2.3.3 Tuning
Step 10: Fix the problem(s) and restart the scenario execution
To confirm our hypothesis, we should add the proper indexes on the table job_Applicant and
re-run the same test.
Indexes should be added on the columns that are involved on the search criteria:
- create index IDX_JOB_APPLICANT_001 on job_Applicant
(applicantId,firstName,lastName,emailAddress);

Once re-executing the same scenario with the proper indexes, we can observe that the
response time is enhanced. The max value is 2.5 seconds instead of 5 seconds with the old
configuration.
5.2.4 Task 3: Execute & analyse a mixed scenario “Manage Applicants”
The scenario should be a mix of:
- "Remove Applicant" Average scenario
- “Update Applicant” Average scenario
Both scenarios should run on parallel.
5.2.4.1 Execute Scenario
Based on the scenario design, proceed to step 4 to 7 as described previously

5.2.4.2 Analyze Scenario Results


Step 8: Analyze collected performance data and identify performance problem(s)
- Check that the target transaction rate is reached.

- Check End User Response Time: We observe that the execution of some steps hangs
indefinitely. In fact, the steps “Update Applicant” and “Remove Applicant” are
executed almost only one time.

- Check Resource Usage


o Heap usage: The heap behaviour is fine during the test.
o CPU utilisation: There is no issue with the CPU consumption

- Check Applicative metrics: Candidate should check the sequence diagrams that deal
with the step “Update Applicant” and “Remove Applicants”:
o Update Applicant:

Sword Performance Solution | JMeter Training Lab Page 30 / 34


Training Catalog

o Remove Applicant:

Based on the sequence diagrams we can deduce the following points:


- The step “Update Applicant” involves mainly the method updateApplicant of class
ApplicantionsManagerServiceImpl
- The step “Remove Applicants” involves mainly the method removeApplicants of
class ApplicantionsManagerServiceImpl

Open Business Transactions statistics by clicking on the node “adhocRefApp > Business
Transactions” in AppDynamics Dashboard. You can see that there are 13 stalled
transactions that deal with Job Applications Manager portlet. That confirms the response
time behaviour.

Sword Performance Solution | JMeter Training Lab Page 31 / 34


Training Catalog

By looking at the Events menu in the main AppDynamics Dashboard, notice that there are
some code problems.

Now, move to the events view by clicking on “Events” sub-menu in the left panel of the
dashboard.

The view shows problem of type “Code Deadlock”:

Sword Performance Solution | JMeter Training Lab Page 32 / 34


Training Catalog

Click on the first item and switch to Details tab. No you can see the details about the threads
that are locked

Step 9: Find the root cause of identified problem(s) using appropriate technique/tool(s)
Check the methods mentioned by the blocked threads. We can notice the existence of
synchronized block.
1. com.adhoc.referenceapp.jobapplications.manager.server.ApplicationsManagerServi
ceImpl.removeApplicants
synchronized (REMOVE_LOCK) {
try {
Thread.sleep(UPDATE_REMOVE_DELAY);
} catch (InterruptedException e) {
}
synchronized (UPDATE_LOCK) {
for (ApplicantDTO applicantDTO : applicantDTOList) {
2. com.adhoc.referenceapp.jobapplications.manager.server.ApplicationsManagerServi
ceImpl.updateApplicant
synchronized (UPDATE_LOCK) {
try {
Thread.sleep(UPDATE_REMOVE_DELAY);
} catch (InterruptedException e) {
}
synchronized (REMOVE_LOCK) {
// System.out.println("Updater Thread Holds lock on object UPDATE_LOCK");
try {
applicant = ApplicantLocalServiceUtil
.getApplicant(applicantDTO.getApplicantId());
applicant.setApplicantId(applicantDTO.getApplicantId());

Sword Performance Solution | JMeter Training Lab Page 33 / 34


Training Catalog

5.2.4.3 Tuning
Step 10: Fix the problem(s) and restart the scenario execution
To correct the problem, proceed as following:
- Remove synchronized block as described previously
- Build and deploy modified portlet
- Re-run the same test

Sword Performance Solution | JMeter Training Lab Page 34 / 34

You might also like