Mac自带ab命令
# -n 请求的总数 -c 并发数
ab -n 1000 -c 100 https://localhost:6443/api/customize/concurrency
可能会报错:
socket: Too many open files (24)
使用ulimit -a
查看系统配置(ulimit命令用来限制用户对shell资源的访问)
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 256
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1418
virtual memory (kbytes, -v) unlimited
修改配置
ulimit -n 1000
ab -n 10000 -c 1000 https://localhost:6443/api/customize/concurrency
ab -n 1000 -c 100 -T application/json -p data.json https://localhost/api/v1/boost?token=8b247e169de3265b54c9142b0b7e8d5f37ede216
参数放在data.json里:
// data.json
{"req_key":"d8cdf1941ddd5b6fe04cfefb7e31e4a3"}