Load Testing Development for Websites (JMeter)
Apache JMeter is a mature load testing tool on Java. Supports HTTP, HTTPS, WebSocket, JDBC, LDAP, FTP. Rich GUI for building test plans, plugins for extending functionality, widely used in enterprise.
Test Plan Architecture
Test Plan
├── Thread Group (user group)
│ ├── HTTP Request Defaults (common settings)
│ ├── HTTP Cookie Manager
│ ├── HTTP Header Manager
│ ├── Login Sampler (POST /api/auth/login)
│ ├── Think Time (wait timer)
│ ├── Products Sampler (GET /api/products)
│ └── Assertions
├── Results Tree Listener
├── Aggregate Report Listener
└── Response Time Graph
Creating Test Plan via JMX (XML)
<!-- test-plan.jmx -->
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0">
<hashTree>
<TestPlan testname="E-commerce Load Test">
<hashTree>
<ThreadGroup testname="User Flow" enabled="true">
<stringProp name="ThreadGroup.num_threads">100</stringProp>
<stringProp name="ThreadGroup.ramp_time">60</stringProp>
<stringProp name="ThreadGroup.duration">300</stringProp>
<boolProp name="ThreadGroup.scheduler">true</boolProp>
<hashTree>
<HTTPSamplerProxy testname="Login">
<stringProp name="HTTPSampler.domain">${BASE_URL}</stringProp>
<stringProp name="HTTPSampler.path">/api/auth/login</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<!-- ... -->
</HTTPSamplerProxy>
</hashTree>
</ThreadGroup>
</hashTree>
</TestPlan>
</hashTree>
</jmeterTestPlan>
Running via Command Line (Without GUI)
# Basic run
jmeter -n -t test-plan.jmx \
-l results.jtl \
-e -o html-report/ \
-JBASE_URL=https://staging.example.com \
-JN_USERS=100 \
-JRAMP_UP=60
# With plugins from command line
jmeter -n -t test-plan.jmx \
-Jjmeterengine.force.system.exit=true \
-l results.jtl \
-JBASE_URL=https://staging.example.com
Variables and Parameterization
# users.csv — test user data
email,password
[email protected],pass123
[email protected],pass456
[email protected],pass789
In JMeter: Add → Config Element → CSV Data Set Config:
- Filename:
${__P(data_dir)}/users.csv - Variable Names:
email,password - Sharing Mode: All threads
Assertions
Response Assertion:
- Response Code: equals 200
- Response Body: contains "access_token"
Duration Assertion:
- Duration in milliseconds: <= 1000
JSON Path Assertion:
- JSON Path: $.data[0].id
- Expected Value: (not empty)
Beanshell/Groovy Post-processor
// Groovy JSR223 PostProcessor — extract JWT from response
import groovy.json.JsonSlurper
def response = prev.getResponseDataAsString()
def json = new JsonSlurper().parseText(response)
vars.put("auth_token", json.access_token)
vars.put("user_id", json.user.id.toString())
Distributed Testing
# Master-slave configuration
# remote_hosts in jmeter.properties
remote_hosts=192.168.1.11,192.168.1.12,192.168.1.13
# Run on all nodes
jmeter -n -t test-plan.jmx -r -l results.jtl
Grafana Integration via InfluxDB
# jmeter.properties
backend_listener_client=kg.apc.jmeter.reporters.influxdb2.InfluxDbBackendListenerClient
# Backend Listener Config
influxDBHost: localhost
influxDBPort: 8086
influxDBToken: your-token
influxDBOrganization: myorg
influxDBBucket: jmeter
Implementation Timeline
Developing a JMeter test plan with 5–7 load scenarios: 3–6 days.







