: This article describes the introduction, installation, and use of the website stress testing tool webbench. if you are interested in the PHP Tutorial, refer to it. I have been searching for an effective website stress testing article> website stress testing tool. After I tried webbench today, I feel very satisfied. I 'd like to share it with you.
1. Introduction to webshells
Webbench is a well-known website stress testing tool developed by Lionbridge Inc. (http://www.lionbridge.com. For help files and documents, go to www.webbench.com.
Webbech can test the performance of different services on the same hardware and the running status of the same service on different hardware. The standard webBech test shows two items of the server: the number of requests per second and the amount of data transmitted per second. Webbench can not only test quasi-static pages, but also test dynamic Pages (ASP, PHP, JAVA, CGI. In addition, it supports static or dynamic performance tests for secure websites with SSL, such as e-commerce websites.
2. install webbench
(1) how to install Ports in FreeBSD:
# Cd/usr/ports/benchmarks/Weblinks
# Make install clean
Remember to run the rehash command after the installation is successful and refresh the system command.
# Rehash
(2) RedHat/CentOS compilation and installation
Download installation package: wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
# Tar zxf webbench-1.5.tar.gz
# Cd webbench-1.5
# Make & make install
Or reference: http://blog.haohtml.com/index.php/archives/3234
3. use webshells
# Webbench -? (View command help)
Common parameter description.-c indicates the number of clients and-t indicates the time.
Test instance:
# Webbench-c 500-t 30 http: // 192.168.0.99/phpionfo. php
Test static images
# Webbench-c 500-t 30 http: // 192.168.0.99/test.jpg
IV. webbench test results
Www # website-c 500-t 30 http: // 192.168.0.99/phpionfo. php
Webbench-Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http: // 192.168.0.99/phpionfo. php
500 clients, running 30 sec.
Speed = 53726 pages/min, 160866 bytes/sec.
Requests: 26863 susceed, 0 failed.
5. webbench commands
Webbench [option]... URL
-F | -- force Don't wait for reply from server.
-R | -- reload Send reload request-Pragma: no-cache.
-T | -- time Run benchmark Seconds. Default 30.
-P | -- proxy Use proxy server for request.
-C | -- clients Run HTTP clients at once. Default one.
-9 | -- http09 Use HTTP/0.9 style requests.
-1 | -- http10 Use HTTP/1.0 protocol.
-2 | -- http11 Use HTTP/1.1 protocol.
-- Get Use GET request method.
-- Head Use HEAD request method.
-- Options Use OPTIONS request method.
-- Trace Use TRACE request method.
-? |-H | -- help This information.
-V | -- version Display program version.
Six examples (Nginx + php and Apache + php)
Note: When webbench performs stress testing, the software also consumes CPU and memory resources. to test the accuracy, install webbench on another server.
Test results: ###### Nginx + PHP #####
[Root @ localhost webbench-1.5] # webbench-c 100-t 30 http: // 192.168.1.21/phpinfo. php
Webbench-Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http: // 192.168.1.21/phpinfo. php
100 clients, running 30 sec.
Speed = 102450 pages/min, 16490596 bytes/sec.
Requests: 51225 susceed, 0 failed.
Top-14:06:13 up 27 days, 2 users, load average: 14.57, 9.89, 6.51
Task: 287 total, 4 running, 283 sleeping, 0 stopped, 0 zombie
Cpu (s): 49.9% us, 6.7% sy, 0.0% ni, 41.4% id, 1.1% wa, 0.1% hi, 0.8% si
Mem: 6230016 k total, 2959468 k used, 3270548 k free, 635992 k buffers
Swap: 2031608 k total, 3696 k used, 2027912 k free, 1231444 k cached
Test results: ###### Apache + PHP #####
[Root @ localhost webbench-1.5] # webbench-c 100-t 30 http: // 192.168.1.27/phpinfo. php
Webbench-Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http: // 192.168.1.27/phpinfo. php
100 clients, running 30 sec.
Speed = 42184 pages/min, 31512914 bytes/sec.
Requests: 21092 susceed, 0 failed.
Top-14:06:20 up 27 days, 2 users, load average: 62.15, 26.36, 13.42
Task: 318 total, 7 running, 310 sleeping, 0 stopped, 1 zombie
Cpu (s): 80.4% us, 10.6% sy, 0.0% ni, 7.9% id, 0.1% wa, 0.1% hi, 0.9% si
Mem: 6230016 k total, 3075948 k used, 3154068 k free, 379896 k buffers
Swap: 2031608 k total, 12592 k used, 2019016 k free, 1117868 k cached
We can see that the concurrency of the Nginx + php platform (51225) is larger than that of the Apache + php platform (21092.
Why is Nginx performance much higher than Apache? This is because Nginx uses the latest epoll (Linux 2.6 kernel) and kqueue (freebsd) network I/O models, while Apache uses the traditional select Model. Currently, Squid and Memcached, which can withstand high-concurrency access in Linux, use the epoll network I/O model.
The select network I/O model adopted by Apache is very inefficient in handling a large number of connections and reads and writes. The following uses a metaphor to parse the differences between the select model adopted by Apache and the epoll model adopted by Nginx:
Assume that you are studying in college and have many rooms in the dormitory. your friends will come to you. In the select version, the aunt will take your friends to the room until they find you. In epoll, Aunt Su Guan will first write down the room number of each student. when your friend comes, you only need to tell your friend which room you live in. you don't have to take your friend to the building to find someone. If there are 10000 people who want to stay in the same school in this building, the efficiency of the select and epoll versions is higher and self-evident. Similarly, in highly concurrent servers, polling I/O is one of the most time-consuming operations. The performance of select and epoll is also very clear.
From: http://blog.haohtml.com/archives/6144
The above introduces the introduction, installation, and use of the website stress testing tool webbench, including some content. I hope my friends who are interested in PHP tutorials can help me.