Performance testing involves monitoring servers, simulating realistic workloads, and analyzing results. This workflow combines Apache JMeter for load generation and nmon for system-level metrics.
Server Resource Monitoring
Install nmon on the target Linux server. Start recording before the test with a command similar to:
nmon -s 2 -c 900 -f -m /opt/nmon_output/
This captures a snapshot every 2 seconds for 1800 seconds (30 minutes). The output files (*.nmon) will be saved under /opt/nmon_output/. For multi-tier architectures, run the same command on each application and database server.
While JMeter executes the scenario, nmon logs CPU, memory, disk, and network metrics that can later be correlated with response times.
JMeter Scenario Configuration
Workload Simulation
Build a test plan that models a business flow, for instance: login → data entry → report calculation. Use a Thread Group with the following settings:
- Number of threads (concurrent users): set according to you're test goal.
- Loop count: Infinite (or a large number), controlled by a duration.
- Duration: specify in seconds to maintain the load for a defined period.
Mixed Scenarios with Throughput Controller
When you need different virtual user groups executing separate tasks, add a Throughput Controller. For example, 60% of users run report calculation while 40% perform data lookups. Configure the controller’s Percent Executions option accordingly, and place the samplers as children.
Random Data Generation
Many business scenarios require unique input on each iteration. Use JMeter’s built-in __Random function. Example:
${__Random(1000,9999,transactionId)}
Insert this into request parameters to generate random numeric values within the specified range. The function helper dialog assists in selecting the appropriate functon for random strings, dates, etc.
Result Collection
Add a Simple Data Writer or Summary Report listener to write raw samples. Set the filename to a .jtl file, e.g., results/test-run-2024.jtl. This file is essential for offline analysis and dashboard generation.
Generating HTML Dashboard from JMeter Results
Once the test completes, open a terminal in the JMeter bin directory and run:
jmeter -g /path/to/results/test-run-2024.jtl -o /path/to/report/test-run-2024
The -o directory must be empty or non-existent. The command creates an interactive HTML dashboard with charts and statistics. Open index.html in a browser.
Analyzing nmon Server Metrics
- Download the
.nmonfile from the server to your local machine. - Use the
nmon_analyser_v52_1.xlsmExcel workbook. After enabling macros, click Analyze nmon data and select the downloaded file. - The tool produces a formatted Excel report with graphs for CPU, memory, disk I/O, and network throughput. Compare timestamps with JMeter’s response time trends to identify bottlenecks.