1. Introduction about Jmeter
Jmeter is a tool to measure the load and performance of objects, can be used for test performance on both static and dynamic sources, can check the load and performance on many different server types such as Web – HTTP, HTTPS, SOAP, Database via JDBC, LDAP, JMS, Mail – SMTP (S), POP3 (S) and IMAP (S) … Jmeter is an open source written in java. JMeter’s father is Stefano Mazzocchi then Apache has redesigned to improve the graphical user interface and functional-oriented testing capabilities. Jmeter characteristics:
- Open source, free
- Simple, intuitive interface easy to use
- Can test multiple server types: Web – HTTP, HTTPS, SOAP, Database – JDBC, LDAP, JMS, Mail – POP3, …
- A standalone tool that can run on many different operating system platforms, on Linux just run with a scrip shell, on Windows, just run a .bat file
- Multithreading, which helps create multiple requests at the same time, effectively processing the data obtained.
- Extended feature, there are many plugins that are widely divided and free
- An automated tool to test application performance and features. How it works: it emulates a group of users who send requests to a server, receives and processes responses from the server and presents those results to users in the form of tables, graphs, trees … Benefits of jmeter for performance testing:
- Jemeter can detect a large number of users at the same time that the website can handle.
- Jmeter can provide the majority of graphical analysis of performance reports.
- JMeter Performance Testing includes: Load testing: Modeling is expected to be used by many users accessing a website service at the same time. Ress Stress testing: All web servers can load a large capacity, when the load is beyond the limit, the web server starts to respond slowly and causes an error. The purpose of stress testing is to be able to find the large load that the web server can handle.
2. Create test script with Jmeter
After successfully running Jmeter, create a new test script, and here I named Test_Tour:
Figure 1: Illustration of creating a new script with jmeter
Step 1: Simulate many users to access the website simultaneously: Right-click Test Plan -> Add -> Threads (users) -> Thread Group Figure 2: Illustration of creating a new Thread Group in jmeter
Name: Name the ThreadGroup (here you can set Thread Group Tour).
Number of Threads (users): the number of users we want to simulate.
Ramp-up Period (in seconds): Indicates the time for JMeter to create all the necessary threads. For example, if this parameter is 10, within 10 seconds all of the Number of Threads mentioned above will be sent in 10 seconds, if this parameter is set to 0, all requests will be sent with the same at.
Loop Count Forever: 1 created thread will execute 1 time (replace 1 with n, the number of threads will repeat n times).
Step 2: Create Requests to the server: 1 thread (corresponding to a user) can create multiple http requests sent to the server. Right-click Thread group -> add -> sample -> http request Default Figure 3: Illustrating creating http request Default
Name: Name Request
Server name of IP: Enter the Domain or IP of the website you are testing
Port Number: Specify the port of the web, if left blank, default will be 80
Protocol: The protocol used is HTTP or HTTPs
Method: Method for HTTP requests. methods: GET, POST, HEAD, PUSH ..
Path: Paths of resources to handle requests
Parameter: Represents the list of parameters for sending the same request. (can add or remove this parameter)
Send files with the request: Simulate file uploading
Retrieve All embedded Resources: Used to download java applet pages embedded on the test site.
Step 3: Run and view the results of running requests Can add the display results to listener: Right-click on Thread Group -> add -> Listener
Figure 4: An illustration of the type of display in jmeter running results
Click run to run the test script:
Figure 5: Illustrating running a test script on jmeter
The running results will show the types depending on the display options, such as the following graphics:
Figure 6: Displaying the tree test results on jmeter
Figure 7: Display of summarized test results on jmeter
Analysis of parameters
The parameters are as follows:
- Label : Displays the name of each request in the test plan
- #Samples : Total number of shakes of the request
Samples = Number of Thread (users) * Loop Count
- Average (millisecond) : Request response time, calculated until the last run.
- Median (millisecond) : 50% of requests have a response time smaller than the value (displayed on the table), and 50% of the remaining requests have a larger response time than this value.
- 90% Line (90th Percentile) (millisecond) : 90% of requests will have a response time smaller than the value displayed in the table, 10% of the remaining requests will have a response time greater than the displayed value in the table.
- Min (millisecond) : The lowest Respone Time of the request is calculated for all run times.
- Max (millisecond) : The highest Respone Time of the request is calculated for all run times.
- Error% :% number of requests failed, error.
- Throughput / Throughput : The amount of requests processed by the system (server) in 1 time unit, can be seconds, minutes, or hours. Avg. Bytes: the average size of a response in bytes.
- Std.Dev. (Standard Deviation) : standard deviation that measures the change of a data set, based on statistics.
- Total : In the last report there is Total, it will summarize all results from the above requests. Except: Parameter analysis:
Response LOW TIME and LOW LOW Thoughput -> This case will never happen. Because LOW Response Time means the response time is very fast, but LOW Throughput indicates that the number of requests is handled very little. This is ridiculous
Response Time LOW and HIGH Throughput -> This is an ideal result. The processing time is low and the number of requests processed at the same time is high. This proves that Server is very good.
Response Time HIGH and Low Throughput -> Test indicates that the processing time is too high, and the amount of processed requests is very low. Must consider to improve on the sever.
High Response Time and Throughput -> High Throughput, ie the server is working very well, so why the processing time is also high (not good). It may be a problem at the moment from the Client side, or specifically from JMeter, maybe your script is not optimized, making the process take a lot of time, for example.