akalongman / jmeter-example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JMeter Installation

See Installation guide file

JMeter Testing

Although all the queries are the same as what the browser does, the test is still synthetic (For example, it is impossible to generate all these user requests from different IP addresses, as is actually the case), That's why we should allow a small error probability in the test and take into account the server resource calculating time.

Prepare for Testing

Make sure your website is ready for testing

JMeter

Make sure you have installed the latest version of jMeter (https://jmeter.apache.org/download_jmeter.cgi).

Client machine (from where you plan to run tests) should have enough resources, or tests should be run in distributed mode.

Recommended jMeter properties specified in user.properties file. With -q argument we load this config file for aour tests.

Also, you can have a look to Client Performance.

Run Tests

Tests should be run from external server, which will have enough performance resources. test should be run with root privileges, to avoid OS limitations (file /etc/security/limits.conf on linux).

To run tests, use this command:

JVM_ARGS="-Xms16g -Xmx16g" /opt/apache-jmeter/bin/jmeter -n -q ./user.properties -t ./scripts/script.jmx -JHOST=example.com -JPROTOCOL=https -JUSERS=5000 -JPERIOD=60 -JTIMEOUT=1000 -l ./storage/report_$(hostname)_$(date +%Y%m%d%H%M%S).csv

სადაც

  • JVM_ARGS - Increase RAM limit for jMeter to 16 GB;

  • JHOST - Target server domain;

  • JPROTOCOL - Target server protocol (http/https)

  • JUSERS - Parallel users count (Number of threads. Default: 10)

  • JPERIOD - Ramp up period, in seconds. (Ramp-up is the amount of time it will take JMeter to add all test users (threads) to a test execution. Default: 10);

  • JTIMEOUT - Timeout between requests, in milliseconds. (Default: 1000);

  • It is possible to increase/decrease load via changing JUSERS, JPERIOD and JTIMEOUT arguments.

Results Analyzing

To generate HTML GUI of CSV reports, run:

/opt/apache-jmeter/bin/jmeter -q ./user.properties -g ./storage/<csv file> -o ./public/$(date +%Y%m%d%H%M%S)

Also, you can upload CSV here: https://sense.blazemeter.com/gui/

CLI Output

  • "5 in 00:00:24 = 0.3/s" means that in 24 seconds we have sent 5 requests to the server with an average throughput of 0.3 requests per second
  • "Avg: 182" means that the average response time at that moment is 182 milliseconds
  • "Min: 88" means that the minimum response time from send requests for that period was 88 milliseconds
  • "Max: 483" means that the maximum response time from send requests for that period was 483 milliseconds
  • "Err: 0 (0.00%)" means that we didn't have any errors in requests for that period and the percentage of errors from total requests is 0 accordingly
  • Active: shows the number of active users who were performing requests for this period
  • Started: shows the total number of started threads since the beginning of the tests
  • Finished: shows the total number of threads that already finished execution since the beginning of tests

Client Performance

To make very high loads, it is recommended to run jMeter in distributed mode from multiple servers.

For server tuning see Server Tuning

About

License:MIT License


Languages

Language:PHP 100.0%