1 Star 0 Fork 12

maschzh/NSQ

forked from Gitee 极速下载/NSQ 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
bench.sh 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
readonly messageSize="${1:-200}"
readonly batchSize="${2:-200}"
readonly memQueueSize="${3:-1000000}"
readonly dataPath="${4:-}"
set -e
set -u
echo "# using --mem-queue-size=$memQueueSize --data-path=$dataPath --size=$messageSize --batch-size=$batchSize"
echo "# compiling/running nsqd"
pushd apps/nsqd >/dev/null
go build
rm -f *.dat
./nsqd --mem-queue-size=$memQueueSize --data-path=$dataPath >/dev/null 2>&1 &
nsqd_pid=$!
popd >/dev/null
cleanup() {
kill -9 $nsqd_pid
rm -f nsqd/*.dat
}
trap cleanup INT TERM EXIT
sleep 0.3
echo "# creating topic/channel"
curl --silent 'http://127.0.0.1:4151/create_topic?topic=sub_bench' >/dev/null 2>&1
curl --silent 'http://127.0.0.1:4151/create_channel?topic=sub_bench&channel=ch' >/dev/null 2>&1
echo "# compiling bench_reader/bench_writer"
pushd bench >/dev/null
for app in bench_reader bench_writer; do
pushd $app >/dev/null
go build
popd >/dev/null
done
popd >/dev/null
echo -n "PUB: "
bench/bench_writer/bench_writer --size=$messageSize --batch-size=$batchSize 2>&1
curl -s -o cpu.pprof http://127.0.0.1:4151/debug/pprof/profile &
pprof_pid=$!
echo -n "SUB: "
bench/bench_reader/bench_reader --size=$messageSize --channel=ch 2>&1
echo "waiting for pprof..."
wait $pprof_pid
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/maschzh/NSQ.git
[email protected]:maschzh/NSQ.git
maschzh
NSQ
NSQ
master

搜索帮助