日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Web 压力测试

發(fā)布時(shí)間:2023/12/10 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Web 压力测试 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Apache Bench

ApacheBench 是 Apache 服務(wù)器自帶的一個(gè)web壓力測(cè)試工具,簡(jiǎn)稱ab。ab又是一個(gè)命令行工具,對(duì)發(fā)起負(fù)載的本機(jī)要求很低,根據(jù)ab命令可以創(chuàng)建很多的并發(fā)訪問(wèn)線程,模擬多個(gè)訪問(wèn)者同時(shí)對(duì)某一URL地址進(jìn)行訪問(wèn),因此可以用來(lái)測(cè)試目標(biāo)服務(wù)器的負(fù)載壓力。總的來(lái)說(shuō)ab工具小巧簡(jiǎn)單,上手學(xué)習(xí)較快,可以提供需要的基本性能指標(biāo),但是沒(méi)有圖形化結(jié)果,不能監(jiān)控。

點(diǎn)擊這里下載。

解壓后在httpd-2.4.39-win64-VC15\Apache24\bin文件夾下可以看到ab.exe。
即可以通過(guò)設(shè)置環(huán)境變量,也可以通過(guò)命令行直接進(jìn)入該文件夾,調(diào)用ab命令。

Usage: ab [options] [http://]hostname[:port]/path Options are:-n requests Number of requests to perform-c concurrency Number of multiple requests to make at a time-t timelimit Seconds to max. to spend on benchmarkingThis implies -n 50000-s timeout Seconds to max. wait for each responseDefault is 30 seconds-b windowsize Size of TCP send/receive buffer, in bytes-B address Address to bind to when making outgoing connections-p postfile File containing data to POST. Remember also to set -T-u putfile File containing data to PUT. Remember also to set -T-T content-type Content-type header to use for POST/PUT data, eg.'application/x-www-form-urlencoded'Default is 'text/plain'-v verbosity How much troubleshooting info to print-w Print out results in HTML tables-i Use HEAD instead of GET-x attributes String to insert as table attributes-y attributes String to insert as tr attributes-z attributes String to insert as td or th attributes-C attribute Add cookie, eg. 'Apache=1234'. (repeatable)-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'Inserted after all normal header lines. (repeatable)-A attribute Add Basic WWW Authentication, the attributesare a colon separated username and password.-P attribute Add Basic Proxy Authentication, the attributesare a colon separated username and password.-X proxy:port Proxyserver and port number to use-V Print version number and exit-k Use HTTP KeepAlive feature-d Do not show percentiles served table.-S Do not show confidence estimators and warnings.-q Do not show progress when doing more than 150 requests-l Accept variable document length (use this for dynamic pages)-g filename Output collected data to gnuplot format file.-e filename Output CSV file with percentages served-r Don't exit on socket receive errors.-m method Method name-h Display usage information (this message)

例如,我們測(cè)試 http://192.168.1.106:8080/ 可以用以下命令。

C:\Users\nukix\Desktop\httpd-2.4.39-win64-VC15\Apache24\bin>ab -c 5000 -n 5000 http://192.168.1.106:8080/ This is ApacheBench, Version 2.3 <$Revision: 1843412 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking 192.168.1.106 (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requestsServer Software: Server Hostname: 192.168.1.106 Server Port: 8080# 測(cè)試界面 Document Path: / # 界面大小 Document Length: 11184 bytes# 測(cè)試的并發(fā)數(shù) Concurrency Level: 5000 # 整個(gè)測(cè)試持續(xù)的時(shí)間 Time taken for tests: 45.928 seconds # 完成的請(qǐng)求數(shù)量 Complete requests: 5000 # 失敗的請(qǐng)求數(shù)量 Failed requests: 0 # 整個(gè)過(guò)程中的網(wǎng)絡(luò)船數(shù)量 Total transferred: 56480000 bytes # 整個(gè)過(guò)程中的HTML內(nèi)容傳輸量 HTML transferred: 55920000 bytes # 最重要的指標(biāo)之一,相當(dāng)于LR中的每秒事務(wù)數(shù),后面括號(hào)中的mean表示這是一個(gè)平均值 Requests per second: 108.87 [#/sec] (mean) # 最重要的指標(biāo)之二,相當(dāng)于LR中的平均事務(wù)響應(yīng)時(shí)間,后面括號(hào)中的mean表示這是一個(gè)平均值 Time per request: 45927.886 [ms] (mean) # 每個(gè)連接請(qǐng)求實(shí)際運(yùn)行時(shí)間的平均值 Time per request: 9.186 [ms] (mean, across all concurrent requests) # 平均每秒網(wǎng)絡(luò)上的流量,可以幫助排除是否存在網(wǎng)絡(luò)流量過(guò)大導(dǎo)致響應(yīng)時(shí)間延長(zhǎng)的問(wèn)題 Transfer rate: 1200.93 [Kbytes/sec] receivedConnection Times (ms)min mean[+/-sd] median max Connect: 0 9 158.6 1 3002 Processing: 807 26109 12324.1 23463 45655 Waiting: 13 25646 12302.9 23003 45156 Total: 809 26118 12322.0 23464 45656Percentage of the requests served within a certain time (ms)50% 2346466% 3589975% 3912080% 3924490% 3944495% 4254698% 4560499% 45626100% 45656 (longest request)

參考資料:https://www.cnblogs.com/Ryana/p/6279232.html

總結(jié)

以上是生活随笔為你收集整理的Web 压力测试的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。