There are many tools that can do pressure measurement, ab, jmeter, and wrk is used here for pressure measurement
environment
One CLB instance (created on the Tencent Cloud platform),
four RS servers (the machine that provides web services at the backend, and the CVM cloud host is created on Tencent Cloud), and
two stress test clients (the CVM cloud host is created on Tencent Cloud)
The bandwidth of each host is 100Mbps
The CLB instance is as follows:
Four RS servers
Two pressure test clients
First, configure the four backend servers
The four servers are operated as follows, and the systems are all centos6.8 64-bit
yum install -y nginx
After installation, you need to modify the default.conf file, otherwise the nginx service cannot be started
vi /etc/nginx/conf.d/default.conf
#
# The default server
#
server {
listen 80; 监听端口为80
server_name www.example.com; 做虚拟主机
#listen [::]:80 default_server; 注释掉此行
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
Restart the nginx service
service nginx restart
Then do the following
/usr/share/nginx/html/ is the root directory of nginx Create the test directory
in this directory
mkdir test
vi index.html 测试界面
test01 测试界面内容
make sure you can access
The remaining three create test content in turn, namely test02, test03, and test04, using the same domain name www.example.com
This requires modifying the hosts file of the local computer to ensure that a single nginx can access it
2. Create a CLB binding host
CLB needs to configure listener management, as follows
Create http listener
After creating the listener, bind the above four hosts
At this time, write the corresponding relationship between CLB's vip and www.example.com to the hosts file of the local computer
140.143.51.59 www.example.com
Visit http://www.example.com/test/ on your local computer to ensure that you can rotate training
as follows
3. Configure two pressure test clients
Generally, the machine configuration of the pressure test side needs to be higher than the four CLB ones.
Both do the following
install wrk
https://github.com/wg/wrk/wiki/Installing-Wrk-on-Linux (installation documentation)
sudo yum groupinstall 'Development Tools'
sudo yum install -y openssl-devel git
git clone https://github.com/wg/wrk.git wrk #这一步会报错,解决如下yum update -y nss curl libcurl
cd wrk
make
# move the executable to somewhere in your PATH
sudo cp wrk /somewhere/in/your/PATH
After installing wrk, you need to write the hosts file on the stress test client
140.143.51.59(CLB的vip) www.example.com
Carry out pressure measurement, two at the same time
cd wrk
./wrk -t32 -c10000 -d30s http://www.example.com/test/
This runs a benchmark for 30 seconds, using 32 threads, and keeping 400 HTTP connections open.
The following are the parameters of wrk
-c, --connections: total number of HTTP connections to keep open with
each thread handling N = connections/threads
-d, --duration: duration of the test, e.g. 2s, 2m, 2h
-t, --threads: total number of threads to use
-s, --script: LuaJIT script, see SCRIPTING
-H, --header: HTTP header to add to request, e.g. "User-Agent: wrk"
--latency: print detailed latency statistics
--timeout: record a timeout if a response is not received within
this amount of time.
The output information is as follows
It can be seen that the throughput Requests/sec is 6w+, 109 of 1914744 requests are unsuccessful, the bandwidth of the host is 14.62MB*8=116.96Mbps, and the bandwidth is 100Mbps.
The parameter Non-2xx or 3xx responses cannot be greater than 200, otherwise need to retest