Stress testing with JMeter¶

Apache JMeter is an open source Coffee desktop application, congenital to verify functional behavior, perform load tests, and measure performance. Some of JMeter points of strength are mentioned here below:

  • It ships with an easy-to-use GUI;
  • It allows to set up multiple thread groups, different parallelism and request count, to ramp up the load;
  • It can use CSV files to generate semi-randomized requests;
  • It tin execute parameterized tests;
  • It reports results in a uncomplicated table;
  • It uses assertions for checking test results;
  • Information technology tin can exist executed in batch.

In the picture beneath we have summarised the basic concepts of a JMeter examination which we are going to build right afterward.

../_images/jmeter11.png

JMeter basic concepts

Configuring a simple examination¶

This section explains how to run performance tests using JMeter in guild to evaluate the GeoServer performances when serving WMS requests. The performance test aims to stress the server and evaluates the response fourth dimension and throughput with an increasing number of simulated users sending concurrent requests to the server.

Annotation

Ideally, to avoid adding actress load to the server JMeter should run on a unlike machine.

Warning

If you have performed the exercises in the security section, please get back to the layer and service security pages and open admission to everybody, on all data and all services, earlier performing the exercises in this department

  1. From the training root, on the control line, run jmeter.bat (or jmeter.sh if yous're on Linux) to get-go JMeter:

    ../_images/jmeter2.png

    jMeter interface

  2. Add a new Thread Group with the mouse right click on Examination Plan tree node:

    ../_images/jmeter3.png

    Adding a new Thread Group

  3. In the Thread Group panel set the number of thread for the exam to 4 (this represents the number of simultaneous requests that are fabricated to GeoServer) and the ramp-up period to threescore. Also, chek Forever on the Loop Count field.

    ../_images/jmeter14.png

    Setting the Thread Group

  4. Add a new Loop Controller with the mouse right click on Thread Grouping tree node:

    ../_images/jmeter4.png

    Adding a new Loop Controller

  5. Right click on the Loop Controller tree node and add a new HTTP Asking chemical element:

    ../_images/jmeter5.png

    Adding a new HTTP Request

  6. In the HTTP Request enter the following basic configuration:

    Field Value
    Server Name or IP localhost
    Port Number 8083
    Path geoserver/ows

    ../_images/jmeter9.png

    HTTP Asking host/port/path configuration

  7. From the grooming data dir root, open the data/jmeter_data/jmeter_request_params.txt , select and copy its contents in the clipboard, and then click "Add from Clipboard" in the "HTTP request" panel to setup a sample GetMap request:

../_images/jmeter_request_params.png

HTTP parameters configuration

  1. Add together the following listeners past right clicking on Exam Plan tree node: View results Tree , Summary Study , Graph results

    ../_images/jmeter7.png

    Calculation a Listeners

  2. Save this configuration into information/jmeter_data/ as jmeter_simple.jmx

At this point JMeter is configured to run a GeoServer operation examination:

  1. Click on Run tool and select Starting time to startig the jMeter examination.

    ../_images/jmeter13.png

    starting jMeter examination

  2. Select View Results Tree to straight see the request informations produced and the asking issue:

    ../_images/jmeter15.png

    The View Results Tree panel

  3. Select Summary report to view the statistical informations about the requests:

    ../_images/jmeter19.png

    The Aggregate Graph console

  4. Select Graph Results to analyze the technical trend of the requests:

    ../_images/jmeter17.png

    The Spline Visualizer panel

  5. Click on Run tool and select Finish to end the benchmarking session

Creating a Multiscale examination¶

This chapter explains how to create a custom randomized Multiscale exam with a set up of multiple concurrent threads.

In the example before, we ran a examination on a layer always requesting the same bounding box and image size. At present we should fix a more sophisticated examination asking for different bounding boxes and resolutions, i.east. a multiscale test. Multiscale testing is useful considering it stresses GeoServer requesting new information each time, mimicking existent usage conditions and providing ameliorate testing for eventual SLD scale dependencies. With JMeter we can execute the exam by passing a CSV file containing multiple randomized bounding boxes and image dimensions.

In the first paragraph we are going to describe how to generate a CSV file for randomized requests at different scales. In the 2nd one is shown how to configure a new JMeter test with multiple simultaneous threads.

Create CSV file¶

  1. Only for Windows machines: open the file gdal.bat under %TRAINING_ROOT% folder inside the training dwelling folder.

  2. Run:

    Linux:

    cd $TRAINING_ROOT/geoserver_data/information/boulder  gdalinfo srtm_boulder.tiff                      

    Windows:

                            cd                        %                        TRAINING_ROOT                        %\geoserver_data\data\boulder                        gdalinfo                        srtm_boulder                        .                        tiff                      
  3. The output of the control will be something similar this:

                        Driver                    :                    GTiff                    /                    GeoTIFF                    Files                    :                    srtm_boulder                    .                    tiff                    Size                    is                    2520                    ,                    1800                    Coordinate                    System                    is                    :                    GEOGCS                    [                    "WGS 84"                    ,                    DATUM                    [                    "WGS_1984"                    ,                    SPHEROID                    [                    "WGS 84"                    ,                    6378137                    ,                    298.257223563                    ,                    AUTHORITY                    [                    "EPSG"                    ,                    "7030"                    ]],                    AUTHORITY                    [                    "EPSG"                    ,                    "6326"                    ]],                    PRIMEM                    [                    "Greenwich"                    ,                    0                    ],                    Unit of measurement                    [                    "degree"                    ,                    0.0174532925199433                    ],                    Potency                    [                    "EPSG"                    ,                    "4326"                    ]]                    Origin                    =                    (                    -                    105.700138888888890                    ,                    xl.300138888888888                    )                    Pixel                    Size                    =                    (                    0.000277777777778                    ,                    -                    0.000277777777778                    )                    Metadata                    :                    AREA_OR_POINT                    =                    Area                    Image                    Structure                    Metadata                    :                    INTERLEAVE                    =                    Band                    Corner                    Coordinates                    :                    Upper                    Left                    (                    -                    105.7001389                    ,                    40.3001389                    )                    (                    105                    d42                    ' 0.50"Westward, 40d18'                    0.fifty                    "N)                    Lower                    Left                    (                    -                    105.7001389                    ,                    39.8001389                    )                    (                    105                    d42                    ' 0.fifty"W, 39d48'                    0.fifty                    "Northward)                    Upper                    Right                    (                    -                    105.0001389                    ,                    forty.3001389                    )                    (                    105                    d                    0                    ' 0.50"West, 40d18'                    0.l                    "N)                    Lower                    Right                    (                    -                    105.0001389                    ,                    39.8001389                    )                    (                    105                    d                    0                    ' 0.50"Westward, 39d48'                    0.50                    "N)                    Center                    (                    -                    105.3501389                    ,                    40.0501389                    )                    (                    105                    d21                    ' 0.fifty"W, 40d three'                    0.fifty                    "N)                    Band                    1                    Block                    =                    256                    x256                    Type                    =                    Int16                    ,                    ColorInterp                    =                    Gray                    Overviews                    :                    1260                    x900                    ,                    630                    x450                    ,                    315                    x225                    ,                    158                    x113                    ,                    79                    x57                    ,                    xl                    x29                  
  4. The data needed to create a multiscale CSV file are:

    Tile Size 256 10 256
    Pixel Size 0.000277777777778
    Bounding Box ((-105.7001389, -105.0001389), (39.8001389, 40.3001389))
  5. Run:

    Linux::
    cd $TRAINING_ROOT/information/jmeter_data  python ./wms_request.py -count 100 -region -105.seven 39.8 -105.0 40.three -minres 0.00028 -maxres 0.00224 -minsize 256 256 -maxsize 1024 1024 > multiscale.csv                          
    Windows::
    cd %TRAINING_ROOT%\data\jmeter_data  wms_request.py -count 100 -region -105.7 39.viii -105.0 40.three -minres 0.00028 -maxres 0.00224 -minsize 256 256 -maxsize 1024 1024 > multiscale.csv                          

    wms_request.py is a python script which generates randomized requests at different bounding box and resolutions. The parameters are described in the following tabular array:

    Parameter Description
    count Indicates the number of requests to generate
    region Indicates the maximum bounding box of each asking
    minres/maxres Indicates the minimum and maximum value for the Pixel Size to request (Typically it should be at least the minimum resolution)
    minsize/maxsize Indicates the minimum and maximum dimensions of the requested paradigm (Typically information technology should exist at least equally large as the tile size)

    The CSV file is structured following the rule $width;$height;$bbox .

    For example 290;444;-105.5904,39.910198,-105.48776,xl.067338 indicates a request of size 290x444 and Bounding box [-105.5904,39.910198,-105.48776,forty.067338].

    JMeter must be configured for parsing the CSV file correctly by using the CSV Data Ready Config element.

Configure JMeter¶

  1. From the training root, on the command line, run jmeter.bat (or jmeter.sh if yous're on Linux) to start JMeter:

    ../_images/jmeter2.png

    jMeter interface

  2. Add three new items of blazon Thread Group chosen one, 2, 4

  3. For each Thread Grouping fix the Number of Thread (users) field equal to the Thread Grouping proper name, the Ramp-Up Period and Loop Count fields to 1.

    ../_images/jmeter18.png

    Setting the Thread Group (here: Thread Group 1)

  4. In the Examination Plan section, bank check the Run Thread Groups consecutively checkbox

  5. Add together a new Loop Controller to the first Thread Grouping object

  6. Right click on the Loop Controller tree node and add a new HTTP Request chemical element with the same name of the Thread Group:

    ../_images/jmeter21.png

    Setting the HTTP Request

  7. In each HTTP Asking add together the post-obit fields to the panel:

    Name Value Encode? Include Equals?
    bbox ${bbox} unchecked checked
    tiptop ${height} unchecked checked
    width ${width} unchecked checked

    Which should look like in the moving-picture show

    ../_images/jmeter20.png

    HTTP Request panel configuration

  8. Uncheck the Follow Redirects and Utilise KeepAlive checkbox

  9. Right click on the Loop Controller tree node and add a new CSV Data Fix Config chemical element:

    ../_images/jmeter22.png

    Setting the CSV Data Set Config

  10. Configure the CSV Data Ready Config as follows:

    Field name Value
    Filename ./multiscale.csv
    Variable names width,acme,bbox
    Delimiter ;

    ../_images/jmeter23.png

    Configuring the CSV Data Set Config

  11. Right click the loop controller and choose "Re-create", then right click the other thread groups (1 past one) and choose "paste" to go a full copy of the controller, HTTP sampler and CSV confiuration. Adjust each "HTTP request" node name to match the thread group name (1, 2 and iv)

  12. Configure the Loop Controller along the following schema:

    Thread Group
    • 1
    Loop Controller –> Loop Count
    • 100
    Thread Group
    • 2
    Loop Controller –> Loop Count
    • 50
    Thread Group
    • four
    Loop Controller –> Loop Count
    • 50
  13. From the Test Plan tree node add together an HTTP Asking Defaults element (Config Element -> HTTP Asking Defaults) and enter the following basic configuration:

    Field Value
    Server Proper name or IP localhost
    Port Number 8083
    Path geoserver/ows

    Information technology should look like this:

    ../_images/jmeter9.png

    HTTP Default Request host/port/path configuration

  14. From the training data dir root, open the information/jmeter_data/jmeter_request_params_2.txt , select and copy its contents in the clipboard, then click Add from Clipboard in the HTTP request panel to prepare upwardly a sample GetMap request:

  15. Add together the following listeners by right clicking on Test Plan tree node: View results Tree and Summary Report

  16. Add the following assertions by right clicking on Test Plan tree node: Response Assertion

    ../_images/jmeter24.png

    Calculation Assertions

    Note

    Using Assertions is helpful because it avoids to continuously exercise a visual bank check on the results.

  17. Configure the Response Assertion following this table:

    Field Value
    Apply to Main sample only
    Response field to exam Response Headers
    Pattern Matching Rules Contains

    In the Pattern to exam panel add together:

    The final result should look similar in the picture:

    ../_images/jmeter25.png

    Configuring Response Assertion

  18. The overall test plan should look equally follows. Save it in the jmeter_data directory every bit multiscale.jmx

../_images/multiscale.png

Saving the multiscale criterion

At this signal JMeter is configured to run a GeoServer performance test:

  1. Select the Test Plan tree node and select Run - Start from the top menu to start the JMeter exam.

    ../_images/jmeter13.png

    starting JMeter exam

  2. Select View Results Tree to direct see the request information produced and the requests results:

    ../_images/jmeter26.png

    The View Results Tree console with a sample request

    ../_images/jmeter27.png

    Another request with dissimilar resolution and bounding box

  3. Select Summary Report to view the statistical information about the requests:

    ../_images/jmeter28.png

    Suymmary report console