Gatling performance test


Gatling is a high-performance server performance testing tool developed based on Scala. It is also a powerful load testing tool. It is designed for ease of use, high maintainability and high performance. Out of the box, Gatling has become the preferred tool for load testing any HTTP server due to its excellent support for HTTP protocol. Official address: https://gatling.io/get-started/ .

Before using Gatling, you need to build a Java environment to ensure that the Java environment has been built. The download address is: https://gatling.io/open-source/ , after the download is successful, unzip it. The directory information is:

Next, configure the environment. The configured information is as follows:

#Gatling
export GATLING_HOME=/Applications/devOps/tools/gatling
export PATH=$PATH:$GATLING_HOME/bin

After successfully configuring environment variables, enter:

recorder.sh

Press enter to display the GUI interface of Gatling, as follows:

Gatling actual combat

The following is an official case to demonstrate the basic use of Gatling. Execute and enter the following commands on the console:

gatling.sh
#After entering the above command, the following information is displayed
GATLING_HOME is set to /Applications/devOps/tools/gatling
Choose a simulation number:
[0] computerdatabase.BasicSimulation
[1] computerdatabase.advanced.AdvancedSimulationStep01
[2] computerdatabase.advanced.AdvancedSimulationStep02
[3] computerdatabase.advanced.AdvancedSimulationStep03
[4] computerdatabase.advanced.AdvancedSimulationStep04
[5] computerdatabase.advanced.AdvancedSimulationStep05
#Enter 0 on the console to display the entered information and finally the result information of the test report. The specific process is as follows
0
Select run description (optional)

Simulation computerdatabase.BasicSimulation started...

Generating reports...

================================================================================
---- Global Information --------------------------------------------------------
> request count                                         13 (OK=13     KO=0     )
> min response time                                    241 (OK=241    KO=-     )
> max response time                                   1478 (OK=1478   KO=-     )
> mean response time                                   458 (OK=458    KO=-     )
> std deviation                                        339 (OK=339    KO=-     )
> response time 50th percentile                        301 (OK=301    KO=-     )
> response time 75th percentile                        527 (OK=527    KO=-     )
> response time 95th percentile                       1100 (OK=1100   KO=-     )
> response time 99th percentile                       1402 (OK=1402   KO=-     )
> mean requests/sec                                  0.448 (OK=0.448  KO=-     )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms                                            11 ( 85%)
> 800 ms < t < 1200 ms                                   1 (  8%)
> t > 1200 ms                                            1 (  8%)
> failed                                                 0 (  0%)
================================================================================

Reports generated in 0s.
Please open the following file: /Applications/devOps/tools/gatling/results/basicsimulation-20211101134633997/index.html

Open the final HT ML test report, and the detailed performance test result data and corresponding index data will be displayed, as shown below:

To test the performance of the login service, you need to write specific test scripts. Specifically, you need to write case code in the directory of gathering / user files / simulations / computerdatabase. The specific code is written in Scala language. The source code is as follows:

After the code is written successfully, execute gatling.sh again, as shown below:

Select 1 to start execution. The following is the execution result information. The specific results are as follows:

Combined with the above cases, we can see that the Gatling test tool has a high load on the server, which is more suitable for verifying the queue mechanism of the service and the response mechanism and carrying capacity of the service under the microservice architecture. Thank you for reading. We will continue to introduce the case application of the tool to the server in the future.

The following is the supporting information. For the friends doing [software testing], it should be the most comprehensive and complete war preparation warehouse. This warehouse has also accompanied me through the most difficult journey. I hope it can also help you!

Finally, it can be in the official account: the sad spicy bar! Get a 216 page interview document of Software Test Engineer for free. And the corresponding video learning tutorials for free!, It includes basic knowledge, Linux essentials, Shell, Internet program principles, Mysql database, special topics of packet capture tools, interface test tools, test advanced Python programming, Web automation test, APP automation test, interface automation test, advanced continuous test integration, test architecture, development test framework, performance test, security test, etc.

Don't fight alone in learning. It's best to stay together and grow together. The effect of mass effect is very powerful. If we study together and punch in together, we will have more motivation to learn and stick to it. You can join our testing technology exchange group: 914172719 (there are various software testing resources and technical discussions)

Friends who like software testing, if my blog is helpful to you and if you like my blog content, please click "like", "comment" and "collect" for three times!

Haowen recommendation

Job transfer interview, job hopping interview, these interview skills that software testers must know!

Interview experience: move bricks in first tier cities! Another software testing post, 5000 will be satisfied

Interviewer: I've worked for three years and have a preliminary test? I'm afraid your title of software test engineer should be enclosed in double quotation marks

What kind of person is suitable for software testing?

The man who left work on time was promoted before me

The test post changed jobs repeatedly and disappeared

Tags: Python Programmer unit testing software testing IT

Posted on Mon, 01 Nov 2021 10:30:35 -0400 by raptoni