Skip to content

Commit

Permalink
update setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ys-zhao committed Jan 18, 2022
1 parent e04ffd8 commit 547cd84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
40 changes: 13 additions & 27 deletions log.sh
Original file line number Diff line number Diff line change
@@ -1,50 +1,36 @@
#!/bin/bash

get_total(){
total=$(( total + 1 ))
echo $total
}

rand_str(){
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-1024} | head -n 1
}

prt_str(){
ts=$1
thread=$2
idx=$3
str=$(rand_str)
echo "ts=$ts, thread=$thread, item=$idx, $str"
}

runThread() {
ts=$1
thread=$2
start=$3
end=$4
size=$2
thread=$3
start=$4
end=$5
for ((idx=$start;idx<$end;idx++)); do
prt_str $ts $thread $idx
str="tR4ZbqdQFcGi3SZ1TRMNyf2TVtefQ3rPeUUJNryQIEYQxws2yG3ow3i5T10nM3moG+0HfiOTO4Hblqhg2JPO4hJVzpuin+jnWM7CfGpjXrWfhSi8kPrd279x4Q1OB595PXZaGLyS/fCjdY5U4sMhZGLvPMOeIgyeJa7F97sEvINAglghTsuHH+aWge0IIzIRCW7mBSsoWBQTF0TOEgf/t+SB31ZJy2EwCxrK8IK/P2PPl2iuOE9KApI2ZlJXZhMrGbLAv/nrIWXOrxcktL23aetzUX/wqqANWbe/8pEap7E2pVwKqTp9c23PkMKBvdi+8PGqxAhbilMvHLXLbLSpxnDdleZOXtJ1cYImLF1ZSvOt5SFnf3BpkSlxdiIfof9fh2s9aPRMVuFDgQznBQnmS5kOWrPj4RjvJNjmjkywrP/V+SgLuZ8G/B/fkTFfDhU3SZoCB7IhuwAPJC0Q4+ya2NHvRAsb7aM4e1bHrKDV1aygP4cI+w1vUHAHQdORgTOr0WZ9NF2TEtqCaGGUEdzCRlOywUOVfS755K3veH8AriiBCZOH6O9LLjna3mC35h6tj5vMijg4oIkts6MsktqAZXiBx6gK0v7poQkmTKkTPmpgPoM5AjTiweeOAsRhIE74uaMJxZx4K2lwRoBwI9n74IKLXH7+CCmNTg2WGuZyQAyAgl2eztb1WvEFCi2MLsnBQvefie1Ic3gVbzVnF45753cuG5aV1qFdMVN/mnnCXTrd6Yth/lZOFTc1xqbSRjkXf83Cnmc1lizZuD0gIuEiIyqcteerJOoO/P3KOglRuwKp041xkrumk1/TqbH4sRIJCAeu1/ThRDDl0nMVy9w4c/VIyVniXIAwCRexNH+tp2BZdNE4MRUEIwYxJ1kdc6K14sW6W1MBfMzPfaO+1N1WPnxpblnU10R3wIntBmMwS2BJZqu1Ep3Dge5wmIu5a+f9bfH2wogozguT7IaQlDlTvYpIYNM0QFuQM/GffOpoMrPf0VmtfFl14JhBMX4feYOe"
echo "ts=$ts, thread=$thread, item=$idx, $str"
done
}

runOnce(){
ts=$(date +%s)
items=$LOG_ITEMS
count=$LOG_COUNT
threads=$LOG_THREADS
count=$items/$threads
echo "ts=$ts, threads=$threads, items=$items, start"
size=$LOG_SIZE
echo "ts=$ts, threads=$threads, count=$count, start"
for ((thread=0;thread<$threads;thread++)); do
start=$thread*$count
end=($thread+1)*$count
runThread $ts $thread $start $end &
runThread $ts $size $thread $start $end &
done
echo "ts=$ts, threads=$thread, items=$num, stop"
echo "ts=$ts, threads=$threads, count=$count, stop"
}

main(){
interval=$LOG_INTERVAL
for ((i=0;i<10000000;i++)); do
runOnce
sleep 180
sleep $interval
done
}

Expand Down
5 changes: 3 additions & 2 deletions syslog.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ job "nomad-syslog-test" {
task "syslog" {
driver = "docker"
env {
LOG_ITEMS = 2000
LOG_COUNT = 2000
LOG_THREADS = 4
LOG_INTERVAL = "3m"
LOG_SIZE = 1024
LOG_INTERVAL = "5m"
}
config {
labels {
Expand Down

0 comments on commit 547cd84

Please sign in to comment.