Objective
API performance testing is an important part of enterprise-level development, and the API performance test individual summarizes two points of concern:
- Whether the API will generate data anomalies in the concurrency, such as the overbought oversold system of the second kill
- Qps/tps in the API limit case
At present, the more popular performance testing tools are Loaderrunner, Apache Bench, JMeter, etc., the individual for the three performance testing tools are used, the feeling is:
- Loaderrunner is the most powerful, all kinds of reports after the stress test have everything, but the commercial version of the time is longer and more troublesome, there is a certain cost of learning, to get started with proficiency need a certain time
- JMeter is relatively simple and provides a graphical interface, but I feel that swing does not have a very comfortable graphical interface, the flexibility is generally not particularly prominent place
- Apache Bench uses the command line to make the request, the command line the entire parameter setting is also more flexible, simulating hundreds of thousands of concurrent memory footprint, the disadvantage is that there is no graphical tool to generate test reports, need to manually draw
After comparison, I personally still choose to use Apache Bench for stress testing, two articles write Apache Bench, an installation, a use, this article said the Apache Bench installation.
Installation of Apache Bench in Windows environment
My own computer is a Windows environment, so tell me how to install Apache Bench in a Windows environment. Apache Bench itself is not separate, it is an Apache server comes with a tool, so install Apache Bench, in fact we should download the installation of an Apache server .
First go to Apache server's official website, left column click Download:
Find the download link for the Windows version:
Locate the "Downloading Apache for Windows" section and click Apachehaus:
Go to the download page, the download link is a bit cryptic, I also through the developer tool, only found two small icons here are <a> tags:
Around two can be used, the left one from the Apachehaus, the right is the German Apache bench image, I click here to download the left, download complete decompression:
To facilitate our use of the Apache Bench-related commands in the Apache24/bin directory, configure the environment variables, my path is "D:\Software\Apache Bench\apache24\bin".
Finally, open the command line and execute "httpd-k install" to turn Apache into a Windows backend service.
Verify that Apache bench is available
Finally we simply verify that Apache bench is available, open the command line and execute "ab-n http://www.baidu.com":
Seeing this output means that Apache bench is available, here we use the AB command to access the HTTP request and should use ABSif we want to access HTTPS requests.
Use Apache bench for stress Testing (Installation article)