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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Web 压力测试

發布時間:2023/12/10 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Web 压力测试 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Apache Bench

ApacheBench 是 Apache 服務器自帶的一個web壓力測試工具,簡稱ab。ab又是一個命令行工具,對發起負載的本機要求很低,根據ab命令可以創建很多的并發訪問線程,模擬多個訪問者同時對某一URL地址進行訪問,因此可以用來測試目標服務器的負載壓力。總的來說ab工具小巧簡單,上手學習較快,可以提供需要的基本性能指標,但是沒有圖形化結果,不能監控。

點擊這里下載。

解壓后在httpd-2.4.39-win64-VC15\Apache24\bin文件夾下可以看到ab.exe。
即可以通過設置環境變量,也可以通過命令行直接進入該文件夾,調用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)

例如,我們測試 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# 測試界面 Document Path: / # 界面大小 Document Length: 11184 bytes# 測試的并發數 Concurrency Level: 5000 # 整個測試持續的時間 Time taken for tests: 45.928 seconds # 完成的請求數量 Complete requests: 5000 # 失敗的請求數量 Failed requests: 0 # 整個過程中的網絡船數量 Total transferred: 56480000 bytes # 整個過程中的HTML內容傳輸量 HTML transferred: 55920000 bytes # 最重要的指標之一,相當于LR中的每秒事務數,后面括號中的mean表示這是一個平均值 Requests per second: 108.87 [#/sec] (mean) # 最重要的指標之二,相當于LR中的平均事務響應時間,后面括號中的mean表示這是一個平均值 Time per request: 45927.886 [ms] (mean) # 每個連接請求實際運行時間的平均值 Time per request: 9.186 [ms] (mean, across all concurrent requests) # 平均每秒網絡上的流量,可以幫助排除是否存在網絡流量過大導致響應時間延長的問題 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

總結

以上是生活随笔為你收集整理的Web 压力测试的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。