In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Before testing the ab stress, let's explain the related concepts: throughput (Requests per second).
A quantitative description of the concurrent processing capacity of a server, in reqs/s, which refers to the number of requests processed per unit time under a certain number of concurrent users. The maximum number of requests that can be processed per unit time under a certain number of concurrent users is called maximum throughput.
Calculation formula:
Total number of requests / time taken to process the number of requests completed, that is,
Request per second = Complete requests / Time taken for tests
Concurrent connections (The number of concurrent connections)
The number of requests accepted by the server at a time is, in short, a session.
Number of concurrent users (The number of concurrent users,Concurrency Level)
Pay attention to the difference between this concept and the number of concurrent connections. A user may have multiple sessions at the same time, that is, the number of connections.
The formula for calculating the average request waiting time (Time per request) for users:
The time it took to process all requests / (total requests / concurrent users), that is
Time per request = Time taken for tests / (Complete requests / Concurrency Level)
The average request wait time of the server (Time per request: across all concurrent requests) is calculated as follows:
The time / total number of requests spent processing all requests completed, that is,
Time taken for / testsComplete requests
As you can see, it is the reciprocal of throughput.
At the same time, it also = the average user request waiting time / the number of concurrent users, that is
Time per request / Concurrency Level
Ab stress testing tool
Apache has its own stress testing tool ab, which is easy to use and can simulate various conditions to initiate test requests to the Web server.
The ab tool can initiate test requests directly local to the Web server, which is very important to understand the processing performance of the server, because it does not include the network transmission time of the data and the local computing time of the user PC, so that the performance of the Web server can be judged by observing various time indicators in order to optimize the parameters.
In the process of performance tuning and optimization, the ab stress test tool can be used to test the optimization effect. Use the ab stress test tool to optimize the process.
Use ab tool for stress test before optimization
After optimization, restart the service, and then use ab for stress testing
Compare the results of the two tests to see whether the optimization effect is obvious.
In order to evaluate the performance of web service more objectively, many tests should be carried out before and after optimization, and the average value of the test results is compared. The command format for using the ab tool:
Ab [options] website URL
Common parameter:-n: total number of requests executed-c: number of concurrency-t: total time to execute the test in seconds-v: how much troubleshooting information to print-V: display the version number and exit the manual compilation and installation of the Apache service:
(1) install the DNS service package bind.
[root@localhost ~] # yum install bind-y.mp / omit the installation process [root@localhost ~] #
(2) modify the main configuration file of the DNS service.
[root@localhost ~] # vim / etc/named.confoptions {listen-on port 53 {any;}; / / 127.0.0.1 change to any listen-on-v6 port 53 {:: 1;}; directory "/ var/named"; dump-file "/ var/named/data/cache_dump.db" Statistics-file "/ var/named/data/named_stats.txt"; memstatistics-file "/ var/named/data/named_mem_stats.txt"; recursing-file "/ var/named/data/named.recursing"; secroots-file "/ var/named/data/named.secroots"; allow-query {any;}; / / localhost changed to any
(3) modify the regional configuration file of the DNS service.
[root@localhost ~] # vim / etc/named.rfc1912.zoneszone "abc.com" IN {/ / add a domain name information type master; file "abc.com.zone"; allow-update {none;};}
(4) check the IP address.
[root@localhost named] # ifconfig ens33: flags=4163 mtu 1500 inet 192.168.52.133 netmask 255.255.255.0 broadcast 192.168.52.255 inet6 fe80::3e1d:31ba:f66a:6f80 prefixlen 64 scopeid 0x20 ether 00:0c:29:27:1c:3f txqueuelen 1000 (Ethernet) RX packets 14532 bytes 20210558 (19.2 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 6054 bytes 399142 (389.7 KiB ) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
(5) reserve the right to copy a regional data configuration file of the DNS service and modify it.
[root@localhost ~] # cd / var/named/ change the directory [root@localhost named] # ls / / View data dynamic named.ca named.empty named.localhost named.loopback slaves [root@localhost named] # cp-p named.localhost abc.com.zone / / copy [root@localhost named] # vim abc.com.zone $TTL 1D @ IN SOA @ rname.invalid. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS @ A 127.0.0.1www IN A 192.168.52.133 / / Domain name resolution by adding IPv4
(6) start the named service.
[root@localhost named] # systemctl start named / / enable the service [root@localhost named] # systemctl stop firewalld.service / / turn off the firewall [root@localhost named] # setenforce 0 / / disable the enhanced security feature [root@localhost named] #
(7) share the toolkits we need at the host.
(8) Mount the toolkit to the Linux system through the Samba service.
[root@localhost ~] # smbclient-L / / 192.168.100.50 / / View share Enter SAMBA\ root's password: / / Anonymous share, no password Direct enter OS= [Windows 10 Enterprise LTSC 2019 17763] Server= [Windows 10 Enterprise LTSC 2019) Sharename Type Comment-IPC$ IPC remote IPC share Disk tools Disk Users Disk Connection to 192.168.100.50 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND) NetBIOS over TCP disabled-- no workgroup available [root@localhost ~] # mkdir / mnt/tools/ / create a mount directory [root@localhost ~] # mount.cifs / / 192.168.100.50/tools / mnt/tools/ mount Password for root@//192.168.100.50/tools: [root@localhost ~] # cd / mnt/tools/ enter the mount directory [root @ localhost tools] # ls / / View awstats-7.6.tar.gz extundelete-0.2.4.tar.bz2 forbid.png jdk-8u191-windows-x64.zip LAMP-C7cronolog-1.6.2-14.el7.x86_64.rpm fiddler.exe intellijideau2018.rar john-1.8.0.tar.gz picture.jpg [root@localhost tools] #
(9) unpack the source code compilation and installation of the Apache service to the "/ opt/" directory.
[root@localhost tools] # cd LAMP-C7/ switch directory [root@localhost LAMP-C7] # lsapr-1.6.2.tar.gz Discuz_X2.5_SC_UTF8.zip LAMP-php5.6.txt php-5.6.11.tar.bz2apr-util-1.6.0.tar.gz httpd-2.4.29.tar.bz2 mysql-5.6.26.tar.gz [root@localhost LAMP-C7] # tar jxvf httpd-2.4.29.tar.bz2-C / opt/ decompress. / / omit decompression details [root@localhost LAMP-C7] # tar zxvf apr-1.6.2.tar.gz-C / opt/ decompression. / / omit decompression details [root@localhost LAMP-C7] # tar zxvf apr-util-1.6.0.tar.gz-C / opt/ / / decompress. / / omit the decompression details
(10) go to the "/ opt/" directory, move the two apr packages to the "httpd-2.4.29/srclib/" directory, and rename them.
[root@localhost LAMP-C7] # cd / opt/ [root@localhost opt] # lsapr-1.6.2 apr-util-1.6.0 httpd-2.4.29 rh [root@localhost opt] # mv apr-1.6.2/ httpd-2.4.29/srclib/apr [root@localhost opt] # mv apr-util-1.6.0/ httpd-2.4.29/srclib/apr-util
(11) go to the "httpd-2.4.29/" directory and install the environment package required for compilation.
[root@localhost opt] # lshttpd-2.4.29 rh [root@localhost opt] # cd httpd-2.4.29/ [root@localhost httpd-2.4.29] # lsABOUT_APACHE ap.d CHANGES docs httpd.spec libhttpd.dep Makefile.win README srclibacinclude.m4 build CMakeLists.txt emacs-style include libhttpd.dsp modules README.cmake supportApache-apr2 .dsw BuildAll.dsp config.layout httpd.dep INSTALL libhttpd.mak NOTICE README.platforms testApache.dsw BuildBin.dsp configure httpd.dsp InstallBin.dsp LICENSE NWGNUmakefile ROADMAP VERSIONINGapache_probes.d buildconf configure.in httpd.mak LAYOUT Makefile.in os server [root@localhost httpd-2.4.29] # [root@localhost httpd-2.4.29] # Yum-y install\ > gcc\ > gcc-c++\ > make\ > pcre\ > pcre-devel\ > expat-devel\ > zlib-devel\ > perl.// omits the installation process
(12) configure the Apache server.
[root@localhost httpd-2.4.29] #. / configure\ >-- prefix=/usr/local/httpd\ / / installation path >-- enable-so\ / / enable dynamic loading module support >-- enable-rewrite\ / / enable web address rewriting function >-- enable-charset-lite\ / / enable character set support >-- enable-cgi / / enable CGI script program support
(13) compile and install the Apache service.
[root@localhost httpd-2.4.29] # make & & make install.// omits the compilation and installation process [root@localhost httpd-2.4.29] #
(14) modify the Apache service configuration file
[root@localhost httpd-2.4.29] # ln-s / usr/local/httpd/conf/httpd.conf / etc/httpd.conf / / create a soft link Easy to use [root@localhost httpd-2.4.29] # Listen 192.168.50.133 Listen 80 / / enable IPv4 snooping # Listen 80 / / comment IPv6 snooping # ServerName www.abc.com:80 / / set domain name ab stress test [root@localhost named] # ab-n 3000-c 1000 www.abc.com/index.htmlThis is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation Http://www.apache.org/Benchmarking www.abc.com (be patient) Completed 300 requestsCompleted 600 requestsCompleted 900 requestsCompleted 1200 requestsCompleted 1500 requestsCompleted 1800 requestsCompleted 2100 requestsCompleted 2400 requestsCompleted 2700 requestsCompleted 3000 requestsFinished 3000 requestsServer Software: Apache/2.4.29 / / http response data header information Server Hostname: www.abc.com / / host name Server Port: 80 in the requested url / / web server software listening port Document Path: / index.html / / absolute path of the requested url root Document Length: 45 bytes / / http response data body length Concurrency Level: 1000 / / number of concurrent users Time taken for tests: 21.061 seconds / / The total time it took for all these requests to be processed Complete requests: 3000 / / indicates the total number of requests Failed requests: 220 / / the total number of failed requests (Connect: 0 Receive: 0, Length: 220, Exceptions: 0) Total transferred: 810356 bytes / / Total response data length for requests HTML transferred: 126180 bytesRequests per second: 142.44 [# / sec] (mean) / / server throughput Total number of requests processed per second Time per request: 7020.414 [ms] (mean) / / average request waiting time Time per request: 7.020 [ms] (mean) Across all concurrent requests) / / average actual elapsed time per request Transfer rate: 37.57 [Kbytes/sec] receivedConnection Times (ms) min mean [+ /-sd] median maxConnect: 0 9 14.54 4 62Processing: 9 1389 5135.1 27 21027Waiting: 027 34.4 22 234Total: 13 1398 5132.8 33 21027Percentage of the requests served within a certain time (ms) / / describes the distribution of processing time for each request. 50% 33 66% 37 75% 42 80% 55 90% 95 95% 21020 98% 21027 99% 21027 21027 21027 (longest request) [root@localhost named] # parameters describe the header information of Server Softwarehttp response data hostname in url of Server Hostname request Server Portweb server software listening port Document Path request url root absolute path Document Lengthhttp response data body length Concurrency Level concurrent user Number of Time taken for tests the total time it took for all these requests to be processed Complete requests represents the total number of requests Failed requests failed requests total response data length of Total transferred requests and Requests per second server throughput Number of requests processed per second Time per request average request wait time Time per request average actual elapsed time per request Percentage of the requests served within a certain time (ms) describes the distribution of processing time per request
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.