aim-proxy/fetch.sh

38 lines
704 B
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 要调用的URL
url="http://172.20.32.181:30059/api/runs/07cd1e6130c94e76bd48c528/info"
# 定义一个函数用于发出HTTP请求
fetch_url() {
curl -s -o /dev/null -w "%{http_code}" "$url"
}
# 总共调用次数
total_requests=60
# 每次并发数
concurrent_requests=10
# 计算需要的批次数
batches=$((total_requests / concurrent_requests))
#记录开始时间
start_time=$(date +%s)
# 执行请求
for ((i=0; i<batches; i++)); do
for ((j=0; j<concurrent_requests; j++)); do
fetch_url &
done
wait
done
# 记录结束时间
end_time=$(date +%s)
# 计算总共耗时
total_time=$((end_time - start_time))
# 输出结果
echo "Total time: $total_time seconds"