一款基于命令行的网站压测小工具Webenchmark
- 支持HTTP GET, POST, PUT, DELETE, HEAD操作
- 支持长连接
- 支持多个URL混合测试
- 支持超时时间设置
- 支持身份认证, Basic Auth和Digest Auth
用法说明:
安装:
pip install webenchmark
命令行选项:
NikanMacBookPro:~ nikan$ webenchmark
usage: webenchmark [-h] [-c CONCURRENCY] [-n TOTAL_REQUESTS] [-m METHOD]
[-f FILE_PATH] [-d DATA] [-j JSON] [-t TIMEOUT] [-k]
[-a AUTH] [-H HEADERS] [-C COOKIES] [--version]
urls [urls ...]
HTTP压测小工具🎂 Author: Ni Kan(859905874@qq.com)
positional arguments:
urls 请求URL(一个或多个)
optional arguments:
-h, --help show this help message and exit
-c CONCURRENCY, --concurrency CONCURRENCY
并发数
-n TOTAL_REQUESTS, --number TOTAL_REQUESTS
请求数
-m METHOD, --method METHOD
请求方式{GET,POST,DELETE,PUT,HEAD,OPTIONS}
-f FILE_PATH, --file FILE_PATH
文件路径
-d DATA, --data DATA post/put 数据
-j JSON, --json JSON post/put json 数据
-t TIMEOUT, --timeout TIMEOUT
超时时间
-k, --keep-alive 是否启用长连接
-a AUTH, --auth AUTH 身份认证 eg. basic:user:password
-H HEADERS, --headers HEADERS
请求头
-C COOKIES, --cookies COOKIES
请求cookies
--version 当前版本
例子:
# 对单个请求进行get测试
webenchmark -c 10 -n 30 https://www.baidu.com
# 允许keep-alive
webenchmark -k -c 10 -n 30 https://www.baidu.com
# 设置超时时间(整数)
webenchmark -t 1 -c 10 -n 30 https://www.baidu.com
# 对多个URL进行混合请求
webenchmark -c 10 -n 30 https://www.baidu.com http://example.com/ https://www.taobao.com/
# basic auth
webenchmark -a basic:test_user:test_password http://example.com/
# digest auth
webenchmark -a digest:test_user:test_passtest_password http://example.com/
# post json
webenchmark -m POST -j "{'test':'test_json'}" -c 10 -n 100 http://example.com/
# post data
webenchmark -m POST -j "{'test':'test_json'}" -c 10 -n 100 http://example.com/
# Headers和Cookies
webenchmark -H "{'user-agent':'hahah'}" -C "{'a':'1'}" http://example.com/
# 有非常多的url可以放于文件中,每行一个url
webenchmark -f benchamark.txt
输出示例:
NikanMacBookPro:~ nikan$ webenchmark -c 10 -n 30 https://www.baidu.com
正在进行压测.....
压测结果========================
并发数: 10
请求数: 30
失败数: 0
非200请求数: 0
平均请求时长(秒): 0.100
============================
请求时间分布(秒)
0%(最快)0.078
10% 0.080
50% 0.094
90% 0.118
95% 0.121
100%(最慢)0.183
Metadata
Release files for webenchmark 1.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| webenchmark-1.0.10.tar.gz | 7.6 kB | Without provenance | Details for webenchmark-1.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| webenchmark-1.0.10-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for webenchmark-1.0.10-py2.py3-none-any.whl |
Total release size: 14.5 kB
Release files / webenchmark-1.0.10.tar.gz
| Download URL | webenchmark-1.0.10.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cfd6e81a6925e550d06c677149b6a80a27c1628c856bc253262936131a37ea7
|
|
BLAKE2b-256 checksum How to use checksums |
05bfe9b49ac7185bc0060a8facfff5162e48ac7e20efb70a738a9b3a89c66c03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|
Release files / webenchmark-1.0.10-py2.py3-none-any.whl
| Download URL | webenchmark-1.0.10-py2.py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b5b3b956793c0d18da741d4e86a22b568a8e6b025a38c4260c1ec75e3783ea4b
|
|
BLAKE2b-256 checksum How to use checksums |
57048f95d06e117e9ebb341043efa910ea391744e2269289b7a1154283689b6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
|
Security for webenchmark 1.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.