search
HomeBackend DevelopmentPHP TutorialIntroduction, installation and use of website stress testing tool webbench

I have been looking for an effective website stress testing article "> website stress testing tool. After trying webbench today, I feel very satisfied, and I would like to share it with you. 1. Introduction to webbenchWebbench is a famous website stress testing tool, which was developed by Lionbridge Company (http://www.lionbridge.com). Its help files and documentation can be viewed at: 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. webBech's standard test can show us two things about the server: the number of corresponding requests per second and the amount of data transferred per second. Webbench not only has the ability to test static pages, but also has the ability to test dynamic pages (ASP, PHP, JAVA, CGI). In addition, it supports static or dynamic performance testing of secure websites containing SSL, such as e-commerce websites.
2. Webbench installation (1) Installation method using Ports under FreeBSD:

#cd /usr/ports/benchmarks/webbench
#make install clean

Remember to run it after the installation is successful rehash command, refresh the system command

#rehash

(2) Compilation and installation under RedHat/CentOSDownload the 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 refer to: http://blog.haohtml.com/index. php/archives/32343. Using webbench

#webbench -? (View command help)

Common parameter description, -c represents the number of clients, -t represents timeTest example:

#webbench -c 500  -t  30   http://192.168.0.99/phpionfo.php

测试静态图片

#webbench -c 500  -t  30   http://192.168.0.99/test.jpg

四、webbench测试结果

www# webbench -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.

五、webbench命令

webbench [option]... URL

-f|--force               Don't wait for reply from server.

-r|--reload              Send reload request - Pragma: no-cache.

-t|--time          Run benchmark for 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.

六 实例演示(Nginx+php和Apache+php)注意:webbench 做压力测试时,该软件自身也会消耗CPU和内存资源,为了测试准确,请将 webbench 安装在别的服务器上。测试结果:##### Nginx + PHP #####

[root@localhost webbench-1.5]# webbench -c 100 -t 30http://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:25,  2 users,  load average: 14.57, 9.89, 6.51
Tasks: 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:   6230016k total,  2959468k used,  3270548k free,   635992k buffers
Swap:  2031608k total,     3696k used,  2027912k free,  1231444k cached


测试结果:#####  Apache + PHP #####

[root@localhost webbench-1.5]# webbench -c 100 -t 30http://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:13,  2 users,  load average: 62.15, 26.36, 13.42
Tasks: 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:   6230016k total,  3075948k used,  3154068k free,   379896k buffers
Swap:  2031608k total,    12592k used,  2019016k free,  1117868k cached

可以看出Nginx+php平台的并发量(51225)要比Apache+php平台的并发量(21092)要大的.为什么Nginx的性能要比Apache高得多?这得益于Nginx使用了最新的epoll(Linux 2.6内核)和kqueue(freebsd)网络I/O模型,而Apache则使用的是传统的select模型。目前Linux下能够承受高并发访问的 Squid、Memcached都采用的是epoll网络I/O模型。处理大量的连接的读写,Apache所采用的select网络I/O模型非常低效。下面用一个比喻来解析Apache采用的select模型和Nginx采用的epoll模型进行之间的区别:Suppose you are studying in college and live in a dormitory with many rooms, and your friends want to come to you. In the select version, the hostess will take your friends to look for you from room to room until they find you. In the epoll version, the dormitory aunt 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. There is no need to take your friend around the building to find someone. If 10,000 people come and want to find their classmates who live in this building, it is self-evident which one is more efficient, the select version or the epoll version of the dormitory aunt. Similarly, in high-concurrency servers, polling I/O is one of the most time-consuming operations. It is also very clear which performance is higher between select and epoll.
From: http://blog.haohtml.com/archives/6144

The above has introduced the introduction, installation and use of the website stress testing tool webbench, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What data can be stored in a PHP session?What data can be stored in a PHP session?May 02, 2025 am 12:17 AM

PHPsessionscanstorestrings,numbers,arrays,andobjects.1.Strings:textdatalikeusernames.2.Numbers:integersorfloatsforcounters.3.Arrays:listslikeshoppingcarts.4.Objects:complexstructuresthatareserialized.

How do you start a PHP session?How do you start a PHP session?May 02, 2025 am 12:16 AM

TostartaPHPsession,usesession_start()atthescript'sbeginning.1)Placeitbeforeanyoutputtosetthesessioncookie.2)Usesessionsforuserdatalikeloginstatusorshoppingcarts.3)RegeneratesessionIDstopreventfixationattacks.4)Considerusingadatabaseforsessionstoragei

What is session regeneration, and how does it improve security?What is session regeneration, and how does it improve security?May 02, 2025 am 12:15 AM

Session regeneration refers to generating a new session ID and invalidating the old ID when the user performs sensitive operations in case of session fixed attacks. The implementation steps include: 1. Detect sensitive operations, 2. Generate new session ID, 3. Destroy old session ID, 4. Update user-side session information.

What are some performance considerations when using PHP sessions?What are some performance considerations when using PHP sessions?May 02, 2025 am 12:11 AM

PHP sessions have a significant impact on application performance. Optimization methods include: 1. Use a database to store session data to improve response speed; 2. Reduce the use of session data and only store necessary information; 3. Use a non-blocking session processor to improve concurrency capabilities; 4. Adjust the session expiration time to balance user experience and server burden; 5. Use persistent sessions to reduce the number of data read and write times.

How do PHP sessions differ from cookies?How do PHP sessions differ from cookies?May 02, 2025 am 12:03 AM

PHPsessionsareserver-side,whilecookiesareclient-side.1)Sessionsstoredataontheserver,aremoresecure,andhandlelargerdata.2)Cookiesstoredataontheclient,arelesssecure,andlimitedinsize.Usesessionsforsensitivedataandcookiesfornon-sensitive,client-sidedata.

How does PHP identify a user's session?How does PHP identify a user's session?May 01, 2025 am 12:23 AM

PHPidentifiesauser'ssessionusingsessioncookiesandsessionIDs.1)Whensession_start()iscalled,PHPgeneratesauniquesessionIDstoredinacookienamedPHPSESSIDontheuser'sbrowser.2)ThisIDallowsPHPtoretrievesessiondatafromtheserver.

What are some best practices for securing PHP sessions?What are some best practices for securing PHP sessions?May 01, 2025 am 12:22 AM

The security of PHP sessions can be achieved through the following measures: 1. Use session_regenerate_id() to regenerate the session ID when the user logs in or is an important operation. 2. Encrypt the transmission session ID through the HTTPS protocol. 3. Use session_save_path() to specify the secure directory to store session data and set permissions correctly.

Where are PHP session files stored by default?Where are PHP session files stored by default?May 01, 2025 am 12:15 AM

PHPsessionfilesarestoredinthedirectoryspecifiedbysession.save_path,typically/tmponUnix-likesystemsorC:\Windows\TemponWindows.Tocustomizethis:1)Usesession_save_path()tosetacustomdirectory,ensuringit'swritable;2)Verifythecustomdirectoryexistsandiswrita

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.