Hello, I’m the code farmer Fei brother , I’ve always wanted to fly, and I’m running that old man for the time being.
Areas of expertise: Java high-concurrency programming, MySQL database The
focus of this article: record various commands for viewing logs in daily work.
It is full of dry goods, it is recommended to collect it, and you need to check it often. Friends who have questions and needs, welcome to leave a message~~~.
- Introduction to core components
- Thread group
- Http request
- HTTP header manager
- View the result tree
- Aggregate report
- Fixed timer
- to sum up
I’m Coder Fei, thank you for reading. As we all know, Jmeter is a powerful tool for pressure measurement interface. There are many components, which can cope with pressure testing requirements in various scenarios. Let us get to know this weapon below.
Introduction to core components
|Component name||Component role||How to add components|
|Thread group||All test plans are based on thread groups|
|HTTP request||Used to set the requested interface address and input parameters|
|HTTP header manager||Used for HTTP request interface to set the request header|
|View the result tree||Viewing the result tree will print the status of each request|
|Aggregate report||The aggregate report shows the number of all requests, the average response time of all requests, and the response time of 90% of the requests|
|Fixed timer||Used to set the time interval for each thread request|
All thread settings are in the thread group, you can think of the thread group as a thread pool.
Name: It is the personalized name of the
thread group. Several important attributes in the thread group:
- Number of threads: how many threads are set to execute the test, the threads here can be imagined as virtual users
- Ramp-up Period (in Seconds): Preparation time, that is, how long it takes to start all threads, the default is 0, in the above figure, it means that 5 threads are started at the same time. If it is set to 5, it means to start 5 threads within 5 seconds, and start one every second.
- Number of cycles: Forever, it means to call the interface in a continuous loop within the duration of the scheduler. The setting here is 3 times, which means that each thread executes 3 times in a loop.
- Duration (seconds): indicates the duration of the pressure test
- Start-up delay (seconds): indicates how long to start the test
The basic settings of Http request are shown in the figure above:
- Protocol: can be set to http or https
- Server name or IP: If it is a domain name, set the domain name directly, otherwise set the ip address.
- Port number: only needed for IP access.
- Method: here are mainly GET and POST two request methods
- Path: It is the address of the interface.
The box below is to set the request parameters
- If it is a form submission, set the parameters in Parameters
- If the content-type is application/json type, set the request parameters in Body Data
- If it is a multipart/form-data type, you need to set the parameters in Files upload.
HTTP header manager
Here, as the name suggests, is to set the HTTP request header information. You can set content-type and other information.
View the result tree
Viewing the result tree is also a very important component. This component mainly displays all HTTP requests. Of course, we can check Log errors only to display all wrong HTTP requests. Checking Successes will only show all successful requests. You can also persist the result of the request to a file.
The aggregate report is a very important component. Through this component, we can know the results of the stress test as a whole. There are multiple lines in the list. I will explain the attributes of each line one by one:
- Samples: The total number of requests. There are 15 requests in total, and 5 threads loop 3 times.
- Average: Average response time, this indicator counts the average response time for all requests.
- Median: Median response time, this indicator counts the median response time.
4. 90% Line: The average response time of 90% of requests. This is an important indicator of interface performance.
- 99% Line: The average response time of 99% of requests, this indicator is similar to the Average indicator
- Min: The fastest response time is the time taken to respond to the fastest request.
- Max: The slowest response time is the time it takes to respond to the slowest request.
7. Error %: the proportion of wrong requests
- Throughput: the throughput of the interface
- Recevied KB/sec: The amount of received data per second
- Sent KB/sec: The amount of data sent per second
This timer is mainly used to set the time interval of each thread loop. The 5000 milliseconds here means that each thread will wait 5 seconds before requesting the interface again.
to sum up
This article makes a brief summary of the use of Jmeter, and introduces the commonly used components needed to stress test an HTTP interface. Proficiency in using these components can easily cope with pressure testing requirements. The order of the pressure test settings is set to the thread group -> set HTTP request -> set HTTP request header -> set aggregate report -> set to view the result tree.